aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/joystick/db9.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/db9.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/db9.c')
-rw-r--r--drivers/input/joystick/db9.c13
1 files changed, 7 insertions, 6 deletions
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
42MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); 43MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
43MODULE_DESCRIPTION("Atari, Amstrad, Commodore, Amiga, Sega, etc. joystick driver"); 44MODULE_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
561static struct db9 __init *db9_probe(int parport, int mode) 562static 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);