diff options
Diffstat (limited to 'drivers')
-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 |
7 files changed, 43 insertions, 38 deletions
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; |