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