aboutsummaryrefslogtreecommitdiffstats
path: root/include
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 /include
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 'include')
-rw-r--r--include/linux/input.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/input.h b/include/linux/input.h
index 1bdc39a8c76c..cae2c35d1206 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1227,12 +1227,13 @@ void input_free_device(struct input_dev *dev);
1227 1227
1228static inline struct input_dev *input_get_device(struct input_dev *dev) 1228static inline struct input_dev *input_get_device(struct input_dev *dev)
1229{ 1229{
1230 return to_input_dev(get_device(&dev->dev)); 1230 return dev ? to_input_dev(get_device(&dev->dev)) : NULL;
1231} 1231}
1232 1232
1233static inline void input_put_device(struct input_dev *dev) 1233static inline void input_put_device(struct input_dev *dev)
1234{ 1234{
1235 put_device(&dev->dev); 1235 if (dev)
1236 put_device(&dev->dev);
1236} 1237}
1237 1238
1238static inline void *input_get_drvdata(struct input_dev *dev) 1239static inline void *input_get_drvdata(struct input_dev *dev)