]> err.no Git - linux-2.6/blobdiff - include/linux/input.h
Input: allow passing NULL to input_free_device()
[linux-2.6] / include / linux / input.h
index f623c745c21cee3691862f54bc56cedd1e78504e..16c19d710a4dcce2d6b666a9e10920f6c042b876 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/time.h>
 #include <linux/list.h>
 #include <linux/device.h>
+#include <linux/mod_devicetable.h>
 #else
 #include <sys/time.h>
 #include <sys/ioctl.h>
@@ -420,7 +421,7 @@ struct input_absinfo {
 #define BTN_GEAR_UP            0x151
 
 #define KEY_OK                 0x160
-#define KEY_SELECT             0x161
+#define KEY_SELECT             0x161
 #define KEY_GOTO               0x162
 #define KEY_CLEAR              0x163
 #define KEY_POWER2             0x164
@@ -511,6 +512,17 @@ struct input_absinfo {
 #define KEY_FN_S               0x1e3
 #define KEY_FN_B               0x1e4
 
+#define KEY_BRL_DOT1           0x1f1
+#define KEY_BRL_DOT2           0x1f2
+#define KEY_BRL_DOT3           0x1f3
+#define KEY_BRL_DOT4           0x1f4
+#define KEY_BRL_DOT5           0x1f5
+#define KEY_BRL_DOT6           0x1f6
+#define KEY_BRL_DOT7           0x1f7
+#define KEY_BRL_DOT8           0x1f8
+
+/* We avoid low common keys in module aliases so they don't get huge. */
+#define KEY_MIN_INTERESTING    KEY_MUTE
 #define KEY_MAX                        0x1ff
 
 /*
@@ -793,6 +805,44 @@ struct ff_effect {
 
 #define FF_MAX         0x7f
 
+struct input_device_id {
+
+       kernel_ulong_t flags;
+
+       struct input_id id;
+
+       kernel_ulong_t evbit[EV_MAX/BITS_PER_LONG+1];
+       kernel_ulong_t keybit[KEY_MAX/BITS_PER_LONG+1];
+       kernel_ulong_t relbit[REL_MAX/BITS_PER_LONG+1];
+       kernel_ulong_t absbit[ABS_MAX/BITS_PER_LONG+1];
+       kernel_ulong_t mscbit[MSC_MAX/BITS_PER_LONG+1];
+       kernel_ulong_t ledbit[LED_MAX/BITS_PER_LONG+1];
+       kernel_ulong_t sndbit[SND_MAX/BITS_PER_LONG+1];
+       kernel_ulong_t ffbit[FF_MAX/BITS_PER_LONG+1];
+       kernel_ulong_t swbit[SW_MAX/BITS_PER_LONG+1];
+
+       kernel_ulong_t driver_info;
+};
+
+/*
+ * Structure for hotplug & device<->driver matching.
+ */
+
+#define INPUT_DEVICE_ID_MATCH_BUS      1
+#define INPUT_DEVICE_ID_MATCH_VENDOR   2
+#define INPUT_DEVICE_ID_MATCH_PRODUCT  4
+#define INPUT_DEVICE_ID_MATCH_VERSION  8
+
+#define INPUT_DEVICE_ID_MATCH_EVBIT    0x010
+#define INPUT_DEVICE_ID_MATCH_KEYBIT   0x020
+#define INPUT_DEVICE_ID_MATCH_RELBIT   0x040
+#define INPUT_DEVICE_ID_MATCH_ABSBIT   0x080
+#define INPUT_DEVICE_ID_MATCH_MSCIT    0x100
+#define INPUT_DEVICE_ID_MATCH_LEDBIT   0x200
+#define INPUT_DEVICE_ID_MATCH_SNDBIT   0x400
+#define INPUT_DEVICE_ID_MATCH_FFBIT    0x800
+#define INPUT_DEVICE_ID_MATCH_SWBIT    0x1000
+
 #ifdef __KERNEL__
 
 /*
@@ -888,7 +938,7 @@ struct input_dev {
 
        struct input_handle *grab;
 
-       struct semaphore sem;   /* serializes open and close operations */
+       struct mutex mutex;     /* serializes open and close operations */
        unsigned int users;
 
        struct class_device cdev;
@@ -901,49 +951,11 @@ struct input_dev {
 };
 #define to_input_dev(d) container_of(d, struct input_dev, cdev)
 
-/*
- * Structure for hotplug & device<->driver matching.
- */
-
-#define INPUT_DEVICE_ID_MATCH_BUS      1
-#define INPUT_DEVICE_ID_MATCH_VENDOR   2
-#define INPUT_DEVICE_ID_MATCH_PRODUCT  4
-#define INPUT_DEVICE_ID_MATCH_VERSION  8
-
-#define INPUT_DEVICE_ID_MATCH_EVBIT    0x010
-#define INPUT_DEVICE_ID_MATCH_KEYBIT   0x020
-#define INPUT_DEVICE_ID_MATCH_RELBIT   0x040
-#define INPUT_DEVICE_ID_MATCH_ABSBIT   0x080
-#define INPUT_DEVICE_ID_MATCH_MSCIT    0x100
-#define INPUT_DEVICE_ID_MATCH_LEDBIT   0x200
-#define INPUT_DEVICE_ID_MATCH_SNDBIT   0x400
-#define INPUT_DEVICE_ID_MATCH_FFBIT    0x800
-#define INPUT_DEVICE_ID_MATCH_SWBIT    0x1000
-
 #define INPUT_DEVICE_ID_MATCH_DEVICE\
        (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)
 #define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\
        (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION)
 
-struct input_device_id {
-
-       unsigned long flags;
-
-       struct input_id id;
-
-       unsigned long evbit[NBITS(EV_MAX)];
-       unsigned long keybit[NBITS(KEY_MAX)];
-       unsigned long relbit[NBITS(REL_MAX)];
-       unsigned long absbit[NBITS(ABS_MAX)];
-       unsigned long mscbit[NBITS(MSC_MAX)];
-       unsigned long ledbit[NBITS(LED_MAX)];
-       unsigned long sndbit[NBITS(SND_MAX)];
-       unsigned long ffbit[NBITS(FF_MAX)];
-       unsigned long swbit[NBITS(SW_MAX)];
-
-       unsigned long driver_info;
-};
-
 struct input_handle;
 
 struct input_handler {
@@ -954,7 +966,7 @@ struct input_handler {
        struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id);
        void (*disconnect)(struct input_handle *handle);
 
-       struct file_operations *fops;
+       const struct file_operations *fops;
        int minor;
        char *name;
 
@@ -992,11 +1004,6 @@ static inline void init_input_dev(struct input_dev *dev)
 
 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));
@@ -1007,7 +1014,13 @@ static inline void input_put_device(struct input_dev *dev)
        class_device_put(&dev->cdev);
 }
 
-void input_register_device(struct input_dev *);
+static inline void input_free_device(struct input_dev *dev)
+{
+       if (dev)
+               input_put_device(dev);
+}
+
+int input_register_device(struct input_dev *);
 void input_unregister_device(struct input_dev *);
 
 void input_register_handler(struct input_handler *);