summaryrefslogtreecommitdiff
path: root/include/linux/input.h
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-09-15 11:01:39 +0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 20:52:52 +0400
commitd19fbe8a763634395d4bef40fc88cdb61c4a6274 (patch)
tree476cedefc829d1523507aebb2093b0d3b58469b0 /include/linux/input.h
parent4f00469c16b86a3dd6ed66b28c605c8430d58eeb (diff)
downloadlinux-d19fbe8a763634395d4bef40fc88cdb61c4a6274.tar.xz
[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/input.h')
-rw-r--r--include/linux/input.h24
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 @@
#ifdef __KERNEL__
#include <linux/time.h>
#include <linux/list.h>
+#include <linux/device.h>
#else
#include <sys/time.h>
#include <sys/ioctl.h>
@@ -889,11 +890,15 @@ struct input_dev {
struct semaphore sem; /* serializes open and close operations */
unsigned int users;
- struct device *dev;
+ struct class_device cdev;
+ struct device *dev; /* will be removed soon */
+
+ int dynalloc; /* temporarily */
struct list_head h_list;
struct list_head node;
};
+#define to_input_dev(d) container_of(d, struct input_dev, cdev)
/*
* Structure for hotplug & device<->driver matching.
@@ -984,6 +989,23 @@ static inline void init_input_dev(struct input_dev *dev)
INIT_LIST_HEAD(&dev->node);
}
+struct input_dev *input_allocate_device(void);
+
+static inline void input_free_device(struct input_dev *dev)
+{
+ kfree(dev);
+}
+
+static inline struct input_dev *input_get_device(struct input_dev *dev)
+{
+ return to_input_dev(class_device_get(&dev->cdev));
+}
+
+static inline void input_put_device(struct input_dev *dev)
+{
+ class_device_put(&dev->cdev);
+}
+
void input_register_device(struct input_dev *);
void input_unregister_device(struct input_dev *);