diff options
author | Arjan van de Ven <arjan@infradead.org> | 2006-02-19 00:21:55 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-02-19 00:21:55 -0500 |
commit | c4e32e9faaaa83340dbbc00e07c48d38f032b7dc (patch) | |
tree | aa3adb5073a8c4c70a7f4b7f2dda57e9d1c52d85 /drivers/input/serio/serio.c | |
parent | e676c232e670e27d8b3783e1167f34288e17c83f (diff) |
Input: serio - semaphore to mutex conversion
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/serio/serio.c')
-rw-r--r-- | drivers/input/serio/serio.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 2f76813c3a64..79e5e77ce03e 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) { |
677 | serio_disconnect_port(serio->child); | 678 | serio_disconnect_port(serio->child); |
678 | serio_destroy_port(serio->child); | 679 | serio_destroy_port(serio->child); |
679 | } | 680 | } |
680 | up(&serio_sem); | 681 | mutex_unlock(&serio_mutex); |
681 | } | 682 | } |
682 | 683 | ||
683 | /* | 684 | /* |
684 | * Submits register request to kseriod for subsequent execution. | 685 | * Submits register request to kseriod for subsequent execution. |
685 | * Can be used when it is not obvious whether the serio_sem is | 686 | * Can be used when it is not obvious whether the serio_mutex is |
686 | * taken or not and when delayed execution is feasible. | 687 | * taken or not and when delayed execution is feasible. |
687 | */ | 688 | */ |
688 | void __serio_unregister_port_delayed(struct serio *serio, struct module *owner) | 689 | void __serio_unregister_port_delayed(struct serio *serio, struct module *owner) |
@@ -765,7 +766,7 @@ void serio_unregister_driver(struct serio_driver *drv) | |||
765 | { | 766 | { |
766 | struct serio *serio; | 767 | struct serio *serio; |
767 | 768 | ||
768 | down(&serio_sem); | 769 | mutex_lock(&serio_mutex); |
769 | drv->manual_bind = 1; /* so serio_find_driver ignores it */ | 770 | drv->manual_bind = 1; /* so serio_find_driver ignores it */ |
770 | 771 | ||
771 | start_over: | 772 | start_over: |
@@ -779,7 +780,7 @@ start_over: | |||
779 | } | 780 | } |
780 | 781 | ||
781 | driver_unregister(&drv->driver); | 782 | driver_unregister(&drv->driver); |
782 | up(&serio_sem); | 783 | mutex_unlock(&serio_mutex); |
783 | } | 784 | } |
784 | 785 | ||
785 | static void serio_set_drv(struct serio *serio, struct serio_driver *drv) | 786 | static void serio_set_drv(struct serio *serio, struct serio_driver *drv) |
@@ -858,7 +859,7 @@ static int serio_resume(struct device *dev) | |||
858 | return 0; | 859 | return 0; |
859 | } | 860 | } |
860 | 861 | ||
861 | /* called from serio_driver->connect/disconnect methods under serio_sem */ | 862 | /* called from serio_driver->connect/disconnect methods under serio_mutex */ |
862 | int serio_open(struct serio *serio, struct serio_driver *drv) | 863 | int serio_open(struct serio *serio, struct serio_driver *drv) |
863 | { | 864 | { |
864 | serio_set_drv(serio, drv); | 865 | serio_set_drv(serio, drv); |
@@ -870,7 +871,7 @@ int serio_open(struct serio *serio, struct serio_driver *drv) | |||
870 | return 0; | 871 | return 0; |
871 | } | 872 | } |
872 | 873 | ||
873 | /* called from serio_driver->connect/disconnect methods under serio_sem */ | 874 | /* called from serio_driver->connect/disconnect methods under serio_mutex */ |
874 | void serio_close(struct serio *serio) | 875 | void serio_close(struct serio *serio) |
875 | { | 876 | { |
876 | if (serio->close) | 877 | if (serio->close) |