Commit af3ce514ade2fd0e18c5d078d138a6c1137a33df

Authored by Daniel Walker
Committed by Paul Mackerras
1 parent 56783c5e4d

[POWERPC] macintosh: ADB driver: adb_handler_sem semaphore to mutex

Signed-off-by: Daniel Walker <dwalker@mvista.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>

Showing 1 changed file with 15 additions and 15 deletions Side-by-side Diff

drivers/macintosh/adb.c
... ... @@ -37,7 +37,7 @@
37 37 #include <linux/device.h>
38 38 #include <linux/kthread.h>
39 39 #include <linux/platform_device.h>
40   -#include <linux/semaphore.h>
  40 +#include <linux/mutex.h>
41 41  
42 42 #include <asm/uaccess.h>
43 43 #ifdef CONFIG_PPC
... ... @@ -102,7 +102,7 @@
102 102 } adb_handler[16];
103 103  
104 104 /*
105   - * The adb_handler_sem mutex protects all accesses to the original_address
  105 + * The adb_handler_mutex mutex protects all accesses to the original_address
106 106 * and handler_id fields of adb_handler[i] for all i, and changes to the
107 107 * handler field.
108 108 * Accesses to the handler field are protected by the adb_handler_lock
... ... @@ -110,7 +110,7 @@
110 110 * time adb_unregister returns, we know that the old handler isn't being
111 111 * called.
112 112 */
113   -static DECLARE_MUTEX(adb_handler_sem);
  113 +static DEFINE_MUTEX(adb_handler_mutex);
114 114 static DEFINE_RWLOCK(adb_handler_lock);
115 115  
116 116 #if 0
... ... @@ -355,7 +355,7 @@
355 355 msleep(500);
356 356 }
357 357  
358   - down(&adb_handler_sem);
  358 + mutex_lock(&adb_handler_mutex);
359 359 write_lock_irq(&adb_handler_lock);
360 360 memset(adb_handler, 0, sizeof(adb_handler));
361 361 write_unlock_irq(&adb_handler_lock);
... ... @@ -376,7 +376,7 @@
376 376 if (adb_controller->autopoll)
377 377 adb_controller->autopoll(autopoll_devs);
378 378 }
379   - up(&adb_handler_sem);
  379 + mutex_unlock(&adb_handler_mutex);
380 380  
381 381 blocking_notifier_call_chain(&adb_client_list,
382 382 ADB_MSG_POST_RESET, NULL);
... ... @@ -454,7 +454,7 @@
454 454 {
455 455 int i;
456 456  
457   - down(&adb_handler_sem);
  457 + mutex_lock(&adb_handler_mutex);
458 458 ids->nids = 0;
459 459 for (i = 1; i < 16; i++) {
460 460 if ((adb_handler[i].original_address == default_id) &&
... ... @@ -472,7 +472,7 @@
472 472 ids->id[ids->nids++] = i;
473 473 }
474 474 }
475   - up(&adb_handler_sem);
  475 + mutex_unlock(&adb_handler_mutex);
476 476 return ids->nids;
477 477 }
478 478  
... ... @@ -481,7 +481,7 @@
481 481 {
482 482 int ret = -ENODEV;
483 483  
484   - down(&adb_handler_sem);
  484 + mutex_lock(&adb_handler_mutex);
485 485 write_lock_irq(&adb_handler_lock);
486 486 if (adb_handler[index].handler) {
487 487 while(adb_handler[index].busy) {
... ... @@ -493,7 +493,7 @@
493 493 adb_handler[index].handler = NULL;
494 494 }
495 495 write_unlock_irq(&adb_handler_lock);
496   - up(&adb_handler_sem);
  496 + mutex_unlock(&adb_handler_mutex);
497 497 return ret;
498 498 }
499 499  
500 500  
501 501  
502 502  
... ... @@ -557,19 +557,19 @@
557 557 {
558 558 int ret;
559 559  
560   - down(&adb_handler_sem);
  560 + mutex_lock(&adb_handler_mutex);
561 561 ret = try_handler_change(address, new_id);
562   - up(&adb_handler_sem);
  562 + mutex_unlock(&adb_handler_mutex);
563 563 return ret;
564 564 }
565 565  
566 566 int
567 567 adb_get_infos(int address, int *original_address, int *handler_id)
568 568 {
569   - down(&adb_handler_sem);
  569 + mutex_lock(&adb_handler_mutex);
570 570 *original_address = adb_handler[address].original_address;
571 571 *handler_id = adb_handler[address].handler_id;
572   - up(&adb_handler_sem);
  572 + mutex_unlock(&adb_handler_mutex);
573 573  
574 574 return (*original_address != 0);
575 575 }
576 576  
... ... @@ -628,10 +628,10 @@
628 628 case ADB_QUERY_GETDEVINFO:
629 629 if (req->nbytes < 3)
630 630 break;
631   - down(&adb_handler_sem);
  631 + mutex_lock(&adb_handler_mutex);
632 632 req->reply[0] = adb_handler[req->data[2]].original_address;
633 633 req->reply[1] = adb_handler[req->data[2]].handler_id;
634   - up(&adb_handler_sem);
  634 + mutex_unlock(&adb_handler_mutex);
635 635 req->complete = 1;
636 636 req->reply_len = 2;
637 637 adb_write_done(req);