Commit 20da92de authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: change input handlers to use bool when possible

Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 72c8a94a
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "input-compat.h" #include "input-compat.h"
struct evdev { struct evdev {
int exist;
int open; int open;
int minor; int minor;
struct input_handle handle; struct input_handle handle;
...@@ -34,6 +33,7 @@ struct evdev { ...@@ -34,6 +33,7 @@ struct evdev {
spinlock_t client_lock; /* protects client_list */ spinlock_t client_lock; /* protects client_list */
struct mutex mutex; struct mutex mutex;
struct device dev; struct device dev;
bool exist;
}; };
struct evdev_client { struct evdev_client {
...@@ -793,7 +793,7 @@ static void evdev_remove_chrdev(struct evdev *evdev) ...@@ -793,7 +793,7 @@ static void evdev_remove_chrdev(struct evdev *evdev)
static void evdev_mark_dead(struct evdev *evdev) static void evdev_mark_dead(struct evdev *evdev)
{ {
mutex_lock(&evdev->mutex); mutex_lock(&evdev->mutex);
evdev->exist = 0; evdev->exist = false;
mutex_unlock(&evdev->mutex); mutex_unlock(&evdev->mutex);
} }
...@@ -842,7 +842,7 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev, ...@@ -842,7 +842,7 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev,
init_waitqueue_head(&evdev->wait); init_waitqueue_head(&evdev->wait);
dev_set_name(&evdev->dev, "event%d", minor); dev_set_name(&evdev->dev, "event%d", minor);
evdev->exist = 1; evdev->exist = true;
evdev->minor = minor; evdev->minor = minor;
evdev->handle.dev = input_get_device(dev); evdev->handle.dev = input_get_device(dev);
......
...@@ -227,12 +227,12 @@ static void input_handle_event(struct input_dev *dev, ...@@ -227,12 +227,12 @@ static void input_handle_event(struct input_dev *dev,
case SYN_REPORT: case SYN_REPORT:
if (!dev->sync) { if (!dev->sync) {
dev->sync = 1; dev->sync = true;
disposition = INPUT_PASS_TO_HANDLERS; disposition = INPUT_PASS_TO_HANDLERS;
} }
break; break;
case SYN_MT_REPORT: case SYN_MT_REPORT:
dev->sync = 0; dev->sync = false;
disposition = INPUT_PASS_TO_HANDLERS; disposition = INPUT_PASS_TO_HANDLERS;
break; break;
} }
...@@ -317,7 +317,7 @@ static void input_handle_event(struct input_dev *dev, ...@@ -317,7 +317,7 @@ static void input_handle_event(struct input_dev *dev,
} }
if (disposition != INPUT_IGNORE_EVENT && type != EV_SYN) if (disposition != INPUT_IGNORE_EVENT && type != EV_SYN)
dev->sync = 0; dev->sync = false;
if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event) if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event)
dev->event(dev, type, code, value); dev->event(dev, type, code, value);
......
...@@ -37,7 +37,6 @@ MODULE_LICENSE("GPL"); ...@@ -37,7 +37,6 @@ MODULE_LICENSE("GPL");
#define JOYDEV_BUFFER_SIZE 64 #define JOYDEV_BUFFER_SIZE 64
struct joydev { struct joydev {
int exist;
int open; int open;
int minor; int minor;
struct input_handle handle; struct input_handle handle;
...@@ -46,6 +45,7 @@ struct joydev { ...@@ -46,6 +45,7 @@ struct joydev {
spinlock_t client_lock; /* protects client_list */ spinlock_t client_lock; /* protects client_list */
struct mutex mutex; struct mutex mutex;
struct device dev; struct device dev;
bool exist;
struct js_corr corr[ABS_CNT]; struct js_corr corr[ABS_CNT];
struct JS_DATA_SAVE_TYPE glue; struct JS_DATA_SAVE_TYPE glue;
...@@ -760,7 +760,7 @@ static void joydev_remove_chrdev(struct joydev *joydev) ...@@ -760,7 +760,7 @@ static void joydev_remove_chrdev(struct joydev *joydev)
static void joydev_mark_dead(struct joydev *joydev) static void joydev_mark_dead(struct joydev *joydev)
{ {
mutex_lock(&joydev->mutex); mutex_lock(&joydev->mutex);
joydev->exist = 0; joydev->exist = false;
mutex_unlock(&joydev->mutex); mutex_unlock(&joydev->mutex);
} }
...@@ -817,10 +817,9 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev, ...@@ -817,10 +817,9 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
init_waitqueue_head(&joydev->wait); init_waitqueue_head(&joydev->wait);
dev_set_name(&joydev->dev, "js%d", minor); dev_set_name(&joydev->dev, "js%d", minor);
joydev->exist = 1; joydev->exist = true;
joydev->minor = minor; joydev->minor = minor;
joydev->exist = 1;
joydev->handle.dev = input_get_device(dev); joydev->handle.dev = input_get_device(dev);
joydev->handle.name = dev_name(&joydev->dev); joydev->handle.name = dev_name(&joydev->dev);
joydev->handle.handler = handler; joydev->handle.handler = handler;
......
...@@ -57,7 +57,6 @@ struct mousedev_hw_data { ...@@ -57,7 +57,6 @@ struct mousedev_hw_data {
}; };
struct mousedev { struct mousedev {
int exist;
int open; int open;
int minor; int minor;
struct input_handle handle; struct input_handle handle;
...@@ -66,6 +65,7 @@ struct mousedev { ...@@ -66,6 +65,7 @@ struct mousedev {
spinlock_t client_lock; /* protects client_list */ spinlock_t client_lock; /* protects client_list */
struct mutex mutex; struct mutex mutex;
struct device dev; struct device dev;
bool exist;
struct list_head mixdev_node; struct list_head mixdev_node;
int mixdev_open; int mixdev_open;
...@@ -802,7 +802,7 @@ static void mousedev_remove_chrdev(struct mousedev *mousedev) ...@@ -802,7 +802,7 @@ static void mousedev_remove_chrdev(struct mousedev *mousedev)
static void mousedev_mark_dead(struct mousedev *mousedev) static void mousedev_mark_dead(struct mousedev *mousedev)
{ {
mutex_lock(&mousedev->mutex); mutex_lock(&mousedev->mutex);
mousedev->exist = 0; mousedev->exist = false;
mutex_unlock(&mousedev->mutex); mutex_unlock(&mousedev->mutex);
} }
...@@ -862,7 +862,7 @@ static struct mousedev *mousedev_create(struct input_dev *dev, ...@@ -862,7 +862,7 @@ static struct mousedev *mousedev_create(struct input_dev *dev,
dev_set_name(&mousedev->dev, "mouse%d", minor); dev_set_name(&mousedev->dev, "mouse%d", minor);
mousedev->minor = minor; mousedev->minor = minor;
mousedev->exist = 1; mousedev->exist = true;
mousedev->handle.dev = input_get_device(dev); mousedev->handle.dev = input_get_device(dev);
mousedev->handle.name = dev_name(&mousedev->dev); mousedev->handle.name = dev_name(&mousedev->dev);
mousedev->handle.handler = handler; mousedev->handle.handler = handler;
......
...@@ -1099,7 +1099,6 @@ struct input_mt_slot { ...@@ -1099,7 +1099,6 @@ struct input_mt_slot {
* @repeat_key: stores key code of the last key pressed; used to implement * @repeat_key: stores key code of the last key pressed; used to implement
* software autorepeat * software autorepeat
* @timer: timer for software autorepeat * @timer: timer for software autorepeat
* @sync: set to 1 when there were no new events since last EV_SYNC
* @abs: current values for reports from absolute axes * @abs: current values for reports from absolute axes
* @rep: current values for autorepeat parameters (delay, rate) * @rep: current values for autorepeat parameters (delay, rate)
* @mt: pointer to array of struct input_mt_slot holding current values * @mt: pointer to array of struct input_mt_slot holding current values
...@@ -1144,6 +1143,7 @@ struct input_mt_slot { ...@@ -1144,6 +1143,7 @@ struct input_mt_slot {
* last user closes the device * last user closes the device
* @going_away: marks devices that are in a middle of unregistering and * @going_away: marks devices that are in a middle of unregistering and
* causes input_open_device*() fail with -ENODEV. * causes input_open_device*() fail with -ENODEV.
* @sync: set to %true when there were no new events since last EV_SYN
* @dev: driver model's view of this device * @dev: driver model's view of this device
* @h_list: list of input handles associated with the device. When * @h_list: list of input handles associated with the device. When
* accessing the list dev->mutex must be held * accessing the list dev->mutex must be held
...@@ -1180,8 +1180,6 @@ struct input_dev { ...@@ -1180,8 +1180,6 @@ struct input_dev {
unsigned int repeat_key; unsigned int repeat_key;
struct timer_list timer; struct timer_list timer;
int sync;
int abs[ABS_CNT]; int abs[ABS_CNT];
int rep[REP_MAX + 1]; int rep[REP_MAX + 1];
...@@ -1213,6 +1211,8 @@ struct input_dev { ...@@ -1213,6 +1211,8 @@ struct input_dev {
unsigned int users; unsigned int users;
bool going_away; bool going_away;
bool sync;
struct device dev; struct device dev;
struct list_head h_list; struct list_head h_list;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment