aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/joystick/turbografx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/joystick/turbografx.c')
-rw-r--r--drivers/input/joystick/turbografx.c13
1 files changed, 7 insertions, 6 deletions
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
41MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); 42MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
42MODULE_DESCRIPTION("TurboGraFX parallel port interface driver"); 43MODULE_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;