diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/Makefile | 4 | ||||
-rw-r--r-- | drivers/input/gameport/gameport.c | 29 | ||||
-rw-r--r-- | drivers/input/input.c | 15 | ||||
-rw-r--r-- | drivers/input/joystick/amijoy.c | 11 | ||||
-rw-r--r-- | drivers/input/joystick/db9.c | 13 | ||||
-rw-r--r-- | drivers/input/joystick/gamecon.c | 13 | ||||
-rw-r--r-- | drivers/input/joystick/iforce/iforce-ff.c | 24 | ||||
-rw-r--r-- | drivers/input/joystick/iforce/iforce-main.c | 2 | ||||
-rw-r--r-- | drivers/input/joystick/iforce/iforce.h | 5 | ||||
-rw-r--r-- | drivers/input/joystick/turbografx.c | 13 | ||||
-rw-r--r-- | drivers/input/keyboard/atkbd.c | 9 | ||||
-rw-r--r-- | drivers/input/misc/uinput.c | 14 | ||||
-rw-r--r-- | drivers/input/mouse/psmouse-base.c | 38 | ||||
-rw-r--r-- | drivers/input/serio/libps2.c | 10 | ||||
-rw-r--r-- | drivers/input/serio/serio.c | 47 | ||||
-rw-r--r-- | drivers/input/serio/serio_raw.c | 23 |
16 files changed, 140 insertions, 130 deletions
diff --git a/drivers/Makefile b/drivers/Makefile index 5c69b86db624..6495411337d8 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -25,9 +25,6 @@ obj-$(CONFIG_CONNECTOR) += connector/ | |||
25 | obj-$(CONFIG_FB_I810) += video/i810/ | 25 | obj-$(CONFIG_FB_I810) += video/i810/ |
26 | obj-$(CONFIG_FB_INTEL) += video/intelfb/ | 26 | obj-$(CONFIG_FB_INTEL) += video/intelfb/ |
27 | 27 | ||
28 | # we also need input/serio early so serio bus is initialized by the time | ||
29 | # serial drivers start registering their serio ports | ||
30 | obj-$(CONFIG_SERIO) += input/serio/ | ||
31 | obj-y += serial/ | 28 | obj-y += serial/ |
32 | obj-$(CONFIG_PARPORT) += parport/ | 29 | obj-$(CONFIG_PARPORT) += parport/ |
33 | obj-y += base/ block/ misc/ mfd/ net/ media/ | 30 | obj-y += base/ block/ misc/ mfd/ net/ media/ |
@@ -53,6 +50,7 @@ obj-$(CONFIG_TC) += tc/ | |||
53 | obj-$(CONFIG_USB) += usb/ | 50 | obj-$(CONFIG_USB) += usb/ |
54 | obj-$(CONFIG_PCI) += usb/ | 51 | obj-$(CONFIG_PCI) += usb/ |
55 | obj-$(CONFIG_USB_GADGET) += usb/gadget/ | 52 | obj-$(CONFIG_USB_GADGET) += usb/gadget/ |
53 | obj-$(CONFIG_SERIO) += input/serio/ | ||
56 | obj-$(CONFIG_GAMEPORT) += input/gameport/ | 54 | obj-$(CONFIG_GAMEPORT) += input/gameport/ |
57 | obj-$(CONFIG_INPUT) += input/ | 55 | obj-$(CONFIG_INPUT) += input/ |
58 | obj-$(CONFIG_I2O) += message/ | 56 | obj-$(CONFIG_I2O) += message/ |
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index b765a155c008..bcfd700829a1 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/kthread.h> | 23 | #include <linux/kthread.h> |
24 | #include <linux/sched.h> /* HZ */ | 24 | #include <linux/sched.h> /* HZ */ |
25 | #include <linux/mutex.h> | ||
25 | 26 | ||
26 | /*#include <asm/io.h>*/ | 27 | /*#include <asm/io.h>*/ |
27 | 28 | ||
@@ -43,10 +44,10 @@ EXPORT_SYMBOL(gameport_start_polling); | |||
43 | EXPORT_SYMBOL(gameport_stop_polling); | 44 | EXPORT_SYMBOL(gameport_stop_polling); |
44 | 45 | ||
45 | /* | 46 | /* |
46 | * gameport_sem protects entire gameport subsystem and is taken | 47 | * gameport_mutex protects entire gameport subsystem and is taken |
47 | * every time gameport port or driver registrered or unregistered. | 48 | * every time gameport port or driver registrered or unregistered. |
48 | */ | 49 | */ |
49 | static DECLARE_MUTEX(gameport_sem); | 50 | static DEFINE_MUTEX(gameport_mutex); |
50 | 51 | ||
51 | static LIST_HEAD(gameport_list); | 52 | static LIST_HEAD(gameport_list); |
52 | 53 | ||
@@ -342,7 +343,7 @@ static void gameport_handle_event(void) | |||
342 | struct gameport_event *event; | 343 | struct gameport_event *event; |
343 | struct gameport_driver *gameport_drv; | 344 | struct gameport_driver *gameport_drv; |
344 | 345 | ||
345 | down(&gameport_sem); | 346 | mutex_lock(&gameport_mutex); |
346 | 347 | ||
347 | /* | 348 | /* |
348 | * Note that we handle only one event here to give swsusp | 349 | * Note that we handle only one event here to give swsusp |
@@ -379,7 +380,7 @@ static void gameport_handle_event(void) | |||
379 | gameport_free_event(event); | 380 | gameport_free_event(event); |
380 | } | 381 | } |
381 | 382 | ||
382 | up(&gameport_sem); | 383 | mutex_unlock(&gameport_mutex); |
383 | } | 384 | } |
384 | 385 | ||
385 | /* | 386 | /* |
@@ -464,7 +465,7 @@ static ssize_t gameport_rebind_driver(struct device *dev, struct device_attribut | |||
464 | struct device_driver *drv; | 465 | struct device_driver *drv; |
465 | int retval; | 466 | int retval; |
466 | 467 | ||
467 | retval = down_interruptible(&gameport_sem); | 468 | retval = mutex_lock_interruptible(&gameport_mutex); |
468 | if (retval) | 469 | if (retval) |
469 | return retval; | 470 | return retval; |
470 | 471 | ||
@@ -484,7 +485,7 @@ static ssize_t gameport_rebind_driver(struct device *dev, struct device_attribut | |||
484 | retval = -EINVAL; | 485 | retval = -EINVAL; |
485 | } | 486 | } |
486 | 487 | ||
487 | up(&gameport_sem); | 488 | mutex_unlock(&gameport_mutex); |
488 | 489 | ||
489 | return retval; | 490 | return retval; |
490 | } | 491 | } |
@@ -521,7 +522,7 @@ static void gameport_init_port(struct gameport *gameport) | |||
521 | 522 | ||
522 | __module_get(THIS_MODULE); | 523 | __module_get(THIS_MODULE); |
523 | 524 | ||
524 | init_MUTEX(&gameport->drv_sem); | 525 | mutex_init(&gameport->drv_mutex); |
525 | device_initialize(&gameport->dev); | 526 | device_initialize(&gameport->dev); |
526 | snprintf(gameport->dev.bus_id, sizeof(gameport->dev.bus_id), | 527 | snprintf(gameport->dev.bus_id, sizeof(gameport->dev.bus_id), |
527 | "gameport%lu", (unsigned long)atomic_inc_return(&gameport_no) - 1); | 528 | "gameport%lu", (unsigned long)atomic_inc_return(&gameport_no) - 1); |
@@ -661,10 +662,10 @@ void __gameport_register_port(struct gameport *gameport, struct module *owner) | |||
661 | */ | 662 | */ |
662 | void gameport_unregister_port(struct gameport *gameport) | 663 | void gameport_unregister_port(struct gameport *gameport) |
663 | { | 664 | { |
664 | down(&gameport_sem); | 665 | mutex_lock(&gameport_mutex); |
665 | gameport_disconnect_port(gameport); | 666 | gameport_disconnect_port(gameport); |
666 | gameport_destroy_port(gameport); | 667 | gameport_destroy_port(gameport); |
667 | up(&gameport_sem); | 668 | mutex_unlock(&gameport_mutex); |
668 | } | 669 | } |
669 | 670 | ||
670 | 671 | ||
@@ -717,7 +718,7 @@ void gameport_unregister_driver(struct gameport_driver *drv) | |||
717 | { | 718 | { |
718 | struct gameport *gameport; | 719 | struct gameport *gameport; |
719 | 720 | ||
720 | down(&gameport_sem); | 721 | mutex_lock(&gameport_mutex); |
721 | drv->ignore = 1; /* so gameport_find_driver ignores it */ | 722 | drv->ignore = 1; /* so gameport_find_driver ignores it */ |
722 | 723 | ||
723 | start_over: | 724 | start_over: |
@@ -731,7 +732,7 @@ start_over: | |||
731 | } | 732 | } |
732 | 733 | ||
733 | driver_unregister(&drv->driver); | 734 | driver_unregister(&drv->driver); |
734 | up(&gameport_sem); | 735 | mutex_unlock(&gameport_mutex); |
735 | } | 736 | } |
736 | 737 | ||
737 | static int gameport_bus_match(struct device *dev, struct device_driver *drv) | 738 | static int gameport_bus_match(struct device *dev, struct device_driver *drv) |
@@ -743,9 +744,9 @@ static int gameport_bus_match(struct device *dev, struct device_driver *drv) | |||
743 | 744 | ||
744 | static void gameport_set_drv(struct gameport *gameport, struct gameport_driver *drv) | 745 | static void gameport_set_drv(struct gameport *gameport, struct gameport_driver *drv) |
745 | { | 746 | { |
746 | down(&gameport->drv_sem); | 747 | mutex_lock(&gameport->drv_mutex); |
747 | gameport->drv = drv; | 748 | gameport->drv = drv; |
748 | up(&gameport->drv_sem); | 749 | mutex_unlock(&gameport->drv_mutex); |
749 | } | 750 | } |
750 | 751 | ||
751 | int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode) | 752 | int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode) |
@@ -796,5 +797,5 @@ static void __exit gameport_exit(void) | |||
796 | kthread_stop(gameport_task); | 797 | kthread_stop(gameport_task); |
797 | } | 798 | } |
798 | 799 | ||
799 | module_init(gameport_init); | 800 | subsys_initcall(gameport_init); |
800 | module_exit(gameport_exit); | 801 | module_exit(gameport_exit); |
diff --git a/drivers/input/input.c b/drivers/input/input.c index 4fe3da3c667a..3e22bb11ee05 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
22 | #include <linux/poll.h> | 22 | #include <linux/poll.h> |
23 | #include <linux/device.h> | 23 | #include <linux/device.h> |
24 | #include <linux/mutex.h> | ||
24 | 25 | ||
25 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>"); | 26 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>"); |
26 | MODULE_DESCRIPTION("Input core"); | 27 | MODULE_DESCRIPTION("Input core"); |
@@ -224,7 +225,7 @@ int input_open_device(struct input_handle *handle) | |||
224 | struct input_dev *dev = handle->dev; | 225 | struct input_dev *dev = handle->dev; |
225 | int err; | 226 | int err; |
226 | 227 | ||
227 | err = down_interruptible(&dev->sem); | 228 | err = mutex_lock_interruptible(&dev->mutex); |
228 | if (err) | 229 | if (err) |
229 | return err; | 230 | return err; |
230 | 231 | ||
@@ -236,7 +237,7 @@ int input_open_device(struct input_handle *handle) | |||
236 | if (err) | 237 | if (err) |
237 | handle->open--; | 238 | handle->open--; |
238 | 239 | ||
239 | up(&dev->sem); | 240 | mutex_unlock(&dev->mutex); |
240 | 241 | ||
241 | return err; | 242 | return err; |
242 | } | 243 | } |
@@ -255,13 +256,13 @@ void input_close_device(struct input_handle *handle) | |||
255 | 256 | ||
256 | input_release_device(handle); | 257 | input_release_device(handle); |
257 | 258 | ||
258 | down(&dev->sem); | 259 | mutex_lock(&dev->mutex); |
259 | 260 | ||
260 | if (!--dev->users && dev->close) | 261 | if (!--dev->users && dev->close) |
261 | dev->close(dev); | 262 | dev->close(dev); |
262 | handle->open--; | 263 | handle->open--; |
263 | 264 | ||
264 | up(&dev->sem); | 265 | mutex_unlock(&dev->mutex); |
265 | } | 266 | } |
266 | 267 | ||
267 | static void input_link_handle(struct input_handle *handle) | 268 | static void input_link_handle(struct input_handle *handle) |
@@ -512,13 +513,13 @@ static ssize_t input_dev_show_##name(struct class_device *dev, char *buf) \ | |||
512 | struct input_dev *input_dev = to_input_dev(dev); \ | 513 | struct input_dev *input_dev = to_input_dev(dev); \ |
513 | int retval; \ | 514 | int retval; \ |
514 | \ | 515 | \ |
515 | retval = down_interruptible(&input_dev->sem); \ | 516 | retval = mutex_lock_interruptible(&input_dev->mutex); \ |
516 | if (retval) \ | 517 | if (retval) \ |
517 | return retval; \ | 518 | return retval; \ |
518 | \ | 519 | \ |
519 | retval = sprintf(buf, "%s\n", input_dev->name ? input_dev->name : ""); \ | 520 | retval = sprintf(buf, "%s\n", input_dev->name ? input_dev->name : ""); \ |
520 | \ | 521 | \ |
521 | up(&input_dev->sem); \ | 522 | mutex_unlock(&input_dev->mutex); \ |
522 | \ | 523 | \ |
523 | return retval; \ | 524 | return retval; \ |
524 | } \ | 525 | } \ |
@@ -790,7 +791,7 @@ int input_register_device(struct input_dev *dev) | |||
790 | return -EINVAL; | 791 | return -EINVAL; |
791 | } | 792 | } |
792 | 793 | ||
793 | init_MUTEX(&dev->sem); | 794 | mutex_init(&dev->mutex); |
794 | set_bit(EV_SYN, dev->evbit); | 795 | set_bit(EV_SYN, dev->evbit); |
795 | 796 | ||
796 | /* | 797 | /* |
diff --git a/drivers/input/joystick/amijoy.c b/drivers/input/joystick/amijoy.c index ec55a29fc861..7249d324297b 100644 --- a/drivers/input/joystick/amijoy.c +++ b/drivers/input/joystick/amijoy.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/input.h> | 37 | #include <linux/input.h> |
38 | #include <linux/interrupt.h> | 38 | #include <linux/interrupt.h> |
39 | #include <linux/mutex.h> | ||
39 | 40 | ||
40 | #include <asm/system.h> | 41 | #include <asm/system.h> |
41 | #include <asm/amigahw.h> | 42 | #include <asm/amigahw.h> |
@@ -52,7 +53,7 @@ MODULE_PARM_DESC(map, "Map of attached joysticks in form of <a>,<b> (default is | |||
52 | __obsolete_setup("amijoy="); | 53 | __obsolete_setup("amijoy="); |
53 | 54 | ||
54 | static int amijoy_used; | 55 | static int amijoy_used; |
55 | static DECLARE_MUTEX(amijoy_sem); | 56 | static DEFINE_MUTEX(amijoy_mutex); |
56 | static struct input_dev *amijoy_dev[2]; | 57 | static struct input_dev *amijoy_dev[2]; |
57 | static char *amijoy_phys[2] = { "amijoy/input0", "amijoy/input1" }; | 58 | static char *amijoy_phys[2] = { "amijoy/input0", "amijoy/input1" }; |
58 | 59 | ||
@@ -85,7 +86,7 @@ static int amijoy_open(struct input_dev *dev) | |||
85 | { | 86 | { |
86 | int err; | 87 | int err; |
87 | 88 | ||
88 | err = down_interruptible(&amijoy_sem); | 89 | err = mutex_lock_interruptible(&amijoy_mutex); |
89 | if (err) | 90 | if (err) |
90 | return err; | 91 | return err; |
91 | 92 | ||
@@ -97,16 +98,16 @@ static int amijoy_open(struct input_dev *dev) | |||
97 | 98 | ||
98 | amijoy_used++; | 99 | amijoy_used++; |
99 | out: | 100 | out: |
100 | up(&amijoy_sem); | 101 | mutex_unlock(&amijoy_mutex); |
101 | return err; | 102 | return err; |
102 | } | 103 | } |
103 | 104 | ||
104 | static void amijoy_close(struct input_dev *dev) | 105 | static void amijoy_close(struct input_dev *dev) |
105 | { | 106 | { |
106 | down(&amijoy_sem); | 107 | mutex_lock(&amijoy_mutex); |
107 | if (!--amijoy_used) | 108 | if (!--amijoy_used) |
108 | free_irq(IRQ_AMIGA_VERTB, amijoy_interrupt); | 109 | free_irq(IRQ_AMIGA_VERTB, amijoy_interrupt); |
109 | up(&amijoy_sem); | 110 | mutex_unlock(&amijoy_mutex); |
110 | } | 111 | } |
111 | 112 | ||
112 | static int __init amijoy_init(void) | 113 | static int __init amijoy_init(void) |
diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c index dcffc34f30c3..e61894685cb1 100644 --- a/drivers/input/joystick/db9.c +++ b/drivers/input/joystick/db9.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/init.h> | 38 | #include <linux/init.h> |
39 | #include <linux/parport.h> | 39 | #include <linux/parport.h> |
40 | #include <linux/input.h> | 40 | #include <linux/input.h> |
41 | #include <linux/mutex.h> | ||
41 | 42 | ||
42 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); | 43 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); |
43 | MODULE_DESCRIPTION("Atari, Amstrad, Commodore, Amiga, Sega, etc. joystick driver"); | 44 | MODULE_DESCRIPTION("Atari, Amstrad, Commodore, Amiga, Sega, etc. joystick driver"); |
@@ -111,7 +112,7 @@ struct db9 { | |||
111 | struct pardevice *pd; | 112 | struct pardevice *pd; |
112 | int mode; | 113 | int mode; |
113 | int used; | 114 | int used; |
114 | struct semaphore sem; | 115 | struct mutex mutex; |
115 | char phys[DB9_MAX_DEVICES][32]; | 116 | char phys[DB9_MAX_DEVICES][32]; |
116 | }; | 117 | }; |
117 | 118 | ||
@@ -525,7 +526,7 @@ static int db9_open(struct input_dev *dev) | |||
525 | struct parport *port = db9->pd->port; | 526 | struct parport *port = db9->pd->port; |
526 | int err; | 527 | int err; |
527 | 528 | ||
528 | err = down_interruptible(&db9->sem); | 529 | err = mutex_lock_interruptible(&db9->mutex); |
529 | if (err) | 530 | if (err) |
530 | return err; | 531 | return err; |
531 | 532 | ||
@@ -539,7 +540,7 @@ static int db9_open(struct input_dev *dev) | |||
539 | mod_timer(&db9->timer, jiffies + DB9_REFRESH_TIME); | 540 | mod_timer(&db9->timer, jiffies + DB9_REFRESH_TIME); |
540 | } | 541 | } |
541 | 542 | ||
542 | up(&db9->sem); | 543 | mutex_unlock(&db9->mutex); |
543 | return 0; | 544 | return 0; |
544 | } | 545 | } |
545 | 546 | ||
@@ -548,14 +549,14 @@ static void db9_close(struct input_dev *dev) | |||
548 | struct db9 *db9 = dev->private; | 549 | struct db9 *db9 = dev->private; |
549 | struct parport *port = db9->pd->port; | 550 | struct parport *port = db9->pd->port; |
550 | 551 | ||
551 | down(&db9->sem); | 552 | mutex_lock(&db9->mutex); |
552 | if (!--db9->used) { | 553 | if (!--db9->used) { |
553 | del_timer_sync(&db9->timer); | 554 | del_timer_sync(&db9->timer); |
554 | parport_write_control(port, 0x00); | 555 | parport_write_control(port, 0x00); |
555 | parport_data_forward(port); | 556 | parport_data_forward(port); |
556 | parport_release(db9->pd); | 557 | parport_release(db9->pd); |
557 | } | 558 | } |
558 | up(&db9->sem); | 559 | mutex_unlock(&db9->mutex); |
559 | } | 560 | } |
560 | 561 | ||
561 | static struct db9 __init *db9_probe(int parport, int mode) | 562 | static struct db9 __init *db9_probe(int parport, int mode) |
@@ -603,7 +604,7 @@ static struct db9 __init *db9_probe(int parport, int mode) | |||
603 | goto err_unreg_pardev; | 604 | goto err_unreg_pardev; |
604 | } | 605 | } |
605 | 606 | ||
606 | init_MUTEX(&db9->sem); | 607 | mutex_init(&db9->mutex); |
607 | db9->pd = pd; | 608 | db9->pd = pd; |
608 | db9->mode = mode; | 609 | db9->mode = mode; |
609 | init_timer(&db9->timer); | 610 | init_timer(&db9->timer); |
diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c index 900587acdb47..aa3ef89d8188 100644 --- a/drivers/input/joystick/gamecon.c +++ b/drivers/input/joystick/gamecon.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/parport.h> | 37 | #include <linux/parport.h> |
38 | #include <linux/input.h> | 38 | #include <linux/input.h> |
39 | #include <linux/mutex.h> | ||
39 | 40 | ||
40 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); | 41 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); |
41 | MODULE_DESCRIPTION("NES, SNES, N64, MultiSystem, PSX gamepad driver"); | 42 | MODULE_DESCRIPTION("NES, SNES, N64, MultiSystem, PSX gamepad driver"); |
@@ -83,7 +84,7 @@ struct gc { | |||
83 | struct timer_list timer; | 84 | struct timer_list timer; |
84 | unsigned char pads[GC_MAX + 1]; | 85 | unsigned char pads[GC_MAX + 1]; |
85 | int used; | 86 | int used; |
86 | struct semaphore sem; | 87 | struct mutex mutex; |
87 | char phys[GC_MAX_DEVICES][32]; | 88 | char phys[GC_MAX_DEVICES][32]; |
88 | }; | 89 | }; |
89 | 90 | ||
@@ -552,7 +553,7 @@ static int gc_open(struct input_dev *dev) | |||
552 | struct gc *gc = dev->private; | 553 | struct gc *gc = dev->private; |
553 | int err; | 554 | int err; |
554 | 555 | ||
555 | err = down_interruptible(&gc->sem); | 556 | err = mutex_lock_interruptible(&gc->mutex); |
556 | if (err) | 557 | if (err) |
557 | return err; | 558 | return err; |
558 | 559 | ||
@@ -562,7 +563,7 @@ static int gc_open(struct input_dev *dev) | |||
562 | mod_timer(&gc->timer, jiffies + GC_REFRESH_TIME); | 563 | mod_timer(&gc->timer, jiffies + GC_REFRESH_TIME); |
563 | } | 564 | } |
564 | 565 | ||
565 | up(&gc->sem); | 566 | mutex_unlock(&gc->mutex); |
566 | return 0; | 567 | return 0; |
567 | } | 568 | } |
568 | 569 | ||
@@ -570,13 +571,13 @@ static void gc_close(struct input_dev *dev) | |||
570 | { | 571 | { |
571 | struct gc *gc = dev->private; | 572 | struct gc *gc = dev->private; |
572 | 573 | ||
573 | down(&gc->sem); | 574 | mutex_lock(&gc->mutex); |
574 | if (!--gc->used) { | 575 | if (!--gc->used) { |
575 | del_timer_sync(&gc->timer); | 576 | del_timer_sync(&gc->timer); |
576 | parport_write_control(gc->pd->port, 0x00); | 577 | parport_write_control(gc->pd->port, 0x00); |
577 | parport_release(gc->pd); | 578 | parport_release(gc->pd); |
578 | } | 579 | } |
579 | up(&gc->sem); | 580 | mutex_unlock(&gc->mutex); |
580 | } | 581 | } |
581 | 582 | ||
582 | static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type) | 583 | static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type) |
@@ -693,7 +694,7 @@ static struct gc __init *gc_probe(int parport, int *pads, int n_pads) | |||
693 | goto err_unreg_pardev; | 694 | goto err_unreg_pardev; |
694 | } | 695 | } |
695 | 696 | ||
696 | init_MUTEX(&gc->sem); | 697 | mutex_init(&gc->mutex); |
697 | gc->pd = pd; | 698 | gc->pd = pd; |
698 | init_timer(&gc->timer); | 699 | init_timer(&gc->timer); |
699 | gc->timer.data = (long) gc; | 700 | gc->timer.data = (long) gc; |
diff --git a/drivers/input/joystick/iforce/iforce-ff.c b/drivers/input/joystick/iforce/iforce-ff.c index 4678b6dab43b..2b8e8456c9fa 100644 --- a/drivers/input/joystick/iforce/iforce-ff.c +++ b/drivers/input/joystick/iforce/iforce-ff.c | |||
@@ -42,14 +42,14 @@ static int make_magnitude_modifier(struct iforce* iforce, | |||
42 | unsigned char data[3]; | 42 | unsigned char data[3]; |
43 | 43 | ||
44 | if (!no_alloc) { | 44 | if (!no_alloc) { |
45 | down(&iforce->mem_mutex); | 45 | mutex_lock(&iforce->mem_mutex); |
46 | if (allocate_resource(&(iforce->device_memory), mod_chunk, 2, | 46 | if (allocate_resource(&(iforce->device_memory), mod_chunk, 2, |
47 | iforce->device_memory.start, iforce->device_memory.end, 2L, | 47 | iforce->device_memory.start, iforce->device_memory.end, 2L, |
48 | NULL, NULL)) { | 48 | NULL, NULL)) { |
49 | up(&iforce->mem_mutex); | 49 | mutex_unlock(&iforce->mem_mutex); |
50 | return -ENOMEM; | 50 | return -ENOMEM; |
51 | } | 51 | } |
52 | up(&iforce->mem_mutex); | 52 | mutex_unlock(&iforce->mem_mutex); |
53 | } | 53 | } |
54 | 54 | ||
55 | data[0] = LO(mod_chunk->start); | 55 | data[0] = LO(mod_chunk->start); |
@@ -75,14 +75,14 @@ static int make_period_modifier(struct iforce* iforce, | |||
75 | period = TIME_SCALE(period); | 75 | period = TIME_SCALE(period); |
76 | 76 | ||
77 | if (!no_alloc) { | 77 | if (!no_alloc) { |
78 | down(&iforce->mem_mutex); | 78 | mutex_lock(&iforce->mem_mutex); |
79 | if (allocate_resource(&(iforce->device_memory), mod_chunk, 0x0c, | 79 | if (allocate_resource(&(iforce->device_memory), mod_chunk, 0x0c, |
80 | iforce->device_memory.start, iforce->device_memory.end, 2L, | 80 | iforce->device_memory.start, iforce->device_memory.end, 2L, |
81 | NULL, NULL)) { | 81 | NULL, NULL)) { |
82 | up(&iforce->mem_mutex); | 82 | mutex_unlock(&iforce->mem_mutex); |
83 | return -ENOMEM; | 83 | return -ENOMEM; |
84 | } | 84 | } |
85 | up(&iforce->mem_mutex); | 85 | mutex_unlock(&iforce->mem_mutex); |
86 | } | 86 | } |
87 | 87 | ||
88 | data[0] = LO(mod_chunk->start); | 88 | data[0] = LO(mod_chunk->start); |
@@ -115,14 +115,14 @@ static int make_envelope_modifier(struct iforce* iforce, | |||
115 | fade_duration = TIME_SCALE(fade_duration); | 115 | fade_duration = TIME_SCALE(fade_duration); |
116 | 116 | ||
117 | if (!no_alloc) { | 117 | if (!no_alloc) { |
118 | down(&iforce->mem_mutex); | 118 | mutex_lock(&iforce->mem_mutex); |
119 | if (allocate_resource(&(iforce->device_memory), mod_chunk, 0x0e, | 119 | if (allocate_resource(&(iforce->device_memory), mod_chunk, 0x0e, |
120 | iforce->device_memory.start, iforce->device_memory.end, 2L, | 120 | iforce->device_memory.start, iforce->device_memory.end, 2L, |
121 | NULL, NULL)) { | 121 | NULL, NULL)) { |
122 | up(&iforce->mem_mutex); | 122 | mutex_unlock(&iforce->mem_mutex); |
123 | return -ENOMEM; | 123 | return -ENOMEM; |
124 | } | 124 | } |
125 | up(&iforce->mem_mutex); | 125 | mutex_unlock(&iforce->mem_mutex); |
126 | } | 126 | } |
127 | 127 | ||
128 | data[0] = LO(mod_chunk->start); | 128 | data[0] = LO(mod_chunk->start); |
@@ -152,14 +152,14 @@ static int make_condition_modifier(struct iforce* iforce, | |||
152 | unsigned char data[10]; | 152 | unsigned char data[10]; |
153 | 153 | ||
154 | if (!no_alloc) { | 154 | if (!no_alloc) { |
155 | down(&iforce->mem_mutex); | 155 | mutex_lock(&iforce->mem_mutex); |
156 | if (allocate_resource(&(iforce->device_memory), mod_chunk, 8, | 156 | if (allocate_resource(&(iforce->device_memory), mod_chunk, 8, |
157 | iforce->device_memory.start, iforce->device_memory.end, 2L, | 157 | iforce->device_memory.start, iforce->device_memory.end, 2L, |
158 | NULL, NULL)) { | 158 | NULL, NULL)) { |
159 | up(&iforce->mem_mutex); | 159 | mutex_unlock(&iforce->mem_mutex); |
160 | return -ENOMEM; | 160 | return -ENOMEM; |
161 | } | 161 | } |
162 | up(&iforce->mem_mutex); | 162 | mutex_unlock(&iforce->mem_mutex); |
163 | } | 163 | } |
164 | 164 | ||
165 | data[0] = LO(mod_chunk->start); | 165 | data[0] = LO(mod_chunk->start); |
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c index b6bc04998047..ab0a26b924ca 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c | |||
@@ -350,7 +350,7 @@ int iforce_init_device(struct iforce *iforce) | |||
350 | 350 | ||
351 | init_waitqueue_head(&iforce->wait); | 351 | init_waitqueue_head(&iforce->wait); |
352 | spin_lock_init(&iforce->xmit_lock); | 352 | spin_lock_init(&iforce->xmit_lock); |
353 | init_MUTEX(&iforce->mem_mutex); | 353 | mutex_init(&iforce->mem_mutex); |
354 | iforce->xmit.buf = iforce->xmit_data; | 354 | iforce->xmit.buf = iforce->xmit_data; |
355 | iforce->dev = input_dev; | 355 | iforce->dev = input_dev; |
356 | 356 | ||
diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h index 146f406b8f8a..668f24535ba0 100644 --- a/drivers/input/joystick/iforce/iforce.h +++ b/drivers/input/joystick/iforce/iforce.h | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/serio.h> | 37 | #include <linux/serio.h> |
38 | #include <linux/config.h> | 38 | #include <linux/config.h> |
39 | #include <linux/circ_buf.h> | 39 | #include <linux/circ_buf.h> |
40 | #include <asm/semaphore.h> | 40 | #include <linux/mutex.h> |
41 | 41 | ||
42 | /* This module provides arbitrary resource management routines. | 42 | /* This module provides arbitrary resource management routines. |
43 | * I use it to manage the device's memory. | 43 | * I use it to manage the device's memory. |
@@ -45,6 +45,7 @@ | |||
45 | */ | 45 | */ |
46 | #include <linux/ioport.h> | 46 | #include <linux/ioport.h> |
47 | 47 | ||
48 | |||
48 | #define IFORCE_MAX_LENGTH 16 | 49 | #define IFORCE_MAX_LENGTH 16 |
49 | 50 | ||
50 | /* iforce::bus */ | 51 | /* iforce::bus */ |
@@ -146,7 +147,7 @@ struct iforce { | |||
146 | wait_queue_head_t wait; | 147 | wait_queue_head_t wait; |
147 | struct resource device_memory; | 148 | struct resource device_memory; |
148 | struct iforce_core_effect core_effects[FF_EFFECTS_MAX]; | 149 | struct iforce_core_effect core_effects[FF_EFFECTS_MAX]; |
149 | struct semaphore mem_mutex; | 150 | struct mutex mem_mutex; |
150 | }; | 151 | }; |
151 | 152 | ||
152 | /* Get hi and low bytes of a 16-bits int */ | 153 | /* Get hi and low bytes of a 16-bits int */ |
diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c index b154938e88a4..5570fd5487c7 100644 --- a/drivers/input/joystick/turbografx.c +++ b/drivers/input/joystick/turbografx.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/module.h> | 37 | #include <linux/module.h> |
38 | #include <linux/moduleparam.h> | 38 | #include <linux/moduleparam.h> |
39 | #include <linux/init.h> | 39 | #include <linux/init.h> |
40 | #include <linux/mutex.h> | ||
40 | 41 | ||
41 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); | 42 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); |
42 | MODULE_DESCRIPTION("TurboGraFX parallel port interface driver"); | 43 | MODULE_DESCRIPTION("TurboGraFX parallel port interface driver"); |
@@ -86,7 +87,7 @@ static struct tgfx { | |||
86 | char phys[TGFX_MAX_DEVICES][32]; | 87 | char phys[TGFX_MAX_DEVICES][32]; |
87 | int sticks; | 88 | int sticks; |
88 | int used; | 89 | int used; |
89 | struct semaphore sem; | 90 | struct mutex sem; |
90 | } *tgfx_base[TGFX_MAX_PORTS]; | 91 | } *tgfx_base[TGFX_MAX_PORTS]; |
91 | 92 | ||
92 | /* | 93 | /* |
@@ -128,7 +129,7 @@ static int tgfx_open(struct input_dev *dev) | |||
128 | struct tgfx *tgfx = dev->private; | 129 | struct tgfx *tgfx = dev->private; |
129 | int err; | 130 | int err; |
130 | 131 | ||
131 | err = down_interruptible(&tgfx->sem); | 132 | err = mutex_lock_interruptible(&tgfx->sem); |
132 | if (err) | 133 | if (err) |
133 | return err; | 134 | return err; |
134 | 135 | ||
@@ -138,7 +139,7 @@ static int tgfx_open(struct input_dev *dev) | |||
138 | mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME); | 139 | mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME); |
139 | } | 140 | } |
140 | 141 | ||
141 | up(&tgfx->sem); | 142 | mutex_unlock(&tgfx->sem); |
142 | return 0; | 143 | return 0; |
143 | } | 144 | } |
144 | 145 | ||
@@ -146,13 +147,13 @@ static void tgfx_close(struct input_dev *dev) | |||
146 | { | 147 | { |
147 | struct tgfx *tgfx = dev->private; | 148 | struct tgfx *tgfx = dev->private; |
148 | 149 | ||
149 | down(&tgfx->sem); | 150 | mutex_lock(&tgfx->sem); |
150 | if (!--tgfx->used) { | 151 | if (!--tgfx->used) { |
151 | del_timer_sync(&tgfx->timer); | 152 | del_timer_sync(&tgfx->timer); |
152 | parport_write_control(tgfx->pd->port, 0x00); | 153 | parport_write_control(tgfx->pd->port, 0x00); |
153 | parport_release(tgfx->pd); | 154 | parport_release(tgfx->pd); |
154 | } | 155 | } |
155 | up(&tgfx->sem); | 156 | mutex_unlock(&tgfx->sem); |
156 | } | 157 | } |
157 | 158 | ||
158 | 159 | ||
@@ -191,7 +192,7 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs) | |||
191 | goto err_unreg_pardev; | 192 | goto err_unreg_pardev; |
192 | } | 193 | } |
193 | 194 | ||
194 | init_MUTEX(&tgfx->sem); | 195 | mutex_init(&tgfx->sem); |
195 | tgfx->pd = pd; | 196 | tgfx->pd = pd; |
196 | init_timer(&tgfx->timer); | 197 | init_timer(&tgfx->timer); |
197 | tgfx->timer.data = (long) tgfx; | 198 | tgfx->timer.data = (long) tgfx; |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index ffacf6eca5f5..b45981870c7a 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/serio.h> | 27 | #include <linux/serio.h> |
28 | #include <linux/workqueue.h> | 28 | #include <linux/workqueue.h> |
29 | #include <linux/libps2.h> | 29 | #include <linux/libps2.h> |
30 | #include <linux/mutex.h> | ||
30 | 31 | ||
31 | #define DRIVER_DESC "AT and PS/2 keyboard driver" | 32 | #define DRIVER_DESC "AT and PS/2 keyboard driver" |
32 | 33 | ||
@@ -216,7 +217,7 @@ struct atkbd { | |||
216 | unsigned long time; | 217 | unsigned long time; |
217 | 218 | ||
218 | struct work_struct event_work; | 219 | struct work_struct event_work; |
219 | struct semaphore event_sem; | 220 | struct mutex event_mutex; |
220 | unsigned long event_mask; | 221 | unsigned long event_mask; |
221 | }; | 222 | }; |
222 | 223 | ||
@@ -449,7 +450,7 @@ static void atkbd_event_work(void *data) | |||
449 | unsigned char param[2]; | 450 | unsigned char param[2]; |
450 | int i, j; | 451 | int i, j; |
451 | 452 | ||
452 | down(&atkbd->event_sem); | 453 | mutex_lock(&atkbd->event_mutex); |
453 | 454 | ||
454 | if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask)) { | 455 | if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask)) { |
455 | param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) | 456 | param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) |
@@ -480,7 +481,7 @@ static void atkbd_event_work(void *data) | |||
480 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETREP); | 481 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETREP); |
481 | } | 482 | } |
482 | 483 | ||
483 | up(&atkbd->event_sem); | 484 | mutex_unlock(&atkbd->event_mutex); |
484 | } | 485 | } |
485 | 486 | ||
486 | /* | 487 | /* |
@@ -846,7 +847,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv) | |||
846 | atkbd->dev = dev; | 847 | atkbd->dev = dev; |
847 | ps2_init(&atkbd->ps2dev, serio); | 848 | ps2_init(&atkbd->ps2dev, serio); |
848 | INIT_WORK(&atkbd->event_work, atkbd_event_work, atkbd); | 849 | INIT_WORK(&atkbd->event_work, atkbd_event_work, atkbd); |
849 | init_MUTEX(&atkbd->event_sem); | 850 | mutex_init(&atkbd->event_mutex); |
850 | 851 | ||
851 | switch (serio->id.type) { | 852 | switch (serio->id.type) { |
852 | 853 | ||
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 546ed9b4901d..d723e9ad7c41 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c | |||
@@ -194,7 +194,7 @@ static int uinput_open(struct inode *inode, struct file *file) | |||
194 | if (!newdev) | 194 | if (!newdev) |
195 | return -ENOMEM; | 195 | return -ENOMEM; |
196 | 196 | ||
197 | init_MUTEX(&newdev->sem); | 197 | mutex_init(&newdev->mutex); |
198 | spin_lock_init(&newdev->requests_lock); | 198 | spin_lock_init(&newdev->requests_lock); |
199 | init_waitqueue_head(&newdev->requests_waitq); | 199 | init_waitqueue_head(&newdev->requests_waitq); |
200 | init_waitqueue_head(&newdev->waitq); | 200 | init_waitqueue_head(&newdev->waitq); |
@@ -340,7 +340,7 @@ static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t | |||
340 | struct uinput_device *udev = file->private_data; | 340 | struct uinput_device *udev = file->private_data; |
341 | int retval; | 341 | int retval; |
342 | 342 | ||
343 | retval = down_interruptible(&udev->sem); | 343 | retval = mutex_lock_interruptible(&udev->mutex); |
344 | if (retval) | 344 | if (retval) |
345 | return retval; | 345 | return retval; |
346 | 346 | ||
@@ -348,7 +348,7 @@ static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t | |||
348 | uinput_inject_event(udev, buffer, count) : | 348 | uinput_inject_event(udev, buffer, count) : |
349 | uinput_setup_device(udev, buffer, count); | 349 | uinput_setup_device(udev, buffer, count); |
350 | 350 | ||
351 | up(&udev->sem); | 351 | mutex_unlock(&udev->mutex); |
352 | 352 | ||
353 | return retval; | 353 | return retval; |
354 | } | 354 | } |
@@ -369,7 +369,7 @@ static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, | |||
369 | if (retval) | 369 | if (retval) |
370 | return retval; | 370 | return retval; |
371 | 371 | ||
372 | retval = down_interruptible(&udev->sem); | 372 | retval = mutex_lock_interruptible(&udev->mutex); |
373 | if (retval) | 373 | if (retval) |
374 | return retval; | 374 | return retval; |
375 | 375 | ||
@@ -388,7 +388,7 @@ static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, | |||
388 | } | 388 | } |
389 | 389 | ||
390 | out: | 390 | out: |
391 | up(&udev->sem); | 391 | mutex_unlock(&udev->mutex); |
392 | 392 | ||
393 | return retval; | 393 | return retval; |
394 | } | 394 | } |
@@ -439,7 +439,7 @@ static long uinput_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
439 | 439 | ||
440 | udev = file->private_data; | 440 | udev = file->private_data; |
441 | 441 | ||
442 | retval = down_interruptible(&udev->sem); | 442 | retval = mutex_lock_interruptible(&udev->mutex); |
443 | if (retval) | 443 | if (retval) |
444 | return retval; | 444 | return retval; |
445 | 445 | ||
@@ -589,7 +589,7 @@ static long uinput_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
589 | } | 589 | } |
590 | 590 | ||
591 | out: | 591 | out: |
592 | up(&udev->sem); | 592 | mutex_unlock(&udev->mutex); |
593 | return retval; | 593 | return retval; |
594 | } | 594 | } |
595 | 595 | ||
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index ad6217467676..32d70ed8f41d 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -20,6 +20,8 @@ | |||
20 | #include <linux/serio.h> | 20 | #include <linux/serio.h> |
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/libps2.h> | 22 | #include <linux/libps2.h> |
23 | #include <linux/mutex.h> | ||
24 | |||
23 | #include "psmouse.h" | 25 | #include "psmouse.h" |
24 | #include "synaptics.h" | 26 | #include "synaptics.h" |
25 | #include "logips2pp.h" | 27 | #include "logips2pp.h" |
@@ -98,13 +100,13 @@ __obsolete_setup("psmouse_resetafter="); | |||
98 | __obsolete_setup("psmouse_rate="); | 100 | __obsolete_setup("psmouse_rate="); |
99 | 101 | ||
100 | /* | 102 | /* |
101 | * psmouse_sem protects all operations changing state of mouse | 103 | * psmouse_mutex protects all operations changing state of mouse |
102 | * (connecting, disconnecting, changing rate or resolution via | 104 | * (connecting, disconnecting, changing rate or resolution via |
103 | * sysfs). We could use a per-device semaphore but since there | 105 | * sysfs). We could use a per-device semaphore but since there |
104 | * rarely more than one PS/2 mouse connected and since semaphore | 106 | * rarely more than one PS/2 mouse connected and since semaphore |
105 | * is taken in "slow" paths it is not worth it. | 107 | * is taken in "slow" paths it is not worth it. |
106 | */ | 108 | */ |
107 | static DECLARE_MUTEX(psmouse_sem); | 109 | static DEFINE_MUTEX(psmouse_mutex); |
108 | 110 | ||
109 | static struct workqueue_struct *kpsmoused_wq; | 111 | static struct workqueue_struct *kpsmoused_wq; |
110 | 112 | ||
@@ -868,7 +870,7 @@ static void psmouse_resync(void *p) | |||
868 | int failed = 0, enabled = 0; | 870 | int failed = 0, enabled = 0; |
869 | int i; | 871 | int i; |
870 | 872 | ||
871 | down(&psmouse_sem); | 873 | mutex_lock(&psmouse_mutex); |
872 | 874 | ||
873 | if (psmouse->state != PSMOUSE_RESYNCING) | 875 | if (psmouse->state != PSMOUSE_RESYNCING) |
874 | goto out; | 876 | goto out; |
@@ -948,7 +950,7 @@ static void psmouse_resync(void *p) | |||
948 | if (parent) | 950 | if (parent) |
949 | psmouse_activate(parent); | 951 | psmouse_activate(parent); |
950 | out: | 952 | out: |
951 | up(&psmouse_sem); | 953 | mutex_unlock(&psmouse_mutex); |
952 | } | 954 | } |
953 | 955 | ||
954 | /* | 956 | /* |
@@ -974,14 +976,14 @@ static void psmouse_disconnect(struct serio *serio) | |||
974 | 976 | ||
975 | sysfs_remove_group(&serio->dev.kobj, &psmouse_attribute_group); | 977 | sysfs_remove_group(&serio->dev.kobj, &psmouse_attribute_group); |
976 | 978 | ||
977 | down(&psmouse_sem); | 979 | mutex_lock(&psmouse_mutex); |
978 | 980 | ||
979 | psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); | 981 | psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); |
980 | 982 | ||
981 | /* make sure we don't have a resync in progress */ | 983 | /* make sure we don't have a resync in progress */ |
982 | up(&psmouse_sem); | 984 | mutex_unlock(&psmouse_mutex); |
983 | flush_workqueue(kpsmoused_wq); | 985 | flush_workqueue(kpsmoused_wq); |
984 | down(&psmouse_sem); | 986 | mutex_lock(&psmouse_mutex); |
985 | 987 | ||
986 | if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) { | 988 | if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) { |
987 | parent = serio_get_drvdata(serio->parent); | 989 | parent = serio_get_drvdata(serio->parent); |
@@ -1004,7 +1006,7 @@ static void psmouse_disconnect(struct serio *serio) | |||
1004 | if (parent) | 1006 | if (parent) |
1005 | psmouse_activate(parent); | 1007 | psmouse_activate(parent); |
1006 | 1008 | ||
1007 | up(&psmouse_sem); | 1009 | mutex_unlock(&psmouse_mutex); |
1008 | } | 1010 | } |
1009 | 1011 | ||
1010 | static int psmouse_switch_protocol(struct psmouse *psmouse, struct psmouse_protocol *proto) | 1012 | static int psmouse_switch_protocol(struct psmouse *psmouse, struct psmouse_protocol *proto) |
@@ -1076,7 +1078,7 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv) | |||
1076 | struct input_dev *input_dev; | 1078 | struct input_dev *input_dev; |
1077 | int retval = -ENOMEM; | 1079 | int retval = -ENOMEM; |
1078 | 1080 | ||
1079 | down(&psmouse_sem); | 1081 | mutex_lock(&psmouse_mutex); |
1080 | 1082 | ||
1081 | /* | 1083 | /* |
1082 | * If this is a pass-through port deactivate parent so the device | 1084 | * If this is a pass-through port deactivate parent so the device |
@@ -1144,7 +1146,7 @@ out: | |||
1144 | if (parent) | 1146 | if (parent) |
1145 | psmouse_activate(parent); | 1147 | psmouse_activate(parent); |
1146 | 1148 | ||
1147 | up(&psmouse_sem); | 1149 | mutex_unlock(&psmouse_mutex); |
1148 | return retval; | 1150 | return retval; |
1149 | } | 1151 | } |
1150 | 1152 | ||
@@ -1161,7 +1163,7 @@ static int psmouse_reconnect(struct serio *serio) | |||
1161 | return -1; | 1163 | return -1; |
1162 | } | 1164 | } |
1163 | 1165 | ||
1164 | down(&psmouse_sem); | 1166 | mutex_lock(&psmouse_mutex); |
1165 | 1167 | ||
1166 | if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) { | 1168 | if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) { |
1167 | parent = serio_get_drvdata(serio->parent); | 1169 | parent = serio_get_drvdata(serio->parent); |
@@ -1195,7 +1197,7 @@ out: | |||
1195 | if (parent) | 1197 | if (parent) |
1196 | psmouse_activate(parent); | 1198 | psmouse_activate(parent); |
1197 | 1199 | ||
1198 | up(&psmouse_sem); | 1200 | mutex_unlock(&psmouse_mutex); |
1199 | return rc; | 1201 | return rc; |
1200 | } | 1202 | } |
1201 | 1203 | ||
@@ -1273,7 +1275,7 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev | |||
1273 | goto out_unpin; | 1275 | goto out_unpin; |
1274 | } | 1276 | } |
1275 | 1277 | ||
1276 | retval = down_interruptible(&psmouse_sem); | 1278 | retval = mutex_lock_interruptible(&psmouse_mutex); |
1277 | if (retval) | 1279 | if (retval) |
1278 | goto out_unpin; | 1280 | goto out_unpin; |
1279 | 1281 | ||
@@ -1281,7 +1283,7 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev | |||
1281 | 1283 | ||
1282 | if (psmouse->state == PSMOUSE_IGNORE) { | 1284 | if (psmouse->state == PSMOUSE_IGNORE) { |
1283 | retval = -ENODEV; | 1285 | retval = -ENODEV; |
1284 | goto out_up; | 1286 | goto out_unlock; |
1285 | } | 1287 | } |
1286 | 1288 | ||
1287 | if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) { | 1289 | if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) { |
@@ -1299,8 +1301,8 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev | |||
1299 | if (parent) | 1301 | if (parent) |
1300 | psmouse_activate(parent); | 1302 | psmouse_activate(parent); |
1301 | 1303 | ||
1302 | out_up: | 1304 | out_unlock: |
1303 | up(&psmouse_sem); | 1305 | mutex_unlock(&psmouse_mutex); |
1304 | out_unpin: | 1306 | out_unpin: |
1305 | serio_unpin_driver(serio); | 1307 | serio_unpin_driver(serio); |
1306 | return retval; | 1308 | return retval; |
@@ -1357,11 +1359,11 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co | |||
1357 | return -EIO; | 1359 | return -EIO; |
1358 | } | 1360 | } |
1359 | 1361 | ||
1360 | up(&psmouse_sem); | 1362 | mutex_unlock(&psmouse_mutex); |
1361 | serio_unpin_driver(serio); | 1363 | serio_unpin_driver(serio); |
1362 | serio_unregister_child_port(serio); | 1364 | serio_unregister_child_port(serio); |
1363 | serio_pin_driver_uninterruptible(serio); | 1365 | serio_pin_driver_uninterruptible(serio); |
1364 | down(&psmouse_sem); | 1366 | mutex_lock(&psmouse_mutex); |
1365 | 1367 | ||
1366 | if (serio->drv != &psmouse_drv) { | 1368 | if (serio->drv != &psmouse_drv) { |
1367 | input_free_device(new_dev); | 1369 | input_free_device(new_dev); |
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c index d4c990f7c85e..79c97f94bcbd 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 2f76813c3a64..966600779b70 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) |
@@ -923,5 +924,5 @@ static void __exit serio_exit(void) | |||
923 | kthread_stop(serio_task); | 924 | kthread_stop(serio_task); |
924 | } | 925 | } |
925 | 926 | ||
926 | module_init(serio_init); | 927 | subsys_initcall(serio_init); |
927 | module_exit(serio_exit); | 928 | module_exit(serio_exit); |
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c index 47e08de18d07..8734e7f75b7d 100644 --- a/drivers/input/serio/serio_raw.c +++ b/drivers/input/serio/serio_raw.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/devfs_fs_kernel.h> | 19 | #include <linux/devfs_fs_kernel.h> |
20 | #include <linux/miscdevice.h> | 20 | #include <linux/miscdevice.h> |
21 | #include <linux/wait.h> | 21 | #include <linux/wait.h> |
22 | #include <linux/mutex.h> | ||
22 | 23 | ||
23 | #define DRIVER_DESC "Raw serio driver" | 24 | #define DRIVER_DESC "Raw serio driver" |
24 | 25 | ||
@@ -46,7 +47,7 @@ struct serio_raw_list { | |||
46 | struct list_head node; | 47 | struct list_head node; |
47 | }; | 48 | }; |
48 | 49 | ||
49 | static DECLARE_MUTEX(serio_raw_sem); | 50 | static DEFINE_MUTEX(serio_raw_mutex); |
50 | static LIST_HEAD(serio_raw_list); | 51 | static LIST_HEAD(serio_raw_list); |
51 | static unsigned int serio_raw_no; | 52 | static unsigned int serio_raw_no; |
52 | 53 | ||
@@ -81,7 +82,7 @@ static int serio_raw_open(struct inode *inode, struct file *file) | |||
81 | struct serio_raw_list *list; | 82 | struct serio_raw_list *list; |
82 | int retval = 0; | 83 | int retval = 0; |
83 | 84 | ||
84 | retval = down_interruptible(&serio_raw_sem); | 85 | retval = mutex_lock_interruptible(&serio_raw_mutex); |
85 | if (retval) | 86 | if (retval) |
86 | return retval; | 87 | return retval; |
87 | 88 | ||
@@ -108,7 +109,7 @@ static int serio_raw_open(struct inode *inode, struct file *file) | |||
108 | list_add_tail(&list->node, &serio_raw->list); | 109 | list_add_tail(&list->node, &serio_raw->list); |
109 | 110 | ||
110 | out: | 111 | out: |
111 | up(&serio_raw_sem); | 112 | mutex_unlock(&serio_raw_mutex); |
112 | return retval; | 113 | return retval; |
113 | } | 114 | } |
114 | 115 | ||
@@ -130,12 +131,12 @@ static int serio_raw_release(struct inode *inode, struct file *file) | |||
130 | struct serio_raw_list *list = file->private_data; | 131 | struct serio_raw_list *list = file->private_data; |
131 | struct serio_raw *serio_raw = list->serio_raw; | 132 | struct serio_raw *serio_raw = list->serio_raw; |
132 | 133 | ||
133 | down(&serio_raw_sem); | 134 | mutex_lock(&serio_raw_mutex); |
134 | 135 | ||
135 | serio_raw_fasync(-1, file, 0); | 136 | serio_raw_fasync(-1, file, 0); |
136 | serio_raw_cleanup(serio_raw); | 137 | serio_raw_cleanup(serio_raw); |
137 | 138 | ||
138 | up(&serio_raw_sem); | 139 | mutex_unlock(&serio_raw_mutex); |
139 | return 0; | 140 | return 0; |
140 | } | 141 | } |
141 | 142 | ||
@@ -194,7 +195,7 @@ static ssize_t serio_raw_write(struct file *file, const char __user *buffer, siz | |||
194 | int retval; | 195 | int retval; |
195 | unsigned char c; | 196 | unsigned char c; |
196 | 197 | ||
197 | retval = down_interruptible(&serio_raw_sem); | 198 | retval = mutex_lock_interruptible(&serio_raw_mutex); |
198 | if (retval) | 199 | if (retval) |
199 | return retval; | 200 | return retval; |
200 | 201 | ||
@@ -219,7 +220,7 @@ static ssize_t serio_raw_write(struct file *file, const char __user *buffer, siz | |||
219 | }; | 220 | }; |
220 | 221 | ||
221 | out: | 222 | out: |
222 | up(&serio_raw_sem); | 223 | mutex_unlock(&serio_raw_mutex); |
223 | return written; | 224 | return written; |
224 | } | 225 | } |
225 | 226 | ||
@@ -280,7 +281,7 @@ static int serio_raw_connect(struct serio *serio, struct serio_driver *drv) | |||
280 | return -ENOMEM; | 281 | return -ENOMEM; |
281 | } | 282 | } |
282 | 283 | ||
283 | down(&serio_raw_sem); | 284 | mutex_lock(&serio_raw_mutex); |
284 | 285 | ||
285 | memset(serio_raw, 0, sizeof(struct serio_raw)); | 286 | memset(serio_raw, 0, sizeof(struct serio_raw)); |
286 | snprintf(serio_raw->name, sizeof(serio_raw->name), "serio_raw%d", serio_raw_no++); | 287 | snprintf(serio_raw->name, sizeof(serio_raw->name), "serio_raw%d", serio_raw_no++); |
@@ -325,7 +326,7 @@ out_free: | |||
325 | serio_set_drvdata(serio, NULL); | 326 | serio_set_drvdata(serio, NULL); |
326 | kfree(serio_raw); | 327 | kfree(serio_raw); |
327 | out: | 328 | out: |
328 | up(&serio_raw_sem); | 329 | mutex_unlock(&serio_raw_mutex); |
329 | return err; | 330 | return err; |
330 | } | 331 | } |
331 | 332 | ||
@@ -350,7 +351,7 @@ static void serio_raw_disconnect(struct serio *serio) | |||
350 | { | 351 | { |
351 | struct serio_raw *serio_raw; | 352 | struct serio_raw *serio_raw; |
352 | 353 | ||
353 | down(&serio_raw_sem); | 354 | mutex_lock(&serio_raw_mutex); |
354 | 355 | ||
355 | serio_raw = serio_get_drvdata(serio); | 356 | serio_raw = serio_get_drvdata(serio); |
356 | 357 | ||
@@ -361,7 +362,7 @@ static void serio_raw_disconnect(struct serio *serio) | |||
361 | if (!serio_raw_cleanup(serio_raw)) | 362 | if (!serio_raw_cleanup(serio_raw)) |
362 | wake_up_interruptible(&serio_raw->wait); | 363 | wake_up_interruptible(&serio_raw->wait); |
363 | 364 | ||
364 | up(&serio_raw_sem); | 365 | mutex_unlock(&serio_raw_mutex); |
365 | } | 366 | } |
366 | 367 | ||
367 | static struct serio_device_id serio_raw_serio_ids[] = { | 368 | static struct serio_device_id serio_raw_serio_ids[] = { |