aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/input.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2008-07-21 00:55:14 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-07-21 00:55:14 -0400
commit908cf4b925e419bc74f3297b2f0e51d6f8a81da2 (patch)
tree6c2da79366d4695a9c2560ab18259eca8a2a25b4 /drivers/input/input.c
parent92c49890922d54cba4b1eadeb0b185773c2c9570 (diff)
parent14b395e35d1afdd8019d11b92e28041fad591b71 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 into next
Diffstat (limited to 'drivers/input/input.c')
-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 cae48117e86b..c13ced3e0d3d 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