diff options
Diffstat (limited to 'drivers/parport/share.c')
-rw-r--r-- | drivers/parport/share.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/parport/share.c b/drivers/parport/share.c index ea62bed6bc83..bbbfd79adbaf 100644 --- a/drivers/parport/share.c +++ b/drivers/parport/share.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/kmod.h> | 32 | #include <linux/kmod.h> |
33 | 33 | ||
34 | #include <linux/spinlock.h> | 34 | #include <linux/spinlock.h> |
35 | #include <linux/mutex.h> | ||
35 | #include <asm/irq.h> | 36 | #include <asm/irq.h> |
36 | 37 | ||
37 | #undef PARPORT_PARANOID | 38 | #undef PARPORT_PARANOID |
@@ -50,7 +51,7 @@ static DEFINE_SPINLOCK(full_list_lock); | |||
50 | 51 | ||
51 | static LIST_HEAD(drivers); | 52 | static LIST_HEAD(drivers); |
52 | 53 | ||
53 | static DECLARE_MUTEX(registration_lock); | 54 | static DEFINE_MUTEX(registration_lock); |
54 | 55 | ||
55 | /* What you can do to a port that's gone away.. */ | 56 | /* What you can do to a port that's gone away.. */ |
56 | static void dead_write_lines (struct parport *p, unsigned char b){} | 57 | static void dead_write_lines (struct parport *p, unsigned char b){} |
@@ -158,11 +159,11 @@ int parport_register_driver (struct parport_driver *drv) | |||
158 | if (list_empty(&portlist)) | 159 | if (list_empty(&portlist)) |
159 | get_lowlevel_driver (); | 160 | get_lowlevel_driver (); |
160 | 161 | ||
161 | down(®istration_lock); | 162 | mutex_lock(®istration_lock); |
162 | list_for_each_entry(port, &portlist, list) | 163 | list_for_each_entry(port, &portlist, list) |
163 | drv->attach(port); | 164 | drv->attach(port); |
164 | list_add(&drv->list, &drivers); | 165 | list_add(&drv->list, &drivers); |
165 | up(®istration_lock); | 166 | mutex_unlock(®istration_lock); |
166 | 167 | ||
167 | return 0; | 168 | return 0; |
168 | } | 169 | } |
@@ -188,11 +189,11 @@ void parport_unregister_driver (struct parport_driver *drv) | |||
188 | { | 189 | { |
189 | struct parport *port; | 190 | struct parport *port; |
190 | 191 | ||
191 | down(®istration_lock); | 192 | mutex_lock(®istration_lock); |
192 | list_del_init(&drv->list); | 193 | list_del_init(&drv->list); |
193 | list_for_each_entry(port, &portlist, list) | 194 | list_for_each_entry(port, &portlist, list) |
194 | drv->detach(port); | 195 | drv->detach(port); |
195 | up(®istration_lock); | 196 | mutex_unlock(®istration_lock); |
196 | } | 197 | } |
197 | 198 | ||
198 | static void free_port (struct parport *port) | 199 | static void free_port (struct parport *port) |
@@ -366,7 +367,7 @@ void parport_announce_port (struct parport *port) | |||
366 | #endif | 367 | #endif |
367 | 368 | ||
368 | parport_proc_register(port); | 369 | parport_proc_register(port); |
369 | down(®istration_lock); | 370 | mutex_lock(®istration_lock); |
370 | spin_lock_irq(&parportlist_lock); | 371 | spin_lock_irq(&parportlist_lock); |
371 | list_add_tail(&port->list, &portlist); | 372 | list_add_tail(&port->list, &portlist); |
372 | for (i = 1; i < 3; i++) { | 373 | for (i = 1; i < 3; i++) { |
@@ -383,7 +384,7 @@ void parport_announce_port (struct parport *port) | |||
383 | if (slave) | 384 | if (slave) |
384 | attach_driver_chain(slave); | 385 | attach_driver_chain(slave); |
385 | } | 386 | } |
386 | up(®istration_lock); | 387 | mutex_unlock(®istration_lock); |
387 | } | 388 | } |
388 | 389 | ||
389 | /** | 390 | /** |
@@ -409,7 +410,7 @@ void parport_remove_port(struct parport *port) | |||
409 | { | 410 | { |
410 | int i; | 411 | int i; |
411 | 412 | ||
412 | down(®istration_lock); | 413 | mutex_lock(®istration_lock); |
413 | 414 | ||
414 | /* Spread the word. */ | 415 | /* Spread the word. */ |
415 | detach_driver_chain (port); | 416 | detach_driver_chain (port); |
@@ -436,7 +437,7 @@ void parport_remove_port(struct parport *port) | |||
436 | } | 437 | } |
437 | spin_unlock(&parportlist_lock); | 438 | spin_unlock(&parportlist_lock); |
438 | 439 | ||
439 | up(®istration_lock); | 440 | mutex_unlock(®istration_lock); |
440 | 441 | ||
441 | parport_proc_unregister(port); | 442 | parport_proc_unregister(port); |
442 | 443 | ||