aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/joydev.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2008-04-01 00:22:53 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-04-01 00:22:53 -0400
commita7097ff89c3204737a07eecbc83f9ae6002cc534 (patch)
tree11fe55cbfb3651fc57e59fc838d1e084f5e63749 /drivers/input/joydev.c
parent399f486286f44d55c4fff0e9cc5d712f2b443489 (diff)
Input: make sure input interfaces pin parent input devices
Recent driver core change causes references to parent devices being dropped early, at device_del() time, as opposed to when all children are freed. This causes oops in evdev with grabbed devices. Take the reference to the parent input device ourselves to ensure that it stays around long enough. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/joydev.c')
-rw-r--r--drivers/input/joydev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 22b2789ef58a..65d7077a75a1 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -171,6 +171,7 @@ static void joydev_free(struct device *dev)
171{ 171{
172 struct joydev *joydev = container_of(dev, struct joydev, dev); 172 struct joydev *joydev = container_of(dev, struct joydev, dev);
173 173
174 input_put_device(joydev->handle.dev);
174 kfree(joydev); 175 kfree(joydev);
175} 176}
176 177
@@ -750,7 +751,7 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
750 joydev->minor = minor; 751 joydev->minor = minor;
751 752
752 joydev->exist = 1; 753 joydev->exist = 1;
753 joydev->handle.dev = dev; 754 joydev->handle.dev = input_get_device(dev);
754 joydev->handle.name = joydev->name; 755 joydev->handle.name = joydev->name;
755 joydev->handle.handler = handler; 756 joydev->handle.handler = handler;
756 joydev->handle.private = joydev; 757 joydev->handle.private = joydev;