summaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/adb.c
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2008-05-16 14:19:56 -0600
committerJonathan Corbet <corbet@lwn.net>2008-06-20 14:05:52 -0600
commit26ce4f0684ef4b96d0244ac58b89ec282d5b980c (patch)
treeb8610c3ffa6d4d5ceb97d1214907da5f56bb6f2b /drivers/macintosh/adb.c
parent3462032d66703ef7721329b44fe2dac4aaef475d (diff)
downloadtalos-obmc-linux-26ce4f0684ef4b96d0244ac58b89ec282d5b980c.tar.gz
talos-obmc-linux-26ce4f0684ef4b96d0244ac58b89ec282d5b980c.zip
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/adb.c')
-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 dbaad39020a1..40c70ba62bf0 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -644,12 +644,18 @@ do_adb_query(struct adb_request *req)
static int adb_open(struct inode *inode, struct file *file)
{
struct adbdev_state *state;
+ int ret = 0;
- if (iminor(inode) > 0 || adb_controller == NULL)
- return -ENXIO;
+ lock_kernel();
+ if (iminor(inode) > 0 || adb_controller == NULL) {
+ ret = -ENXIO;
+ goto out;
+ }
state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
- if (state == 0)
- return -ENOMEM;
+ if (state == 0) {
+ ret = -ENOMEM;
+ goto out;
+ }
file->private_data = state;
spin_lock_init(&state->lock);
atomic_set(&state->n_pending, 0);
@@ -657,7 +663,9 @@ static int adb_open(struct inode *inode, struct file *file)
init_waitqueue_head(&state->wait_queue);
state->inuse = 1;
- return 0;
+out:
+ unlock_kernel();
+ return ret;
}
static int adb_release(struct inode *inode, struct file *file)
OpenPOWER on IntegriCloud