aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2008-05-16 16:19:56 -0400
committerJonathan Corbet <corbet@lwn.net>2008-06-20 16:05:52 -0400
commit26ce4f0684ef4b96d0244ac58b89ec282d5b980c (patch)
treeb8610c3ffa6d4d5ceb97d1214907da5f56bb6f2b /drivers/macintosh
parent3462032d66703ef7721329b44fe2dac4aaef475d (diff)
adb: BKL pushdown
Put explicit lock_kernel() calls in adb_open(). The fact that adb_release() already has them suggests this is necessary. Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/adb.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index dbaad39020a..40c70ba62bf 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -644,12 +644,18 @@ do_adb_query(struct adb_request *req)
644static int adb_open(struct inode *inode, struct file *file) 644static int adb_open(struct inode *inode, struct file *file)
645{ 645{
646 struct adbdev_state *state; 646 struct adbdev_state *state;
647 int ret = 0;
647 648
648 if (iminor(inode) > 0 || adb_controller == NULL) 649 lock_kernel();
649 return -ENXIO; 650 if (iminor(inode) > 0 || adb_controller == NULL) {
651 ret = -ENXIO;
652 goto out;
653 }
650 state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL); 654 state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
651 if (state == 0) 655 if (state == 0) {
652 return -ENOMEM; 656 ret = -ENOMEM;
657 goto out;
658 }
653 file->private_data = state; 659 file->private_data = state;
654 spin_lock_init(&state->lock); 660 spin_lock_init(&state->lock);
655 atomic_set(&state->n_pending, 0); 661 atomic_set(&state->n_pending, 0);
@@ -657,7 +663,9 @@ static int adb_open(struct inode *inode, struct file *file)
657 init_waitqueue_head(&state->wait_queue); 663 init_waitqueue_head(&state->wait_queue);
658 state->inuse = 1; 664 state->inuse = 1;
659 665
660 return 0; 666out:
667 unlock_kernel();
668 return ret;
661} 669}
662 670
663static int adb_release(struct inode *inode, struct file *file) 671static int adb_release(struct inode *inode, struct file *file)