diff options
Diffstat (limited to 'drivers/macintosh/adb.c')
-rw-r--r-- | drivers/macintosh/adb.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index dbaad39020a1..e5d446804d32 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | 48 | ||
49 | EXPORT_SYMBOL(adb_controller); | ||
50 | EXPORT_SYMBOL(adb_client_list); | 49 | EXPORT_SYMBOL(adb_client_list); |
51 | 50 | ||
52 | extern struct adb_driver via_macii_driver; | 51 | extern struct adb_driver via_macii_driver; |
@@ -80,7 +79,7 @@ static struct adb_driver *adb_driver_list[] = { | |||
80 | 79 | ||
81 | static struct class *adb_dev_class; | 80 | static struct class *adb_dev_class; |
82 | 81 | ||
83 | struct adb_driver *adb_controller; | 82 | static struct adb_driver *adb_controller; |
84 | BLOCKING_NOTIFIER_HEAD(adb_client_list); | 83 | BLOCKING_NOTIFIER_HEAD(adb_client_list); |
85 | static int adb_got_sleep; | 84 | static int adb_got_sleep; |
86 | static int adb_inited; | 85 | static int adb_inited; |
@@ -290,7 +289,7 @@ static int adb_resume(struct platform_device *dev) | |||
290 | } | 289 | } |
291 | #endif /* CONFIG_PM */ | 290 | #endif /* CONFIG_PM */ |
292 | 291 | ||
293 | int __init adb_init(void) | 292 | static int __init adb_init(void) |
294 | { | 293 | { |
295 | struct adb_driver *driver; | 294 | struct adb_driver *driver; |
296 | int i; | 295 | int i; |
@@ -644,12 +643,18 @@ do_adb_query(struct adb_request *req) | |||
644 | static int adb_open(struct inode *inode, struct file *file) | 643 | static int adb_open(struct inode *inode, struct file *file) |
645 | { | 644 | { |
646 | struct adbdev_state *state; | 645 | struct adbdev_state *state; |
646 | int ret = 0; | ||
647 | 647 | ||
648 | if (iminor(inode) > 0 || adb_controller == NULL) | 648 | lock_kernel(); |
649 | return -ENXIO; | 649 | if (iminor(inode) > 0 || adb_controller == NULL) { |
650 | ret = -ENXIO; | ||
651 | goto out; | ||
652 | } | ||
650 | state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL); | 653 | state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL); |
651 | if (state == 0) | 654 | if (state == 0) { |
652 | return -ENOMEM; | 655 | ret = -ENOMEM; |
656 | goto out; | ||
657 | } | ||
653 | file->private_data = state; | 658 | file->private_data = state; |
654 | spin_lock_init(&state->lock); | 659 | spin_lock_init(&state->lock); |
655 | atomic_set(&state->n_pending, 0); | 660 | atomic_set(&state->n_pending, 0); |
@@ -657,7 +662,9 @@ static int adb_open(struct inode *inode, struct file *file) | |||
657 | init_waitqueue_head(&state->wait_queue); | 662 | init_waitqueue_head(&state->wait_queue); |
658 | state->inuse = 1; | 663 | state->inuse = 1; |
659 | 664 | ||
660 | return 0; | 665 | out: |
666 | unlock_kernel(); | ||
667 | return ret; | ||
661 | } | 668 | } |
662 | 669 | ||
663 | static int adb_release(struct inode *inode, struct file *file) | 670 | static int adb_release(struct inode *inode, struct file *file) |