aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2008-05-20 13:16:20 -0400
committerJonathan Corbet <corbet@lwn.net>2008-07-02 17:06:23 -0400
commitf9c8154f367d471f1af56742fe8534f8458adb98 (patch)
tree6625c2e4a82d5f772545ec606434d616a6ae3797 /drivers
parentdca67e9d3db27b090259b696e1166615f40099e2 (diff)
mousedev: BKL pushdown
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/mousedev.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index b989748598ae..8137e50ded87 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -14,6 +14,7 @@
14#define MOUSEDEV_MIX 31 14#define MOUSEDEV_MIX 31
15 15
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/smp_lock.h>
17#include <linux/poll.h> 18#include <linux/poll.h>
18#include <linux/module.h> 19#include <linux/module.h>
19#include <linux/init.h> 20#include <linux/init.h>
@@ -545,16 +546,21 @@ static int mousedev_open(struct inode *inode, struct file *file)
545 if (i >= MOUSEDEV_MINORS) 546 if (i >= MOUSEDEV_MINORS)
546 return -ENODEV; 547 return -ENODEV;
547 548
549 lock_kernel();
548 error = mutex_lock_interruptible(&mousedev_table_mutex); 550 error = mutex_lock_interruptible(&mousedev_table_mutex);
549 if (error) 551 if (error) {
552 unlock_kernel();
550 return error; 553 return error;
554 }
551 mousedev = mousedev_table[i]; 555 mousedev = mousedev_table[i];
552 if (mousedev) 556 if (mousedev)
553 get_device(&mousedev->dev); 557 get_device(&mousedev->dev);
554 mutex_unlock(&mousedev_table_mutex); 558 mutex_unlock(&mousedev_table_mutex);
555 559
556 if (!mousedev) 560 if (!mousedev) {
561 unlock_kernel();
557 return -ENODEV; 562 return -ENODEV;
563 }
558 564
559 client = kzalloc(sizeof(struct mousedev_client), GFP_KERNEL); 565 client = kzalloc(sizeof(struct mousedev_client), GFP_KERNEL);
560 if (!client) { 566 if (!client) {
@@ -573,6 +579,7 @@ static int mousedev_open(struct inode *inode, struct file *file)
573 goto err_free_client; 579 goto err_free_client;
574 580
575 file->private_data = client; 581 file->private_data = client;
582 unlock_kernel();
576 return 0; 583 return 0;
577 584
578 err_free_client: 585 err_free_client:
@@ -580,6 +587,7 @@ static int mousedev_open(struct inode *inode, struct file *file)
580 kfree(client); 587 kfree(client);
581 err_put_mousedev: 588 err_put_mousedev:
582 put_device(&mousedev->dev); 589 put_device(&mousedev->dev);
590 unlock_kernel();
583 return error; 591 return error;
584} 592}
585 593