aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2008-05-15 12:37:16 -0400
committerJonathan Corbet <corbet@lwn.net>2008-06-20 16:05:47 -0400
commit2edbf8537edc62c9b0ef75e7025d01e8b6a48707 (patch)
treece6127e2a663c91603bf08cbeab59602f16bea19 /drivers/input
parent702e57d9ef7002f8d362faa6ddebc59e6d43fa05 (diff)
Input: cdev lock_kernel() pushdown
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/input.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 27006fc18305..408df0bd6be5 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -21,6 +21,7 @@
21#include <linux/device.h> 21#include <linux/device.h>
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23#include <linux/rcupdate.h> 23#include <linux/rcupdate.h>
24#include <linux/smp_lock.h>
24 25
25MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>"); 26MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
26MODULE_DESCRIPTION("Input core"); 27MODULE_DESCRIPTION("Input core");
@@ -1588,13 +1589,17 @@ EXPORT_SYMBOL(input_unregister_handle);
1588 1589
1589static int input_open_file(struct inode *inode, struct file *file) 1590static int input_open_file(struct inode *inode, struct file *file)
1590{ 1591{
1591 struct input_handler *handler = input_table[iminor(inode) >> 5]; 1592 struct input_handler *handler;
1592 const struct file_operations *old_fops, *new_fops = NULL; 1593 const struct file_operations *old_fops, *new_fops = NULL;
1593 int err; 1594 int err;
1594 1595
1596 lock_kernel();
1595 /* No load-on-demand here? */ 1597 /* No load-on-demand here? */
1596 if (!handler || !(new_fops = fops_get(handler->fops))) 1598 handler = input_table[iminor(inode) >> 5];
1597 return -ENODEV; 1599 if (!handler || !(new_fops = fops_get(handler->fops))) {
1600 err = -ENODEV;
1601 goto out;
1602 }
1598 1603
1599 /* 1604 /*
1600 * That's _really_ odd. Usually NULL ->open means "nothing special", 1605 * That's _really_ odd. Usually NULL ->open means "nothing special",
@@ -1602,7 +1607,8 @@ static int input_open_file(struct inode *inode, struct file *file)
1602 */ 1607 */
1603 if (!new_fops->open) { 1608 if (!new_fops->open) {
1604 fops_put(new_fops); 1609 fops_put(new_fops);
1605 return -ENODEV; 1610 err = -ENODEV;
1611 goto out;
1606 } 1612 }
1607 old_fops = file->f_op; 1613 old_fops = file->f_op;
1608 file->f_op = new_fops; 1614 file->f_op = new_fops;
@@ -1614,6 +1620,8 @@ static int input_open_file(struct inode *inode, struct file *file)
1614 file->f_op = fops_get(old_fops); 1620 file->f_op = fops_get(old_fops);
1615 } 1621 }
1616 fops_put(old_fops); 1622 fops_put(old_fops);
1623out:
1624 unlock_kernel();
1617 return err; 1625 return err;
1618} 1626}
1619 1627