aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-01 14:23:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-01 14:23:05 -0400
commit3344203948f40521c35a0a52e3f1bd9fbb7a1118 (patch)
tree1825cf3347c03261c9f72a10e84a263ba34bf4ad
parent7731ce63d9a863c987dd87b0425451fff0e6cdc8 (diff)
parenta7097ff89c3204737a07eecbc83f9ae6002cc534 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: make sure input interfaces pin parent input devices Input: apm-power - fix crash when unloading modules Input: pxa27x - fix keypad KPC macros
-rw-r--r--drivers/input/apm-power.c7
-rw-r--r--drivers/input/evdev.c6
-rw-r--r--drivers/input/joydev.c3
-rw-r--r--drivers/input/keyboard/pxa27x_keypad.c6
-rw-r--r--drivers/input/mousedev.c3
-rw-r--r--include/linux/input.h5
6 files changed, 14 insertions, 16 deletions
diff --git a/drivers/input/apm-power.c b/drivers/input/apm-power.c
index c36d110b349a..7d61a9660806 100644
--- a/drivers/input/apm-power.c
+++ b/drivers/input/apm-power.c
@@ -63,8 +63,6 @@ static int apmpower_connect(struct input_handler *handler,
63 handle->handler = handler; 63 handle->handler = handler;
64 handle->name = "apm-power"; 64 handle->name = "apm-power";
65 65
66 handler->private = handle;
67
68 error = input_register_handle(handle); 66 error = input_register_handle(handle);
69 if (error) { 67 if (error) {
70 printk(KERN_ERR 68 printk(KERN_ERR
@@ -87,11 +85,10 @@ static int apmpower_connect(struct input_handler *handler,
87 return 0; 85 return 0;
88} 86}
89 87
90static void apmpower_disconnect(struct input_handle *handler) 88static void apmpower_disconnect(struct input_handle *handle)
91{ 89{
92 struct input_handle *handle = handler->private;
93
94 input_close_device(handle); 90 input_close_device(handle);
91 input_unregister_handle(handle);
95 kfree(handle); 92 kfree(handle);
96} 93}
97 94
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 99562cee827e..b32984bc516f 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -124,6 +124,7 @@ static void evdev_free(struct device *dev)
124{ 124{
125 struct evdev *evdev = container_of(dev, struct evdev, dev); 125 struct evdev *evdev = container_of(dev, struct evdev, dev);
126 126
127 input_put_device(evdev->handle.dev);
127 kfree(evdev); 128 kfree(evdev);
128} 129}
129 130
@@ -853,9 +854,6 @@ static void evdev_cleanup(struct evdev *evdev)
853 evdev_hangup(evdev); 854 evdev_hangup(evdev);
854 evdev_remove_chrdev(evdev); 855 evdev_remove_chrdev(evdev);
855 856
856 if (evdev->grab)
857 evdev_ungrab(evdev, evdev->grab);
858
859 /* evdev is marked dead so no one else accesses evdev->open */ 857 /* evdev is marked dead so no one else accesses evdev->open */
860 if (evdev->open) { 858 if (evdev->open) {
861 input_flush_device(handle, NULL); 859 input_flush_device(handle, NULL);
@@ -896,7 +894,7 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev,
896 evdev->exist = 1; 894 evdev->exist = 1;
897 evdev->minor = minor; 895 evdev->minor = minor;
898 896
899 evdev->handle.dev = dev; 897 evdev->handle.dev = input_get_device(dev);
900 evdev->handle.name = evdev->name; 898 evdev->handle.name = evdev->name;
901 evdev->handle.handler = handler; 899 evdev->handle.handler = handler;
902 evdev->handle.private = evdev; 900 evdev->handle.private = evdev;
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;
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index 6224c2fb3b65..4e651c11c1da 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -50,9 +50,9 @@
50#define KPKDI 0x0048 50#define KPKDI 0x0048
51 51
52/* bit definitions */ 52/* bit definitions */
53#define KPC_MKRN(n) ((((n) & 0x7) - 1) << 26) /* matrix key row number */ 53#define KPC_MKRN(n) ((((n) - 1) & 0x7) << 26) /* matrix key row number */
54#define KPC_MKCN(n) ((((n) & 0x7) - 1) << 23) /* matrix key column number */ 54#define KPC_MKCN(n) ((((n) - 1) & 0x7) << 23) /* matrix key column number */
55#define KPC_DKN(n) ((((n) & 0x7) - 1) << 6) /* direct key number */ 55#define KPC_DKN(n) ((((n) - 1) & 0x7) << 6) /* direct key number */
56 56
57#define KPC_AS (0x1 << 30) /* Automatic Scan bit */ 57#define KPC_AS (0x1 << 30) /* Automatic Scan bit */
58#define KPC_ASACT (0x1 << 29) /* Automatic Scan on Activity */ 58#define KPC_ASACT (0x1 << 29) /* Automatic Scan on Activity */
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index bbbe5e81adc1..b989748598ae 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -414,6 +414,7 @@ static void mousedev_free(struct device *dev)
414{ 414{
415 struct mousedev *mousedev = container_of(dev, struct mousedev, dev); 415 struct mousedev *mousedev = container_of(dev, struct mousedev, dev);
416 416
417 input_put_device(mousedev->handle.dev);
417 kfree(mousedev); 418 kfree(mousedev);
418} 419}
419 420
@@ -865,7 +866,7 @@ static struct mousedev *mousedev_create(struct input_dev *dev,
865 866
866 mousedev->minor = minor; 867 mousedev->minor = minor;
867 mousedev->exist = 1; 868 mousedev->exist = 1;
868 mousedev->handle.dev = dev; 869 mousedev->handle.dev = input_get_device(dev);
869 mousedev->handle.name = mousedev->name; 870 mousedev->handle.name = mousedev->name;
870 mousedev->handle.handler = handler; 871 mousedev->handle.handler = handler;
871 mousedev->handle.private = mousedev; 872 mousedev->handle.private = mousedev;
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)