diff options
Diffstat (limited to 'drivers/input')
| -rw-r--r-- | drivers/input/serio/libps2.c | 10 | ||||
| -rw-r--r-- | drivers/input/serio/serio.c | 45 | ||||
| -rw-r--r-- | drivers/input/serio/serio_raw.c | 23 |
3 files changed, 40 insertions, 38 deletions
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c index d4c990f7c8..79c97f94bc 100644 --- a/drivers/input/serio/libps2.c +++ b/drivers/input/serio/libps2.c | |||
| @@ -84,7 +84,7 @@ void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout) | |||
| 84 | maxbytes = sizeof(ps2dev->cmdbuf); | 84 | maxbytes = sizeof(ps2dev->cmdbuf); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | down(&ps2dev->cmd_sem); | 87 | mutex_lock(&ps2dev->cmd_mutex); |
| 88 | 88 | ||
| 89 | serio_pause_rx(ps2dev->serio); | 89 | serio_pause_rx(ps2dev->serio); |
| 90 | ps2dev->flags = PS2_FLAG_CMD; | 90 | ps2dev->flags = PS2_FLAG_CMD; |
| @@ -94,7 +94,7 @@ void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout) | |||
| 94 | wait_event_timeout(ps2dev->wait, | 94 | wait_event_timeout(ps2dev->wait, |
| 95 | !(ps2dev->flags & PS2_FLAG_CMD), | 95 | !(ps2dev->flags & PS2_FLAG_CMD), |
| 96 | msecs_to_jiffies(timeout)); | 96 | msecs_to_jiffies(timeout)); |
| 97 | up(&ps2dev->cmd_sem); | 97 | mutex_unlock(&ps2dev->cmd_mutex); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | /* | 100 | /* |
| @@ -177,7 +177,7 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) | |||
| 177 | return -1; | 177 | return -1; |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | down(&ps2dev->cmd_sem); | 180 | mutex_lock(&ps2dev->cmd_mutex); |
| 181 | 181 | ||
| 182 | serio_pause_rx(ps2dev->serio); | 182 | serio_pause_rx(ps2dev->serio); |
| 183 | ps2dev->flags = command == PS2_CMD_GETID ? PS2_FLAG_WAITID : 0; | 183 | ps2dev->flags = command == PS2_CMD_GETID ? PS2_FLAG_WAITID : 0; |
| @@ -229,7 +229,7 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) | |||
| 229 | ps2dev->flags = 0; | 229 | ps2dev->flags = 0; |
| 230 | serio_continue_rx(ps2dev->serio); | 230 | serio_continue_rx(ps2dev->serio); |
| 231 | 231 | ||
| 232 | up(&ps2dev->cmd_sem); | 232 | mutex_unlock(&ps2dev->cmd_mutex); |
| 233 | return rc; | 233 | return rc; |
| 234 | } | 234 | } |
| 235 | 235 | ||
| @@ -281,7 +281,7 @@ int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int comman | |||
| 281 | 281 | ||
| 282 | void ps2_init(struct ps2dev *ps2dev, struct serio *serio) | 282 | void ps2_init(struct ps2dev *ps2dev, struct serio *serio) |
| 283 | { | 283 | { |
| 284 | init_MUTEX(&ps2dev->cmd_sem); | 284 | mutex_init(&ps2dev->cmd_mutex); |
| 285 | init_waitqueue_head(&ps2dev->wait); | 285 | init_waitqueue_head(&ps2dev->wait); |
| 286 | ps2dev->serio = serio; | 286 | ps2dev->serio = serio; |
| 287 | } | 287 | } |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 2f76813c3a..79e5e77ce0 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #include <linux/sched.h> | 34 | #include <linux/sched.h> |
| 35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
| 36 | #include <linux/kthread.h> | 36 | #include <linux/kthread.h> |
| 37 | #include <linux/mutex.h> | ||
| 37 | 38 | ||
| 38 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); | 39 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); |
| 39 | MODULE_DESCRIPTION("Serio abstraction core"); | 40 | MODULE_DESCRIPTION("Serio abstraction core"); |
| @@ -52,10 +53,10 @@ EXPORT_SYMBOL(serio_rescan); | |||
| 52 | EXPORT_SYMBOL(serio_reconnect); | 53 | EXPORT_SYMBOL(serio_reconnect); |
| 53 | 54 | ||
| 54 | /* | 55 | /* |
| 55 | * serio_sem protects entire serio subsystem and is taken every time | 56 | * serio_mutex protects entire serio subsystem and is taken every time |
| 56 | * serio port or driver registrered or unregistered. | 57 | * serio port or driver registrered or unregistered. |
| 57 | */ | 58 | */ |
| 58 | static DECLARE_MUTEX(serio_sem); | 59 | static DEFINE_MUTEX(serio_mutex); |
| 59 | 60 | ||
| 60 | static LIST_HEAD(serio_list); | 61 | static LIST_HEAD(serio_list); |
| 61 | 62 | ||
| @@ -70,9 +71,9 @@ static int serio_connect_driver(struct serio *serio, struct serio_driver *drv) | |||
| 70 | { | 71 | { |
| 71 | int retval; | 72 | int retval; |
| 72 | 73 | ||
| 73 | down(&serio->drv_sem); | 74 | mutex_lock(&serio->drv_mutex); |
| 74 | retval = drv->connect(serio, drv); | 75 | retval = drv->connect(serio, drv); |
| 75 | up(&serio->drv_sem); | 76 | mutex_unlock(&serio->drv_mutex); |
| 76 | 77 | ||
| 77 | return retval; | 78 | return retval; |
| 78 | } | 79 | } |
| @@ -81,20 +82,20 @@ static int serio_reconnect_driver(struct serio *serio) | |||
| 81 | { | 82 | { |
| 82 | int retval = -1; | 83 | int retval = -1; |
| 83 | 84 | ||
| 84 | down(&serio->drv_sem); | 85 | mutex_lock(&serio->drv_mutex); |
| 85 | if (serio->drv && serio->drv->reconnect) | 86 | if (serio->drv && serio->drv->reconnect) |
| 86 | retval = serio->drv->reconnect(serio); | 87 | retval = serio->drv->reconnect(serio); |
| 87 | up(&serio->drv_sem); | 88 | mutex_unlock(&serio->drv_mutex); |
| 88 | 89 | ||
| 89 | return retval; | 90 | return retval; |
| 90 | } | 91 | } |
| 91 | 92 | ||
| 92 | static void serio_disconnect_driver(struct serio *serio) | 93 | static void serio_disconnect_driver(struct serio *serio) |
| 93 | { | 94 | { |
| 94 | down(&serio->drv_sem); | 95 | mutex_lock(&serio->drv_mutex); |
| 95 | if (serio->drv) | 96 | if (serio->drv) |
| 96 | serio->drv->disconnect(serio); | 97 | serio->drv->disconnect(serio); |
| 97 | up(&serio->drv_sem); | 98 | mutex_unlock(&serio->drv_mutex); |
| 98 | } | 99 | } |
| 99 | 100 | ||
| 100 | static int serio_match_port(const struct serio_device_id *ids, struct serio *serio) | 101 | static int serio_match_port(const struct serio_device_id *ids, struct serio *serio) |
| @@ -272,7 +273,7 @@ static void serio_handle_event(void) | |||
| 272 | struct serio_event *event; | 273 | struct serio_event *event; |
| 273 | struct serio_driver *serio_drv; | 274 | struct serio_driver *serio_drv; |
| 274 | 275 | ||
| 275 | down(&serio_sem); | 276 | mutex_lock(&serio_mutex); |
| 276 | 277 | ||
| 277 | /* | 278 | /* |
| 278 | * Note that we handle only one event here to give swsusp | 279 | * Note that we handle only one event here to give swsusp |
| @@ -314,7 +315,7 @@ static void serio_handle_event(void) | |||
| 314 | serio_free_event(event); | 315 | serio_free_event(event); |
| 315 | } | 316 | } |
| 316 | 317 | ||
| 317 | up(&serio_sem); | 318 | mutex_unlock(&serio_mutex); |
| 318 | } | 319 | } |
| 319 | 320 | ||
| 320 | /* | 321 | /* |
| @@ -449,7 +450,7 @@ static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute * | |||
| 449 | struct device_driver *drv; | 450 | struct device_driver *drv; |
| 450 | int retval; | 451 | int retval; |
| 451 | 452 | ||
| 452 | retval = down_interruptible(&serio_sem); | 453 | retval = mutex_lock_interruptible(&serio_mutex); |
| 453 | if (retval) | 454 | if (retval) |
| 454 | return retval; | 455 | return retval; |
| 455 | 456 | ||
| @@ -469,7 +470,7 @@ static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute * | |||
| 469 | retval = -EINVAL; | 470 | retval = -EINVAL; |
| 470 | } | 471 | } |
| 471 | 472 | ||
| 472 | up(&serio_sem); | 473 | mutex_unlock(&serio_mutex); |
| 473 | 474 | ||
| 474 | return retval; | 475 | return retval; |
| 475 | } | 476 | } |
| @@ -524,7 +525,7 @@ static void serio_init_port(struct serio *serio) | |||
| 524 | __module_get(THIS_MODULE); | 525 | __module_get(THIS_MODULE); |
| 525 | 526 | ||
| 526 | spin_lock_init(&serio->lock); | 527 | spin_lock_init(&serio->lock); |
| 527 | init_MUTEX(&serio->drv_sem); | 528 | mutex_init(&serio->drv_mutex); |
| 528 | device_initialize(&serio->dev); | 529 | device_initialize(&serio->dev); |
| 529 | snprintf(serio->dev.bus_id, sizeof(serio->dev.bus_id), | 530 | snprintf(serio->dev.bus_id, sizeof(serio->dev.bus_id), |
| 530 | "serio%ld", (long)atomic_inc_return(&serio_no) - 1); | 531 | "serio%ld", (long)atomic_inc_return(&serio_no) - 1); |
| @@ -661,10 +662,10 @@ void __serio_register_port(struct serio *serio, struct module *owner) | |||
| 661 | */ | 662 | */ |
| 662 | void serio_unregister_port(struct serio *serio) | 663 | void serio_unregister_port(struct serio *serio) |
| 663 | { | 664 | { |
| 664 | down(&serio_sem); | 665 | mutex_lock(&serio_mutex); |
| 665 | serio_disconnect_port(serio); | 666 | serio_disconnect_port(serio); |
| 666 | serio_destroy_port(serio); | 667 | serio_destroy_port(serio); |
| 667 | up(&serio_sem); | 668 | mutex_unlock(&serio_mutex); |
| 668 | } | 669 | } |
| 669 | 670 | ||
| 670 | /* | 671 | /* |
| @@ -672,17 +673,17 @@ void serio_unregister_port(struct serio *serio) | |||
| 672 | */ | 673 | */ |
| 673 | void serio_unregister_child_port(struct serio *serio) | 674 | void serio_unregister_child_port(struct serio *serio) |
| 674 | { | 675 | { |
| 675 | down(&serio_sem); | 676 | mutex_lock(&serio_mutex); |
| 676 | if (serio->child) { | 677 | if (serio->child) { |
