diff options
Diffstat (limited to 'drivers/input/joystick/gamecon.c')
-rw-r--r-- | drivers/input/joystick/gamecon.c | 13 |
1 files changed, 7 insertions, 6 deletions
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; |