diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-09-15 03:01:39 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 12:52:52 -0400 |
commit | d19fbe8a763634395d4bef40fc88cdb61c4a6274 (patch) | |
tree | 476cedefc829d1523507aebb2093b0d3b58469b0 /include/linux | |
parent | 4f00469c16b86a3dd6ed66b28c605c8430d58eeb (diff) |
[PATCH] Input: prepare to sysfs integration
Input: prepare to sysfs integration
Add struct class_device to input_dev; add input_allocate_dev()
to dynamically allocate input devices; dynamically allocated
devices are automatically registered with sysfs.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/input.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/include/linux/input.h b/include/linux/input.h index e8c296ff6257..3defa29a17d3 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #ifdef __KERNEL__ | 12 | #ifdef __KERNEL__ |
13 | #include <linux/time.h> | 13 | #include <linux/time.h> |
14 | #include <linux/list.h> | 14 | #include <linux/list.h> |
15 | #include <linux/device.h> | ||
15 | #else | 16 | #else |
16 | #include <sys/time.h> | 17 | #include <sys/time.h> |
17 | #include <sys/ioctl.h> | 18 | #include <sys/ioctl.h> |
@@ -889,11 +890,15 @@ struct input_dev { | |||
889 | struct semaphore sem; /* serializes open and close operations */ | 890 | struct semaphore sem; /* serializes open and close operations */ |
890 | unsigned int users; | 891 | unsigned int users; |
891 | 892 | ||
892 | struct device *dev; | 893 | struct class_device cdev; |
894 | struct device *dev; /* will be removed soon */ | ||
895 | |||
896 | int dynalloc; /* temporarily */ | ||
893 | 897 | ||
894 | struct list_head h_list; | 898 | struct list_head h_list; |
895 | struct list_head node; | 899 | struct list_head node; |
896 | }; | 900 | }; |
901 | #define to_input_dev(d) container_of(d, struct input_dev, cdev) | ||
897 | 902 | ||
898 | /* | 903 | /* |
899 | * Structure for hotplug & device<->driver matching. | 904 | * Structure for hotplug & device<->driver matching. |
@@ -984,6 +989,23 @@ static inline void init_input_dev(struct input_dev *dev) | |||
984 | INIT_LIST_HEAD(&dev->node); | 989 | INIT_LIST_HEAD(&dev->node); |
985 | } | 990 | } |
986 | 991 | ||
992 | struct input_dev *input_allocate_device(void); | ||
993 | |||
994 | static inline void input_free_device(struct input_dev *dev) | ||
995 | { | ||
996 | kfree(dev); | ||
997 | } | ||
998 | |||
999 | static inline struct input_dev *input_get_device(struct input_dev *dev) | ||
1000 | { | ||
1001 | return to_input_dev(class_device_get(&dev->cdev)); | ||
1002 | } | ||
1003 | |||
1004 | static inline void input_put_device(struct input_dev *dev) | ||
1005 | { | ||
1006 | class_device_put(&dev->cdev); | ||
1007 | } | ||
1008 | |||
987 | void input_register_device(struct input_dev *); | 1009 | void input_register_device(struct input_dev *); |
988 | void input_unregister_device(struct input_dev *); | 1010 | void input_unregister_device(struct input_dev *); |
989 | 1011 | ||