aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/joystick/gamecon.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-02-19 00:22:30 -0500
committerDmitry Torokhov <dtor_core@ameritech.net>2006-02-19 00:22:30 -0500
commit72ba9f0ce09c5508ec4b0cf30e88899872a83f75 (patch)
tree1fe5ab5c6484dedafebda629aeba5e8fc9d66f8d /drivers/input/joystick/gamecon.c
parent33d3f07ae17c0060dc01f26180c94cf0a39efdf1 (diff)
Input: joysticks - semaphore to mutex conversion
The conversion was generated via scripts, and the result was validated automatically via a script as well. Amijoy conversion was done by Arjan van de Ven. 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/joystick/gamecon.c')
-rw-r--r--drivers/input/joystick/gamecon.c13
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
40MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); 41MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
41MODULE_DESCRIPTION("NES, SNES, N64, MultiSystem, PSX gamepad driver"); 42MODULE_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
582static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type) 583static 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;