Merge commit 'v2.6.33-rc5' into next
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 22 Jan 2010 07:55:25 +0000 (23:55 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 22 Jan 2010 07:55:25 +0000 (23:55 -0800)
27 files changed:
Documentation/input/sentelic.txt
arch/arm/mach-ep93xx/include/mach/ep93xx_keypad.h
drivers/input/gameport/emu10k1-gp.c
drivers/input/gameport/fm801-gp.c
drivers/input/gameport/gameport.c
drivers/input/gameport/ns558.c
drivers/input/input.c
drivers/input/joystick/xpad.c
drivers/input/keyboard/Kconfig
drivers/input/keyboard/adp5588-keys.c
drivers/input/keyboard/atkbd.c
drivers/input/keyboard/ep93xx_keypad.c
drivers/input/keyboard/qt2160.c
drivers/input/keyboard/sh_keysc.c
drivers/input/misc/apanel.c
drivers/input/mouse/hgpk.c
drivers/input/serio/pcips2.c
drivers/input/serio/serio.c
drivers/input/serio/xilinx_ps2.c
drivers/input/tablet/gtco.c
drivers/input/touchscreen/elo.c
drivers/input/touchscreen/tsc2007.c
drivers/input/touchscreen/usbtouchscreen.c
drivers/input/xen-kbdfront.c
include/linux/gameport.h
include/linux/input/sh_keysc.h
include/linux/serio.h

index f7160a2..b35affd 100644 (file)
@@ -1,5 +1,5 @@
-Copyright (C) 2002-2008 Sentelic Corporation.
-Last update: Oct-31-2008
+Copyright (C) 2002-2010 Sentelic Corporation.
+Last update: Jan-13-2010
 
 ==============================================================================
 * Finger Sensing Pad Intellimouse Mode(scrolling wheel, 4th and 5th buttons)
@@ -44,7 +44,7 @@ B) MSID 6: Horizontal and Vertical scrolling.
 Packet 1
    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
-  1   |Y|X|y|x|1|M|R|L|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 | | |B|F|l|r|u|d|
+  1   |Y|X|y|x|1|M|R|L|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 | | |B|F|r|l|u|d|
       |---------------|     |---------------|    |---------------|    |---------------|
 
 Byte 1: Bit7 => Y overflow
@@ -59,15 +59,15 @@ Byte 2: X Movement(9-bit 2's complement integers)
 Byte 3: Y Movement(9-bit 2's complement integers)
 Byte 4: Bit0 => the Vertical scrolling movement downward.
        Bit1 => the Vertical scrolling movement upward.
-       Bit2 => the Vertical scrolling movement rightward.
-       Bit3 => the Vertical scrolling movement leftward.
+       Bit2 => the Horizontal scrolling movement leftward.
+       Bit3 => the Horizontal scrolling movement rightward.
         Bit4 => 1 = 4th mouse button is pressed, Forward one page.
                 0 = 4th mouse button is not pressed.
         Bit5 => 1 = 5th mouse button is pressed, Backward one page.
                 0 = 5th mouse button is not pressed.
 
 C) MSID 7:
-# FSP uses 2 packets(8 Bytes) data to represent Absolute Position
+# FSP uses 2 packets (8 Bytes) to represent Absolute Position.
   so we have PACKET NUMBER to identify packets.
   If PACKET NUMBER is 0, the packet is Packet 1.
   If PACKET NUMBER is 1, the packet is Packet 2.
@@ -129,7 +129,7 @@ Byte 3: Message Type => 0x00 (Disabled)
 Byte 4: Bit7~Bit0 => Don't Care
 
 ==============================================================================
-* Absolute position for STL3888-A0.
+* Absolute position for STL3888-Ax.
 ==============================================================================
 Packet 1 (ABSOLUTE POSITION)
    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
@@ -179,14 +179,14 @@ Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0])
         Bit5~Bit4 => y2_g
         Bit7~Bit6 => x2_g
 
-Notify Packet for STL3888-A0
+Notify Packet for STL3888-Ax
    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
   1   |1|0|1|P|1|M|R|L|  2  |C|C|C|C|C|C|C|C|  3 |0|0|F|F|0|0|0|i|  4 |r|l|d|u|0|0|0|0|
       |---------------|     |---------------|    |---------------|    |---------------|
 
 Byte 1: Bit7~Bit6 => 00, Normal data packet
-                  => 01, Absolute coordination packet
+                  => 01, Absolute coordinates packet
                   => 10, Notify packet
         Bit5 => 1
         Bit4 => when in absolute coordinates mode (valid when EN_PKT_GO is 1):
@@ -205,15 +205,106 @@ Byte 4: Bit7 => scroll right button
         Bit6 => scroll left button
         Bit5 => scroll down button
         Bit4 => scroll up button
-            * Note that if gesture and additional button (Bit4~Bit7)
-             happen at the same time, the button information will not
-             be sent.
+            * Note that if gesture and additional buttoni (Bit4~Bit7)
+              happen at the same time, the button information will not
+              be sent.
+        Bit3~Bit0 => Reserved
+
+Sample sequence of Multi-finger, Multi-coordinate mode:
+
+       notify packet (valid bit == 1), abs pkt 1, abs pkt 2, abs pkt 1,
+       abs pkt 2, ..., notify packet (valid bit == 0)
+
+==============================================================================
+* Absolute position for STL3888-B0.
+==============================================================================
+Packet 1(ABSOLUTE POSITION)
+   Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
+BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
+  1   |0|1|V|F|1|0|R|L|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 |r|l|u|d|X|X|Y|Y|
+      |---------------|     |---------------|    |---------------|    |---------------|
+
+Byte 1: Bit7~Bit6 => 00, Normal data packet
+                  => 01, Absolute coordinates packet
+                  => 10, Notify packet
+        Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up.
+                When both fingers are up, the last two reports have zero valid
+                bit.
+        Bit4 => finger up/down information. 1: finger down, 0: finger up.
+        Bit3 => 1
+        Bit2 => finger index, 0 is the first finger, 1 is the second finger.
+        Bit1 => Right Button, 1 is pressed, 0 is not pressed.
+        Bit0 => Left Button, 1 is pressed, 0 is not pressed.
+Byte 2: X coordinate (xpos[9:2])
+Byte 3: Y coordinate (ypos[9:2])
+Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0])
+        Bit3~Bit2 => X coordinate (ypos[1:0])
+        Bit4 => scroll down button
+        Bit5 => scroll up button
+        Bit6 => scroll left button
+        Bit7 => scroll right button
+
+Packet 2 (ABSOLUTE POSITION)
+   Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
+BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
+  1   |0|1|V|F|1|1|R|L|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 |r|l|u|d|X|X|Y|Y|
+      |---------------|     |---------------|    |---------------|    |---------------|
+
+Byte 1: Bit7~Bit6 => 00, Normal data packet
+                  => 01, Absolute coordination packet
+                  => 10, Notify packet
+        Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up.
+                When both fingers are up, the last two reports have zero valid
+                bit.
+        Bit4 => finger up/down information. 1: finger down, 0: finger up.
+        Bit3 => 1
+        Bit2 => finger index, 0 is the first finger, 1 is the second finger.
+        Bit1 => Right Button, 1 is pressed, 0 is not pressed.
+        Bit0 => Left Button, 1 is pressed, 0 is not pressed.
+Byte 2: X coordinate (xpos[9:2])
+Byte 3: Y coordinate (ypos[9:2])
+Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0])
+        Bit3~Bit2 => X coordinate (ypos[1:0])
+        Bit4 => scroll down button
+        Bit5 => scroll up button
+        Bit6 => scroll left button
+        Bit7 => scroll right button
+
+Notify Packet for STL3888-B0
+   Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
+BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
+  1   |1|0|1|P|1|M|R|L|  2  |C|C|C|C|C|C|C|C|  3 |0|0|F|F|0|0|0|i|  4 |r|l|u|d|0|0|0|0|
+      |---------------|     |---------------|    |---------------|    |---------------|
+
+Byte 1: Bit7~Bit6 => 00, Normal data packet
+                  => 01, Absolute coordination packet
+                  => 10, Notify packet
+        Bit5 => 1
+        Bit4 => when in absolute coordinate mode (valid when EN_PKT_GO is 1):
+                0: left button is generated by the on-pad command
+                1: left button is generated by the external button
+        Bit3 => 1
+        Bit2 => Middle Button, 1 is pressed, 0 is not pressed.
+        Bit1 => Right Button, 1 is pressed, 0 is not pressed.
+        Bit0 => Left Button, 1 is pressed, 0 is not pressed.
+Byte 2: Message Type => 0xB7 (Multi Finger, Multi Coordinate mode)
+Byte 3: Bit7~Bit6 => Don't care
+        Bit5~Bit4 => Number of fingers
+        Bit3~Bit1 => Reserved
+        Bit0 => 1: enter gesture mode; 0: leaving gesture mode
+Byte 4: Bit7 => scroll right button
+        Bit6 => scroll left button
+        Bit5 => scroll up button
+        Bit4 => scroll down button
+            * Note that if gesture and additional button(Bit4~Bit7)
+              happen at the same time, the button information will not
+              be sent.
         Bit3~Bit0 => Reserved
 
 Sample sequence of Multi-finger, Multi-coordinate mode:
 
        notify packet (valid bit == 1), abs pkt 1, abs pkt 2, abs pkt 1,
-       abs pkt 2, ..., notify packet(valid bit == 0)
+       abs pkt 2, ..., notify packet (valid bit == 0)
 
 ==============================================================================
 * FSP Enable/Disable packet
@@ -409,7 +500,8 @@ offset      width           default r/w     name
                                        0: read only, 1: read/write enable
        (Note that following registers does not require clock gating being
        enabled prior to write: 05 06 07 08 09 0c 0f 10 11 12 16 17 18 23 2e
-       40 41 42 43.)
+       40 41 42 43.  In addition to that, this bit must be 1 when gesture
+       mode is enabled)
 
 0x31                           RW      on-pad command detection
        bit7            0       RW      on-pad command left button down tag
@@ -463,6 +555,10 @@ offset     width           default r/w     name
        absolute coordinates; otherwise, host only receives packets with
        relative coordinate.)
 
+       bit7            0       RW      EN_PS2_F2: PS/2 gesture mode 2nd
+                                       finger packet enable
+                                       0: disable, 1: enable
+
 0x43                           RW      on-pad control
        bit0            0       RW      on-pad control enable
                                        0: disable, 1: enable
index 62d1742..1e2f4e9 100644 (file)
@@ -5,6 +5,8 @@
 #ifndef __ASM_ARCH_EP93XX_KEYPAD_H
 #define __ASM_ARCH_EP93XX_KEYPAD_H
 
+struct matrix_keymap_data;
+
 /* flags for the ep93xx_keypad driver */
 #define EP93XX_KEYPAD_DISABLE_3_KEY    (1<<0)  /* disable 3-key reset */
 #define EP93XX_KEYPAD_DIAG_MODE                (1<<1)  /* diagnostic mode */
 
 /**
  * struct ep93xx_keypad_platform_data - platform specific device structure
- * @matrix_key_map:            array of keycodes defining the keypad matrix
- * @matrix_key_map_size:       ARRAY_SIZE(matrix_key_map)
- * @debounce:                  debounce start count; terminal count is 0xff
- * @prescale:                  row/column counter pre-scaler load value
- * @flags:                     see above
+ * @keymap_data:       pointer to &matrix_keymap_data
+ * @debounce:          debounce start count; terminal count is 0xff
+ * @prescale:          row/column counter pre-scaler load value
+ * @flags:             see above
  */
 struct ep93xx_keypad_platform_data {
-       unsigned int    *matrix_key_map;
-       int             matrix_key_map_size;
+       struct matrix_keymap_data *keymap_data;
        unsigned int    debounce;
        unsigned int    prescale;
        unsigned int    flags;
index b04930f..7392992 100644 (file)
@@ -46,7 +46,7 @@ struct emu {
        int size;
 };
 
-static struct pci_device_id emu_tbl[] = {
+static const struct pci_device_id emu_tbl[] = {
 
        { 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live gameport */
        { 0x1102, 0x7003, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy gameport */
index 8a1810f..14d3f3e 100644 (file)
@@ -140,7 +140,7 @@ static void __devexit fm801_gp_remove(struct pci_dev *pci)
        }
 }
 
-static struct pci_device_id fm801_gp_id_table[] = {
+static const struct pci_device_id fm801_gp_id_table[] = {
        { PCI_VENDOR_ID_FORTEMEDIA, PCI_DEVICE_ID_FM801_GP, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0  },
        { 0 }
 };
index ac11be0..7e18bcf 100644 (file)
@@ -11,6 +11,8 @@
  * the Free Software Foundation.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/stddef.h>
 #include <linux/module.h>
 #include <linux/ioport.h>
@@ -190,9 +192,8 @@ static int gameport_bind_driver(struct gameport *gameport, struct gameport_drive
 
        error = device_bind_driver(&gameport->dev);
        if (error) {
-               printk(KERN_WARNING
-                       "gameport: device_bind_driver() failed "
-                       "for %s (%s) and %s, error: %d\n",
+               dev_warn(&gameport->dev,
+                        "device_bind_driver() failed for %s (%s) and %s, error: %d\n",
                        gameport->phys, gameport->name,
                        drv->description, error);
                drv->disconnect(gameport);
@@ -209,9 +210,9 @@ static void gameport_find_driver(struct gameport *gameport)
 
        error = device_attach(&gameport->dev);
        if (error < 0)
-               printk(KERN_WARNING
-                       "gameport: device_attach() failed for %s (%s), error: %d\n",
-                       gameport->phys, gameport->name, error);
+               dev_warn(&gameport->dev,
+                        "device_attach() failed for %s (%s), error: %d\n",
+                        gameport->phys, gameport->name, error);
 }
 
 
@@ -262,17 +263,14 @@ static int gameport_queue_event(void *object, struct module *owner,
 
        event = kmalloc(sizeof(struct gameport_event), GFP_ATOMIC);
        if (!event) {
-               printk(KERN_ERR
-                       "gameport: Not enough memory to queue event %d\n",
-                       event_type);
+               pr_err("Not enough memory to queue event %d\n", event_type);
                retval = -ENOMEM;
                goto out;
        }
 
        if (!try_module_get(owner)) {
-               printk(KERN_WARNING
-                       "gameport: Can't get module reference, dropping event %d\n",
-                       event_type);
+               pr_warning("Can't get module reference, dropping event %d\n",
+                          event_type);
                kfree(event);
                retval = -EINVAL;
                goto out;
@@ -298,14 +296,12 @@ static void gameport_free_event(struct gameport_event *event)
 
 static void gameport_remove_duplicate_events(struct gameport_event *event)
 {
-       struct list_head *node, *next;
-       struct gameport_event *e;
+       struct gameport_event *e, *next;
        unsigned long flags;
 
        spin_lock_irqsave(&gameport_event_lock, flags);
 
-       list_for_each_safe(node, next, &gameport_event_list) {
-               e = list_entry(node, struct gameport_event, node);
+       list_for_each_entry_safe(e, next, &gameport_event_list, node) {
                if (event->object == e->object) {
                        /*
                         * If this event is of different type we should not
@@ -315,7 +311,7 @@ static void gameport_remove_duplicate_events(struct gameport_event *event)
                        if (event->type != e->type)
                                break;
 
-                       list_del_init(node);
+                       list_del_init(&e->node);
                        gameport_free_event(e);
                }
        }
@@ -325,23 +321,18 @@ static void gameport_remove_duplicate_events(struct gameport_event *event)
 
 static struct gameport_event *gameport_get_event(void)
 {
-       struct gameport_event *event;
-       struct list_head *node;
+       struct gameport_event *event = NULL;
        unsigned long flags;
 
        spin_lock_irqsave(&gameport_event_lock, flags);
 
-       if (list_empty(&gameport_event_list)) {
-               spin_unlock_irqrestore(&gameport_event_lock, flags);
-               return NULL;
+       if (!list_empty(&gameport_event_list)) {
+               event = list_first_entry(&gameport_event_list,
+                                        struct gameport_event, node);
+               list_del_init(&event->node);
        }
 
-       node = gameport_event_list.next;
-       event = list_entry(node, struct gameport_event, node);
-       list_del_init(node);
-
        spin_unlock_irqrestore(&gameport_event_lock, flags);
-
        return event;
 }
 
@@ -360,16 +351,14 @@ static void gameport_handle_event(void)
        if ((event = gameport_get_event())) {
 
                switch (event->type) {
-                       case GAMEPORT_REGISTER_PORT:
-                               gameport_add_port(event->object);
-                               break;
 
-                       case GAMEPORT_ATTACH_DRIVER:
-                               gameport_attach_driver(event->object);
-                               break;
+               case GAMEPORT_REGISTER_PORT:
+                       gameport_add_port(event->object);
+                       break;
 
-                       default:
-                               break;
+               case GAMEPORT_ATTACH_DRIVER:
+                       gameport_attach_driver(event->object);
+                       break;
                }
 
                gameport_remove_duplicate_events(event);
@@ -385,16 +374,14 @@ static void gameport_handle_event(void)
  */
 static void gameport_remove_pending_events(void *object)
 {
-       struct list_head *node, *next;
-       struct gameport_event *event;
+       struct gameport_event *event, *next;
        unsigned long flags;
 
        spin_lock_irqsave(&gameport_event_lock, flags);
 
-       list_for_each_safe(node, next, &gameport_event_list) {
-               event = list_entry(node, struct gameport_event, node);
+       list_for_each_entry_safe(event, next, &gameport_event_list, node) {
                if (event->object == object) {
-                       list_del_init(node);
+                       list_del_init(&event->node);
                        gameport_free_event(event);
                }
        }
@@ -441,7 +428,6 @@ static int gameport_thread(void *nothing)
                        kthread_should_stop() || !list_empty(&gameport_event_list));
        } while (!kthread_should_stop());
 
-       printk(KERN_DEBUG "gameport: kgameportd exiting\n");
        return 0;
 }
 
@@ -453,6 +439,7 @@ static int gameport_thread(void *nothing)
 static ssize_t gameport_show_description(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct gameport *gameport = to_gameport_port(dev);
+
        return sprintf(buf, "%s\n", gameport->name);
 }
 
@@ -521,7 +508,8 @@ static void gameport_init_port(struct gameport *gameport)
 
        mutex_init(&gameport->drv_mutex);
        device_initialize(&gameport->dev);
-       dev_set_name(&gameport->dev, "gameport%lu", (unsigned long)atomic_inc_return(&gameport_no) - 1);
+       dev_set_name(&gameport->dev, "gameport%lu",
+                       (unsigned long)atomic_inc_return(&gameport_no) - 1);
        gameport->dev.bus = &gameport_bus;
        gameport->dev.release = gameport_release_port;
        if (gameport->parent)
@@ -550,19 +538,17 @@ static void gameport_add_port(struct gameport *gameport)
        list_add_tail(&gameport->node, &gameport_list);
 
        if (gameport->io)
-               printk(KERN_INFO "gameport: %s is %s, io %#x, speed %dkHz\n",
-                       gameport->name, gameport->phys, gameport->io, gameport->speed);
+               dev_info(&gameport->dev, "%s is %s, io %#x, speed %dkHz\n",
+                        gameport->name, gameport->phys, gameport->io, gameport->speed);
        else
-               printk(KERN_INFO "gameport: %s is %s, speed %dkHz\n",
+               dev_info(&gameport->dev, "%s is %s, speed %dkHz\n",
                        gameport->name, gameport->phys, gameport->speed);
 
        error = device_add(&gameport->dev);
        if (error)
-               printk(KERN_ERR
-                       "gameport: device_add() failed for %s (%s), error: %d\n",
+               dev_err(&gameport->dev,
+                       "device_add() failed for %s (%s), error: %d\n",
                        gameport->phys, gameport->name, error);
-       else
-               gameport->registered = 1;
 }
 
 /*
@@ -584,10 +570,8 @@ static void gameport_destroy_port(struct gameport *gameport)
                gameport->parent = NULL;
        }
 
-       if (gameport->registered) {
+       if (device_is_registered(&gameport->dev))
                device_del(&gameport->dev);
-               gameport->registered = 0;
-       }
 
        list_del_init(&gameport->node);
 
@@ -705,8 +689,7 @@ static void gameport_attach_driver(struct gameport_driver *drv)
 
        error = driver_attach(&drv->driver);
        if (error)
-               printk(KERN_ERR
-                       "gameport: driver_attach() failed for %s, error: %d\n",
+               pr_err("driver_attach() failed for %s, error: %d\n",
                        drv->driver.name, error);
 }
 
@@ -727,8 +710,7 @@ int __gameport_register_driver(struct gameport_driver *drv, struct module *owner
 
        error = driver_register(&drv->driver);
        if (error) {
-               printk(KERN_ERR
-                       "gameport: driver_register() failed for %s, error: %d\n",
+               pr_err("driver_register() failed for %s, error: %d\n",
                        drv->driver.name, error);
                return error;
        }
@@ -828,7 +810,7 @@ static int __init gameport_init(void)
 
        error = bus_register(&gameport_bus);
        if (error) {
-               printk(KERN_ERR "gameport: failed to register gameport bus, error: %d\n", error);
+               pr_err("failed to register gameport bus, error: %d\n", error);
                return error;
        }
 
@@ -836,7 +818,7 @@ static int __init gameport_init(void)
        if (IS_ERR(gameport_task)) {
                bus_unregister(&gameport_bus);
                error = PTR_ERR(gameport_task);
-               printk(KERN_ERR "gameport: Failed to start kgameportd, error: %d\n", error);
+               pr_err("Failed to start kgameportd, error: %d\n", error);
                return error;
        }
 
index db556b7..7c21784 100644 (file)
@@ -166,7 +166,7 @@ static int ns558_isa_probe(int io)
 
 #ifdef CONFIG_PNP
 
-static struct pnp_device_id pnp_devids[] = {
+static const struct pnp_device_id pnp_devids[] = {
        { .id = "@P@0001", .driver_data = 0 }, /* ALS 100 */
        { .id = "@P@0020", .driver_data = 0 }, /* ALS 200 */
        { .id = "@P@1001", .driver_data = 0 }, /* ALS 100+ */
index 30b503b..6c161e2 100644 (file)
@@ -614,12 +614,12 @@ static int input_default_setkeycode(struct input_dev *dev,
                }
        }
 
-       clear_bit(old_keycode, dev->keybit);
-       set_bit(keycode, dev->keybit);
+       __clear_bit(old_keycode, dev->keybit);
+       __set_bit(keycode, dev->keybit);
 
        for (i = 0; i < dev->keycodemax; i++) {
                if (input_fetch_keycode(dev, i) == old_keycode) {
-                       set_bit(old_keycode, dev->keybit);
+                       __set_bit(old_keycode, dev->keybit);
                        break; /* Setting the bit twice is useless, so break */
                }
        }
@@ -677,6 +677,9 @@ int input_set_keycode(struct input_dev *dev, int scancode, int keycode)
        if (retval)
                goto out;
 
+       /* Make sure KEY_RESERVED did not get enabled. */
+       __clear_bit(KEY_RESERVED, dev->keybit);
+
        /*
         * Simulate keyup event if keycode is not present
         * in the keymap anymore
@@ -1550,6 +1553,25 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int
 }
 EXPORT_SYMBOL(input_set_capability);
 
+#define INPUT_CLEANSE_BITMASK(dev, type, bits)                         \
+       do {                                                            \
+               if (!test_bit(EV_##type, dev->evbit))                   \
+                       memset(dev->bits##bit, 0,                       \
+                               sizeof(dev->bits##bit));                \
+       } while (0)
+
+static void input_cleanse_bitmasks(struct input_dev *dev)
+{
+       INPUT_CLEANSE_BITMASK(dev, KEY, key);
+       INPUT_CLEANSE_BITMASK(dev, REL, rel);
+       INPUT_CLEANSE_BITMASK(dev, ABS, abs);
+       INPUT_CLEANSE_BITMASK(dev, MSC, msc);
+       INPUT_CLEANSE_BITMASK(dev, LED, led);
+       INPUT_CLEANSE_BITMASK(dev, SND, snd);
+       INPUT_CLEANSE_BITMASK(dev, FF, ff);
+       INPUT_CLEANSE_BITMASK(dev, SW, sw);
+}
+
 /**
  * input_register_device - register device with input core
  * @dev: device to be registered
@@ -1569,13 +1591,19 @@ int input_register_device(struct input_dev *dev)
        const char *path;
        int error;
 
+       /* Every input device generates EV_SYN/SYN_REPORT events. */
        __set_bit(EV_SYN, dev->evbit);
 
+       /* KEY_RESERVED is not supposed to be transmitted to userspace. */
+       __clear_bit(KEY_RESERVED, dev->keybit);
+
+       /* Make sure that bitmasks not mentioned in dev->evbit are clean. */
+       input_cleanse_bitmasks(dev);
+
        /*
         * If delay and period are pre-set by the driver, then autorepeating
         * is handled by the driver itself and we don't do it in input.c.
         */
-
        init_timer(&dev->timer);
        if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) {
                dev->timer.data = (long) dev;
index 8a28fb7..66be690 100644 (file)
@@ -86,9 +86,8 @@
 
 /* xbox d-pads should map to buttons, as is required for DDR pads
    but we map them to axes when possible to simplify things */
-#define MAP_DPAD_TO_BUTTONS    0
-#define MAP_DPAD_TO_AXES       1
-#define MAP_DPAD_UNKNOWN       2
+#define MAP_DPAD_TO_BUTTONS            (1 << 0)
+#define MAP_TRIGGERS_TO_BUTTONS                (1 << 1)
 
 #define XTYPE_XBOX        0
 #define XTYPE_XBOX360     1
@@ -99,57 +98,61 @@ static int dpad_to_buttons;
 module_param(dpad_to_buttons, bool, S_IRUGO);
 MODULE_PARM_DESC(dpad_to_buttons, "Map D-PAD to buttons rather than axes for unknown pads");
 
+static int triggers_to_buttons;
+module_param(triggers_to_buttons, bool, S_IRUGO);
+MODULE_PARM_DESC(triggers_to_buttons, "Map triggers to buttons rather than axes for unknown pads");
+
 static const struct xpad_device {
        u16 idVendor;
        u16 idProduct;
        char *name;
-       u8 dpad_mapping;
+       u8 mapping;
        u8 xtype;
 } xpad_device[] = {
-       { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x045e, 0x0287, "Microsoft Xbox Controller S", MAP_DPAD_TO_AXES, XTYPE_XBOX },
+       { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", 0, XTYPE_XBOX },
+       { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", 0, XTYPE_XBOX },
+       { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", 0, XTYPE_XBOX },
+       { 0x045e, 0x0287, "Microsoft Xbox Controller S", 0, XTYPE_XBOX },
        { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
        { 0x0c12, 0x8809, "RedOctane Xbox Dance Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
-       { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x046d, 0xc242, "Logitech Chillstream Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
-       { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x05fd, 0x1007, "Mad Catz Controller (unverified)", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0738, 0x4516, "Mad Catz Control Pad", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0738, 0x4522, "Mad Catz LumiCON", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0738, 0x4526, "Mad Catz Control Pad Pro", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0738, 0x4536, "Mad Catz MicroCON", MAP_DPAD_TO_AXES, XTYPE_XBOX },
+       { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX },
+       { 0x046d, 0xc242, "Logitech Chillstream Controller", 0, XTYPE_XBOX360 },
+       { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", 0, XTYPE_XBOX },
+       { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", 0, XTYPE_XBOX },
+       { 0x05fd, 0x1007, "Mad Catz Controller (unverified)", 0, XTYPE_XBOX },
+       { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", 0, XTYPE_XBOX },
+       { 0x0738, 0x4516, "Mad Catz Control Pad", 0, XTYPE_XBOX },
+       { 0x0738, 0x4522, "Mad Catz LumiCON", 0, XTYPE_XBOX },
+       { 0x0738, 0x4526, "Mad Catz Control Pad Pro", 0, XTYPE_XBOX },
+       { 0x0738, 0x4536, "Mad Catz MicroCON", 0, XTYPE_XBOX },
        { 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
-       { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
-       { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
+       { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", 0, XTYPE_XBOX },
+       { 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", 0, XTYPE_XBOX360 },
+       { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
        { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
-       { 0x0c12, 0x8802, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0c12, 0x8810, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0e4c, 0x1097, "Radica Gamester Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0e4c, 0x2390, "Radica Games Jtech Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0e6f, 0x0005, "Eclipse wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0e6f, 0x0006, "Edge wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0e6f, 0x0006, "Pelican 'TSZ' Wired Xbox 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
-       { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0f30, 0x0202, "Joytech Advanced Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
+       { 0x0c12, 0x8802, "Zeroplus Xbox Controller", 0, XTYPE_XBOX },
+       { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", 0, XTYPE_XBOX },
+       { 0x0c12, 0x8810, "Zeroplus Xbox Controller", 0, XTYPE_XBOX },
+       { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", 0, XTYPE_XBOX },
+       { 0x0e4c, 0x1097, "Radica Gamester Controller", 0, XTYPE_XBOX },
+       { 0x0e4c, 0x2390, "Radica Games Jtech Controller", 0, XTYPE_XBOX },
+       { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", 0, XTYPE_XBOX },
+       { 0x0e6f, 0x0005, "Eclipse wireless Controller", 0, XTYPE_XBOX },
+       { 0x0e6f, 0x0006, "Edge wireless Controller", 0, XTYPE_XBOX },
+       { 0x0e6f, 0x0006, "Pelican 'TSZ' Wired Xbox 360 Controller", 0, XTYPE_XBOX360 },
+       { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX },
+       { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX },
+       { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX },
+       { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX },
        { 0x12ab, 0x8809, "Xbox DDR dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
-       { 0x1430, 0x4748, "RedOctane Guitar Hero X-plorer", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
+       { 0x1430, 0x4748, "RedOctane Guitar Hero X-plorer", 0, XTYPE_XBOX360 },
        { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
-       { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
-       { 0x045e, 0x028e, "Microsoft X-Box 360 pad", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
+       { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 },
+       { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 },
        { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
-       { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
-       { 0xffff, 0xffff, "Chinese-made Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0000, 0x0000, "Generic X-Box pad", MAP_DPAD_UNKNOWN, XTYPE_UNKNOWN }
+       { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
+       { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX },
+       { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN }
 };
 
 /* buttons shared with xbox and xbox360 */
@@ -165,13 +168,20 @@ static const signed short xpad_btn[] = {
        -1                      /* terminating entry */
 };
 
-/* only used if MAP_DPAD_TO_BUTTONS */
+/* used when dpad is mapped to nuttons */
 static const signed short xpad_btn_pad[] = {
        BTN_LEFT, BTN_RIGHT,            /* d-pad left, right */
        BTN_0, BTN_1,                   /* d-pad up, down (XXX names??) */
        -1                              /* terminating entry */
 };
 
+/* used when triggers are mapped to buttons */
+static const signed short xpad_btn_triggers[] = {
+       BTN_TL2, BTN_TR2,               /* triggers left/right */
+       -1
+};
+
+
 static const signed short xpad360_btn[] = {  /* buttons for x360 controller */
        BTN_TL, BTN_TR,         /* Button LB/RB */
        BTN_MODE,               /* The big X button */
@@ -181,16 +191,21 @@ static const signed short xpad360_btn[] = {  /* buttons for x360 controller */
 static const signed short xpad_abs[] = {
        ABS_X, ABS_Y,           /* left stick */
        ABS_RX, ABS_RY,         /* right stick */
-       ABS_Z, ABS_RZ,          /* triggers left/right */
        -1                      /* terminating entry */
 };
 
-/* only used if MAP_DPAD_TO_AXES */
+/* used when dpad is mapped to axes */
 static const signed short xpad_abs_pad[] = {
        ABS_HAT0X, ABS_HAT0Y,   /* d-pad axes */
        -1                      /* terminating entry */
 };
 
+/* used when triggers are mapped to axes */
+static const signed short xpad_abs_triggers[] = {
+       ABS_Z, ABS_RZ,          /* triggers left/right */
+       -1
+};
+
 /* Xbox 360 has a vendor-specific class, so we cannot match it with only
  * USB_INTERFACE_INFO (also specifically refused by USB subsystem), so we
  * match against vendor id as well. Wired Xbox 360 devices have protocol 1,
@@ -246,7 +261,7 @@ struct usb_xpad {
 
        char phys[64];                  /* physical device path */
 
-       int dpad_mapping;               /* map d-pad to buttons or to axes */
+       int mapping;                    /* map d-pad to buttons or to axes */
        int xtype;                      /* type of xbox device */
 };
 
@@ -277,20 +292,25 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d
                         ~(__s16) le16_to_cpup((__le16 *)(data + 18)));
 
        /* triggers left/right */
-       input_report_abs(dev, ABS_Z, data[10]);
-       input_report_abs(dev, ABS_RZ, data[11]);
+       if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) {
+               input_report_key(dev, BTN_TL2, data[10]);
+               input_report_key(dev, BTN_TR2, data[11]);
+       } else {
+               input_report_abs(dev, ABS_Z, data[10]);
+               input_report_abs(dev, ABS_RZ, data[11]);
+       }
 
        /* digital pad */
-       if (xpad->dpad_mapping == MAP_DPAD_TO_AXES) {
-               input_report_abs(dev, ABS_HAT0X,
-                                !!(data[2] & 0x08) - !!(data[2] & 0x04));
-               input_report_abs(dev, ABS_HAT0Y,
-                                !!(data[2] & 0x02) - !!(data[2] & 0x01));
-       } else /* xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS */ {
+       if (xpad->mapping & MAP_DPAD_TO_BUTTONS) {
                input_report_key(dev, BTN_LEFT,  data[2] & 0x04);
                input_report_key(dev, BTN_RIGHT, data[2] & 0x08);
                input_report_key(dev, BTN_0,     data[2] & 0x01); /* up */
                input_report_key(dev, BTN_1,     data[2] & 0x02); /* down */
+       } else {
+               input_report_abs(dev, ABS_HAT0X,
+                                !!(data[2] & 0x08) - !!(data[2] & 0x04));
+               input_report_abs(dev, ABS_HAT0Y,
+                                !!(data[2] & 0x02) - !!(data[2] & 0x01));
        }
 
        /* start/back buttons and stick press left/right */
@@ -328,17 +348,17 @@ static void xpad360_process_packet(struct usb_xpad *xpad,
        struct input_dev *dev = xpad->dev;
 
        /* digital pad */
-       if (xpad->dpad_mapping == MAP_DPAD_TO_AXES) {
-               input_report_abs(dev, ABS_HAT0X,
-                                !!(data[2] & 0x08) - !!(data[2] & 0x04));
-               input_report_abs(dev, ABS_HAT0Y,
-                                !!(data[2] & 0x02) - !!(data[2] & 0x01));
-       } else if (xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS) {
+       if (xpad->mapping & MAP_DPAD_TO_BUTTONS) {
                /* dpad as buttons (right, left, down, up) */
                input_report_key(dev, BTN_LEFT, data[2] & 0x04);
                input_report_key(dev, BTN_RIGHT, data[2] & 0x08);
                input_report_key(dev, BTN_0, data[2] & 0x01);   /* up */
                input_report_key(dev, BTN_1, data[2] & 0x02);   /* down */
+       } else {
+               input_report_abs(dev, ABS_HAT0X,
+                                !!(data[2] & 0x08) - !!(data[2] & 0x04));
+               input_report_abs(dev, ABS_HAT0Y,
+                                !!(data[2] & 0x02) - !!(data[2] & 0x01));
        }
 
        /* start/back buttons */
@@ -371,8 +391,13 @@ static void xpad360_process_packet(struct usb_xpad *xpad,
                         ~(__s16) le16_to_cpup((__le16 *)(data + 12)));
 
        /* triggers left/right */
-       input_report_abs(dev, ABS_Z, data[4]);
-       input_report_abs(dev, ABS_RZ, data[5]);
+       if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) {
+               input_report_key(dev, BTN_TL2, data[4]);
+               input_report_key(dev, BTN_TR2, data[5]);
+       } else {
+               input_report_abs(dev, ABS_Z, data[4]);
+               input_report_abs(dev, ABS_RZ, data[5]);
+       }
 
        input_sync(dev);
 }
@@ -712,11 +737,11 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs)
                input_set_abs_params(input_dev, abs, -32768, 32767, 16, 128);
                break;
        case ABS_Z:
-       case ABS_RZ:    /* the triggers */
+       case ABS_RZ:    /* the triggers (if mapped to axes) */
                input_set_abs_params(input_dev, abs, 0, 255, 0, 0);
                break;
        case ABS_HAT0X:
-       case ABS_HAT0Y: /* the d-pad (only if MAP_DPAD_TO_AXES) */
+       case ABS_HAT0Y: /* the d-pad (only if dpad is mapped to axes */
                input_set_abs_params(input_dev, abs, -1, 1, 0, 0);
                break;
        }
@@ -752,10 +777,9 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
                goto fail2;
 
        xpad->udev = udev;
-       xpad->dpad_mapping = xpad_device[i].dpad_mapping;
+       xpad->mapping = xpad_device[i].mapping;
        xpad->xtype = xpad_device[i].xtype;
-       if (xpad->dpad_mapping == MAP_DPAD_UNKNOWN)
-               xpad->dpad_mapping = !dpad_to_buttons;
+
        if (xpad->xtype == XTYPE_UNKNOWN) {
                if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) {
                        if (intf->cur_altsetting->desc.bInterfaceProtocol == 129)
@@ -764,7 +788,13 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
                                xpad->xtype = XTYPE_XBOX360;
                } else
                        xpad->xtype = XTYPE_XBOX;
+
+               if (dpad_to_buttons)
+                       xpad->mapping |= MAP_DPAD_TO_BUTTONS;
+               if (triggers_to_buttons)
+                       xpad->mapping |= MAP_TRIGGERS_TO_BUTTONS;
        }
+
        xpad->dev = input_dev;
        usb_make_path(udev, xpad->phys, sizeof(xpad->phys));
        strlcat(xpad->phys, "/input0", sizeof(xpad->phys));
@@ -781,25 +811,37 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
 
        input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
 
-       /* set up buttons */
+       /* set up standard buttons and axes */
        for (i = 0; xpad_common_btn[i] >= 0; i++)
-               set_bit(xpad_common_btn[i], input_dev->keybit);
-       if ((xpad->xtype == XTYPE_XBOX360) || (xpad->xtype == XTYPE_XBOX360W))
-               for (i = 0; xpad360_btn[i] >= 0; i++)
-                       set_bit(xpad360_btn[i], input_dev->keybit);
-       else
-               for (i = 0; xpad_btn[i] >= 0; i++)
-                       set_bit(xpad_btn[i], input_dev->keybit);
-       if (xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS)
-               for (i = 0; xpad_btn_pad[i] >= 0; i++)
-                       set_bit(xpad_btn_pad[i], input_dev->keybit);
+               __set_bit(xpad_common_btn[i], input_dev->keybit);
 
-       /* set up axes */
        for (i = 0; xpad_abs[i] >= 0; i++)
                xpad_set_up_abs(input_dev, xpad_abs[i]);
-       if (xpad->dpad_mapping == MAP_DPAD_TO_AXES)
+
+       /* Now set up model-specific ones */
+       if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX360W) {
+               for (i = 0; xpad360_btn[i] >= 0; i++)
+                       __set_bit(xpad360_btn[i], input_dev->keybit);
+       } else {
+               for (i = 0; xpad_btn[i] >= 0; i++)
+                       __set_bit(xpad_btn[i], input_dev->keybit);
+       }
+
+       if (xpad->mapping & MAP_DPAD_TO_BUTTONS) {
+               for (i = 0; xpad_btn_pad[i] >= 0; i++)
+                       __set_bit(xpad_btn_pad[i], input_dev->keybit);
+       } else {
                for (i = 0; xpad_abs_pad[i] >= 0; i++)
                    xpad_set_up_abs(input_dev, xpad_abs_pad[i]);
+       }
+
+       if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) {
+               for (i = 0; xpad_btn_triggers[i] >= 0; i++)
+                       __set_bit(xpad_btn_triggers[i], input_dev->keybit);
+       } else {
+               for (i = 0; xpad_abs_triggers[i] >= 0; i++)
+                       xpad_set_up_abs(input_dev, xpad_abs_triggers[i]);
+       }
 
        error = xpad_init_output(intf, xpad);
        if (error)
index 02c836e..c72283c 100644 (file)
@@ -35,10 +35,10 @@ config KEYBOARD_ADP5520
          be called adp5520-keys.
 
 config KEYBOARD_ADP5588
-       tristate "ADP5588 I2C QWERTY Keypad and IO Expander"
+       tristate "ADP5588/87 I2C QWERTY Keypad and IO Expander"
        depends on I2C
        help
-         Say Y here if you want to use a ADP5588 attached to your
+         Say Y here if you want to use a ADP5588/87 attached to your
          system I2C bus.
 
          To compile this driver as a module, choose M here: the
index 1edb596..b5142d2 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * File: drivers/input/keyboard/adp5588_keys.c
- * Description:  keypad driver for ADP5588 I2C QWERTY Keypad and IO Expander
+ * Description:  keypad driver for ADP5588 and ADP5587
+ *              I2C QWERTY Keypad and IO Expander
  * Bugs: Enter bugs at http://blackfin.uclinux.org/
  *
  * Copyright (C) 2008-2009 Analog Devices Inc.
@@ -327,6 +328,7 @@ static const struct dev_pm_ops adp5588_dev_pm_ops = {
 
 static const struct i2c_device_id adp5588_id[] = {
        { KBUILD_MODNAME, 0 },
+       { "adp5587-keys", 0 },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, adp5588_id);
@@ -357,5 +359,5 @@ module_exit(adp5588_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
-MODULE_DESCRIPTION("ADP5588 Keypad driver");
+MODULE_DESCRIPTION("ADP5588/87 Keypad driver");
 MODULE_ALIAS("platform:adp5588-keys");
index 7b40562..326875b 100644 (file)
@@ -40,26 +40,26 @@ module_param_named(set, atkbd_set, int, 0);
 MODULE_PARM_DESC(set, "Select keyboard code set (2 = default, 3 = PS/2 native)");
 
 #if defined(__i386__) || defined(__x86_64__) || defined(__hppa__)
-static int atkbd_reset;
+static bool atkbd_reset;
 #else
-static int atkbd_reset = 1;
+static bool atkbd_reset = true;
 #endif
 module_param_named(reset, atkbd_reset, bool, 0);
 MODULE_PARM_DESC(reset, "Reset keyboard during initialization");
 
-static int atkbd_softrepeat;
+static bool atkbd_softrepeat;
 module_param_named(softrepeat, atkbd_softrepeat, bool, 0);
 MODULE_PARM_DESC(softrepeat, "Use software keyboard repeat");
 
-static int atkbd_softraw = 1;
+static bool atkbd_softraw = true;
 module_param_named(softraw, atkbd_softraw, bool, 0);
 MODULE_PARM_DESC(softraw, "Use software generated rawmode");
 
-static int atkbd_scroll;
+static bool atkbd_scroll;
 module_param_named(scroll, atkbd_scroll, bool, 0);
 MODULE_PARM_DESC(scroll, "Enable scroll-wheel on MS Office and similar keyboards");
 
-static int atkbd_extra;
+static bool atkbd_extra;
 module_param_named(extra, atkbd_extra, bool, 0);
 MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and similar keyboards");
 
@@ -206,18 +206,18 @@ struct atkbd {
        unsigned short keycode[ATKBD_KEYMAP_SIZE];
        DECLARE_BITMAP(force_release_mask, ATKBD_KEYMAP_SIZE);
        unsigned char set;
-       unsigned char translated;
-       unsigned char extra;
-       unsigned char write;
-       unsigned char softrepeat;
-       unsigned char softraw;
-       unsigned char scroll;
-       unsigned char enabled;
+       bool translated;
+       bool extra;
+       bool write;
+       bool softrepeat;
+       bool softraw;
+       bool scroll;
+       bool enabled;
 
        /* Accessed only from interrupt */
        unsigned char emul;
-       unsigned char resend;
-       unsigned char release;
+       bool resend;
+       bool release;
        unsigned long xl_bit;
        unsigned int last;
        unsigned long time;
@@ -301,18 +301,18 @@ static const unsigned int xl_table[] = {
  * Checks if we should mangle the scancode to extract 'release' bit
  * in translated mode.
  */
-static int atkbd_need_xlate(unsigned long xl_bit, unsigned char code)
+static bool atkbd_need_xlate(unsigned long xl_bit, unsigned char code)
 {
        int i;
 
        if (code == ATKBD_RET_EMUL0 || code == ATKBD_RET_EMUL1)
-               return 0;
+               return false;
 
        for (i = 0; i < ARRAY_SIZE(xl_table); i++)
                if (code == xl_table[i])
                        return test_bit(i, &xl_bit);
 
-       return 1;
+       return true;
 }
 
 /*
@@ -359,7 +359,7 @@ static unsigned int atkbd_compat_scancode(struct atkbd *atkbd, unsigned int code
  */
 
 static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
-                       unsigned int flags)
+                                  unsigned int flags)
 {
        struct atkbd *atkbd = serio_get_drvdata(serio);
        struct input_dev *dev = atkbd->dev;
@@ -368,20 +368,18 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
        int value;
        unsigned short keycode;
 
-#ifdef ATKBD_DEBUG
-       printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags);
-#endif
+       dev_dbg(&serio->dev, "Received %02x flags %02x\n", data, flags);
 
 #if !defined(__i386__) && !defined (__x86_64__)
        if ((flags & (SERIO_FRAME | SERIO_PARITY)) && (~flags & SERIO_TIMEOUT) && !atkbd->resend && atkbd->write) {
-               printk(KERN_WARNING "atkbd.c: frame/parity error: %02x\n", flags);
+               dev_warn(&serio->dev, "Frame/parity error: %02x\n", flags);
                serio_write(serio, ATKBD_CMD_RESEND);
-               atkbd->resend = 1;
+               atkbd->resend = true;
                goto out;
        }
 
        if (!flags && data == ATKBD_RET_ACK)
-               atkbd->resend = 0;
+               atkbd->resend = false;
 #endif
 
        if (unlikely(atkbd->ps2dev.flags & PS2_FLAG_ACK))
@@ -412,32 +410,32 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
        }
 
        switch (code) {
-               case ATKBD_RET_BAT:
-                       atkbd->enabled = 0;
-                       serio_reconnect(atkbd->ps2dev.serio);
-                       goto out;
-               case ATKBD_RET_EMUL0:
-                       atkbd->emul = 1;
-                       goto out;
-               case ATKBD_RET_EMUL1:
-                       atkbd->emul = 2;
-                       goto out;
-               case ATKBD_RET_RELEASE:
-                       atkbd->release = 1;
-                       goto out;
-               case ATKBD_RET_ACK:
-               case ATKBD_RET_NAK:
-                       if (printk_ratelimit())
-                               printk(KERN_WARNING "atkbd.c: Spurious %s on %s. "
-                                      "Some program might be trying access hardware directly.\n",
-                                      data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys);
-                       goto out;
-               case ATKBD_RET_ERR:
-                       atkbd->err_count++;
-#ifdef ATKBD_DEBUG
-                       printk(KERN_DEBUG "atkbd.c: Keyboard on %s reports too many keys pressed.\n", serio->phys);
-#endif
-                       goto out;
+       case ATKBD_RET_BAT:
+               atkbd->enabled = false;
+               serio_reconnect(atkbd->ps2dev.serio);
+               goto out;
+       case ATKBD_RET_EMUL0:
+               atkbd->emul = 1;
+               goto out;
+       case ATKBD_RET_EMUL1:
+               atkbd->emul = 2;
+               goto out;
+       case ATKBD_RET_RELEASE:
+               atkbd->release = true;
+               goto out;
+       case ATKBD_RET_ACK:
+       case ATKBD_RET_NAK:
+               if (printk_ratelimit())
+                       dev_warn(&serio->dev,
+                                "Spurious %s on %s. "
+                                "Some program might be trying access hardware directly.\n",
+                                data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys);
+               goto out;
+       case ATKBD_RET_ERR:
+               atkbd->err_count++;
+               dev_dbg(&serio->dev, "Keyboard on %s reports too many keys pressed.\n",
+                       serio->phys);
+               goto out;
        }
 
        code = atkbd_compat_scancode(atkbd, code);
@@ -451,71 +449,72 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
                input_event(dev, EV_MSC, MSC_SCAN, code);
 
        switch (keycode) {
-               case ATKBD_KEY_NULL:
-                       break;
-               case ATKBD_KEY_UNKNOWN:
-                       printk(KERN_WARNING
-                              "atkbd.c: Unknown key %s (%s set %d, code %#x on %s).\n",
-                              atkbd->release ? "released" : "pressed",
-                              atkbd->translated ? "translated" : "raw",
-                              atkbd->set, code, serio->phys);
-                       printk(KERN_WARNING
-                              "atkbd.c: Use 'setkeycodes %s%02x <keycode>' to make it known.\n",
-                              code & 0x80 ? "e0" : "", code & 0x7f);
-                       input_sync(dev);
-                       break;
-               case ATKBD_SCR_1:
-                       scroll = 1 - atkbd->release * 2;
-                       break;
-               case ATKBD_SCR_2:
-                       scroll = 2 - atkbd->release * 4;
-                       break;
-               case ATKBD_SCR_4:
-                       scroll = 4 - atkbd->release * 8;
-                       break;
-               case ATKBD_SCR_8:
-                       scroll = 8 - atkbd->release * 16;
-                       break;
-               case ATKBD_SCR_CLICK:
-                       click = !atkbd->release;
-                       break;
-               case ATKBD_SCR_LEFT:
-                       hscroll = -1;
-                       break;
-               case ATKBD_SCR_RIGHT:
-                       hscroll = 1;
-                       break;
-               default:
-                       if (atkbd->release) {
-                               value = 0;
-                               atkbd->last = 0;
-                       } else if (!atkbd->softrepeat && test_bit(keycode, dev->key)) {
-                               /* Workaround Toshiba laptop multiple keypress */
-                               value = time_before(jiffies, atkbd->time) && atkbd->last == code ? 1 : 2;
-                       } else {
-                               value = 1;
-                               atkbd->last = code;
-                               atkbd->time = jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]) / 2;
-                       }
-
-                       input_event(dev, EV_KEY, keycode, value);
-                       input_sync(dev);
+       case ATKBD_KEY_NULL:
+               break;
+       case ATKBD_KEY_UNKNOWN:
+               dev_warn(&serio->dev,
+                        "Unknown key %s (%s set %d, code %#x on %s).\n",
+                        atkbd->release ? "released" : "pressed",
+                        atkbd->translated ? "translated" : "raw",
+                        atkbd->set, code, serio->phys);
+               dev_warn(&serio->dev,
+                        "Use 'setkeycodes %s%02x <keycode>' to make it known.\n",
+                        code & 0x80 ? "e0" : "", code & 0x7f);
+               input_sync(dev);
+               break;
+       case ATKBD_SCR_1:
+               scroll = 1;
+               break;
+       case ATKBD_SCR_2:
+               scroll = 2;
+               break;
+       case ATKBD_SCR_4:
+               scroll = 4;
+               break;
+       case ATKBD_SCR_8:
+               scroll = 8;
+               break;
+       case ATKBD_SCR_CLICK:
+               click = !atkbd->release;
+               break;
+       case ATKBD_SCR_LEFT:
+               hscroll = -1;
+               break;
+       case ATKBD_SCR_RIGHT:
+               hscroll = 1;
+               break;
+       default:
+               if (atkbd->release) {
+                       value = 0;
+                       atkbd->last = 0;
+               } else if (!atkbd->softrepeat && test_bit(keycode, dev->key)) {
+                       /* Workaround Toshiba laptop multiple keypress */
+                       value = time_before(jiffies, atkbd->time) && atkbd->last == code ? 1 : 2;
+               } else {
+                       value = 1;
+                       atkbd->last = code;
+                       atkbd->time = jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]) / 2;
+               }
+
+               input_event(dev, EV_KEY, keycode, value);
+               input_sync(dev);
 
-                       if (value && test_bit(code, atkbd->force_release_mask)) {
-                               input_report_key(dev, keycode, 0);
-                               input_sync(dev);
-                       }
+               if (value && test_bit(code, atkbd->force_release_mask)) {
+                       input_report_key(dev, keycode, 0);
+                       input_sync(dev);
+               }
        }
 
        if (atkbd->scroll) {
                if (click != -1)
                        input_report_key(dev, BTN_MIDDLE, click);
-               input_report_rel(dev, REL_WHEEL, scroll);
+               input_report_rel(dev, REL_WHEEL,
+                                atkbd->release ? -scroll : scroll);
                input_report_rel(dev, REL_HWHEEL, hscroll);
                input_sync(dev);
        }
 
-       atkbd->release = 0;
+       atkbd->release = false;
 out:
        return IRQ_HANDLED;
 }
@@ -634,17 +633,18 @@ static int atkbd_event(struct input_dev *dev,
 
        switch (type) {
 
-               case EV_LED:
-                       atkbd_schedule_event_work(atkbd, ATKBD_LED_EVENT_BIT);
-                       return 0;
+       case EV_LED:
+               atkbd_schedule_event_work(atkbd, ATKBD_LED_EVENT_BIT);
+               return 0;
 
-               case EV_REP:
-                       if (!atkbd->softrepeat)
-                               atkbd_schedule_event_work(atkbd, ATKBD_REP_EVENT_BIT);
-                       return 0;
-       }
+       case EV_REP:
+               if (!atkbd->softrepeat)
+                       atkbd_schedule_event_work(atkbd, ATKBD_REP_EVENT_BIT);
+               return 0;
 
-       return -1;
+       default:
+               return -1;
+       }
 }
 
 /*
@@ -655,7 +655,7 @@ static int atkbd_event(struct input_dev *dev,
 static inline void atkbd_enable(struct atkbd *atkbd)
 {
        serio_pause_rx(atkbd->ps2dev.serio);
-       atkbd->enabled = 1;
+       atkbd->enabled = true;
        serio_continue_rx(atkbd->ps2dev.serio);
 }
 
@@ -667,7 +667,7 @@ static inline void atkbd_enable(struct atkbd *atkbd)
 static inline void atkbd_disable(struct atkbd *atkbd)
 {
        serio_pause_rx(atkbd->ps2dev.serio);
-       atkbd->enabled = 0;
+       atkbd->enabled = false;
        serio_continue_rx(atkbd->ps2dev.serio);
 }
 
@@ -688,7 +688,9 @@ static int atkbd_probe(struct atkbd *atkbd)
 
        if (atkbd_reset)
                if (ps2_command(ps2dev, NULL, ATKBD_CMD_RESET_BAT))
-                       printk(KERN_WARNING "atkbd.c: keyboard reset failed on %s\n", ps2dev->serio->phys);
+                       dev_warn(&ps2dev->serio->dev,
+                                "keyboard reset failed on %s\n",
+                                ps2dev->serio->phys);
 
 /*
  * Then we check the keyboard ID. We should get 0xab83 under normal conditions.
@@ -718,8 +720,9 @@ static int atkbd_probe(struct atkbd *atkbd)
        atkbd->id = (param[0] << 8) | param[1];
 
        if (atkbd->id == 0xaca1 && atkbd->translated) {
-               printk(KERN_ERR "atkbd.c: NCD terminal keyboards are only supported on non-translating\n");
-               printk(KERN_ERR "atkbd.c: controllers. Use i8042.direct=1 to disable translation.\n");
+               dev_err(&ps2dev->serio->dev,
+                       "NCD terminal keyboards are only supported on non-translating controlelrs. "
+                       "Use i8042.direct=1 to disable translation.\n");
                return -1;
        }
 
@@ -737,7 +740,7 @@ static int atkbd_select_set(struct atkbd *atkbd, int target_set, int allow_extra
        struct ps2dev *ps2dev = &atkbd->ps2dev;
        unsigned char param[2];
 
-       atkbd->extra = 0;
+       atkbd->extra = false;
 /*
  * For known special keyboards we can go ahead and set the correct set.
  * We check for NCD PS/2 Sun, NorthGate OmniKey 101 and
@@ -756,7 +759,7 @@ static int atkbd_select_set(struct atkbd *atkbd, int target_set, int allow_extra
        if (allow_extra) {
                param[0] = 0x71;
                if (!ps2_command(ps2dev, param, ATKBD_CMD_EX_ENABLE)) {
-                       atkbd->extra = 1;
+                       atkbd->extra = true;
                        return 2;
                }
        }
@@ -821,7 +824,8 @@ static int atkbd_activate(struct atkbd *atkbd)
  */
 
        if (ps2_command(ps2dev, NULL, ATKBD_CMD_ENABLE)) {
-               printk(KERN_ERR "atkbd.c: Failed to enable keyboard on %s\n",
+               dev_err(&ps2dev->serio->dev,
+                       "Failed to enable keyboard on %s\n",
                        ps2dev->serio->phys);
                return -1;
        }
@@ -1100,12 +1104,14 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv)
 
        switch (serio->id.type) {
 
-               case SERIO_8042_XL:
-                       atkbd->translated = 1;
-               case SERIO_8042:
-                       if (serio->write)
-                               atkbd->write = 1;
-                       break;
+       case SERIO_8042_XL:
+               atkbd->translated = true;
+               /* Fall through */
+
+       case SERIO_8042:
+               if (serio->write)
+                       atkbd->write = true;
+               break;
        }
 
        atkbd->softraw = atkbd_softraw;
@@ -1113,7 +1119,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv)
        atkbd->scroll = atkbd_scroll;
 
        if (atkbd->softrepeat)
-               atkbd->softraw = 1;
+               atkbd->softraw = true;
 
        serio_set_drvdata(serio, atkbd);
 
@@ -1172,7 +1178,8 @@ static int atkbd_reconnect(struct serio *serio)
        int retval = -1;
 
        if (!atkbd || !drv) {
-               printk(KERN_DEBUG "atkbd: reconnect request, but serio is disconnected, ignoring...\n");
+               dev_dbg(&serio->dev,
+                       "reconnect request, but serio is disconnected, ignoring...\n");
                return -1;
        }
 
@@ -1286,7 +1293,8 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun
        struct input_dev *old_dev, *new_dev;
        unsigned long value;
        int err;
-       unsigned char old_extra, old_set;
+       bool old_extra;
+       unsigned char old_set;
 
        if (!atkbd->write)
                return -EIO;
@@ -1369,7 +1377,7 @@ static ssize_t atkbd_set_scroll(struct atkbd *atkbd, const char *buf, size_t cou
        struct input_dev *old_dev, *new_dev;
        unsigned long value;
        int err;
-       unsigned char old_scroll;
+       bool old_scroll;
 
        if (strict_strtoul(buf, 10, &value) || value > 1)
                return -EINVAL;
@@ -1413,7 +1421,8 @@ static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count)
        struct input_dev *old_dev, *new_dev;
        unsigned long value;
        int err;
-       unsigned char old_set, old_extra;
+       unsigned char old_set;
+       bool old_extra;
 
        if (!atkbd->write)
                return -EIO;
@@ -1463,7 +1472,7 @@ static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t
        struct input_dev *old_dev, *new_dev;
        unsigned long value;
        int err;
-       unsigned char old_softrepeat, old_softraw;
+       bool old_softrepeat, old_softraw;
 
        if (!atkbd->write)
                return -EIO;
@@ -1483,7 +1492,7 @@ static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t
                atkbd->dev = new_dev;
                atkbd->softrepeat = value;
                if (atkbd->softrepeat)
-                       atkbd->softraw = 1;
+                       atkbd->softraw = true;
                atkbd_set_device_attrs(atkbd);
 
                err = input_register_device(atkbd->dev);
@@ -1513,7 +1522,7 @@ static ssize_t atkbd_set_softraw(struct atkbd *atkbd, const char *buf, size_t co
        struct input_dev *old_dev, *new_dev;
        unsigned long value;
        int err;
-       unsigned char old_softraw;
+       bool old_softraw;
 
        if (strict_strtoul(buf, 10, &value) || value > 1)
                return -EINVAL;
index e457404..bd25a3a 100644 (file)
@@ -69,7 +69,7 @@ struct ep93xx_keypad {
 
        void __iomem *mmio_base;
 
-       unsigned int matrix_keycodes[EP93XX_MATRIX_SIZE];
+       unsigned short keycodes[EP93XX_MATRIX_SIZE];
 
        int key1;
        int key2;
@@ -79,24 +79,6 @@ struct ep93xx_keypad {
        bool enabled;
 };
 
-static void ep93xx_keypad_build_keycode(struct ep93xx_keypad *keypad)
-{
-       struct ep93xx_keypad_platform_data *pdata = keypad->pdata;
-       struct input_dev *input_dev = keypad->input_dev;
-       unsigned int *key;
-       int i;
-
-       key = &pdata->matrix_key_map[0];
-       for (i = 0; i < pdata->matrix_key_map_size; i++, key++) {
-               int row = KEY_ROW(*key);
-               int col = KEY_COL(*key);
-               int code = KEY_VAL(*key);
-
-               keypad->matrix_keycodes[(row << 3) + col] = code;
-               __set_bit(code, input_dev->keybit);
-       }
-}
-
 static irqreturn_t ep93xx_keypad_irq_handler(int irq, void *dev_id)
 {
        struct ep93xx_keypad *keypad = dev_id;
@@ -107,10 +89,10 @@ static irqreturn_t ep93xx_keypad_irq_handler(int irq, void *dev_id)
        status = __raw_readl(keypad->mmio_base + KEY_REG);
 
        keycode = (status & KEY_REG_KEY1_MASK) >> KEY_REG_KEY1_SHIFT;
-       key1 = keypad->matrix_keycodes[keycode];
+       key1 = keypad->keycodes[keycode];
 
        keycode = (status & KEY_REG_KEY2_MASK) >> KEY_REG_KEY2_SHIFT;
-       key2 = keypad->matrix_keycodes[keycode];
+       key2 = keypad->keycodes[keycode];
 
        if (status & KEY_REG_2KEYS) {
                if (keypad->key1 && key1 != keypad->key1 && key2 != keypad->key1)
@@ -256,6 +238,7 @@ static int ep93xx_keypad_resume(struct platform_device *pdev)
 static int __devinit ep93xx_keypad_probe(struct platform_device *pdev)
 {
        struct ep93xx_keypad *keypad;
+       const struct matrix_keymap_data *keymap_data;
        struct input_dev *input_dev;
        struct resource *res;
        int err;
@@ -270,6 +253,12 @@ static int __devinit ep93xx_keypad_probe(struct platform_device *pdev)
                goto failed_free;
        }
 
+       keymap_data = keypad->pdata->keymap_data;
+       if (!keymap_data) {
+               err = -EINVAL;
+               goto failed_free;
+       }
+
        keypad->irq = platform_get_irq(pdev, 0);
        if (!keypad->irq) {
                err = -ENXIO;
@@ -317,9 +306,9 @@ static int __devinit ep93xx_keypad_probe(struct platform_device *pdev)
        input_dev->open = ep93xx_keypad_open;
        input_dev->close = ep93xx_keypad_close;
        input_dev->dev.parent = &pdev->dev;
-       input_dev->keycode = keypad->matrix_keycodes;
-       input_dev->keycodesize = sizeof(keypad->matrix_keycodes[0]);
-       input_dev->keycodemax = ARRAY_SIZE(keypad->matrix_keycodes);
+       input_dev->keycode = keypad->keycodes;
+       input_dev->keycodesize = sizeof(keypad->keycodes[0]);
+       input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes);
 
        input_set_drvdata(input_dev, keypad);
 
@@ -327,7 +316,8 @@ static int __devinit ep93xx_keypad_probe(struct platform_device *pdev)
        if (keypad->pdata->flags & EP93XX_KEYPAD_AUTOREPEAT)
                input_dev->evbit[0] |= BIT_MASK(EV_REP);
 
-       ep93xx_keypad_build_keycode(keypad);
+       matrix_keypad_build_keymap(keymap_data, 3,
+                                  input_dev->keycode, input_dev->keybit);
        platform_set_drvdata(pdev, keypad);
 
        err = request_irq(keypad->irq, ep93xx_keypad_irq_handler,
index 191cc51..31f3008 100644 (file)
@@ -362,7 +362,7 @@ static int __devexit qt2160_remove(struct i2c_client *client)
        return 0;
 }
 
-static struct i2c_device_id qt2160_idtable[] = {
+static const struct i2c_device_id qt2160_idtable[] = {
        { "qt2160", 0, },
        { }
 };
index 8e9380b..efcc3a3 100644 (file)
@@ -36,6 +36,8 @@ static const struct {
        [SH_KEYSC_MODE_1] = { 0, 6, 5 },
        [SH_KEYSC_MODE_2] = { 1, 5, 6 },
        [SH_KEYSC_MODE_3] = { 2, 4, 7 },
+       [SH_KEYSC_MODE_4] = { 3, 6, 6 },
+       [SH_KEYSC_MODE_5] = { 4, 6, 7 },
 };
 
 struct sh_keysc_priv {
@@ -122,8 +124,6 @@ static irqreturn_t sh_keysc_isr(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-#define res_size(res) ((res)->end - (res)->start + 1)
-
 static int __devinit sh_keysc_probe(struct platform_device *pdev)
 {
        struct sh_keysc_priv *priv;
@@ -164,7 +164,7 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev)
        memcpy(&priv->pdata, pdev->dev.platform_data, sizeof(priv->pdata));
        pdata = &priv->pdata;
 
-       priv->iomem_base = ioremap_nocache(res->start, res_size(res));
+       priv->iomem_base = ioremap_nocache(res->start, resource_size(res));
        if (priv->iomem_base == NULL) {
                dev_err(&pdev->dev, "failed to remap I/O memory\n");
                error = -ENXIO;
index 71b8243..a8d2b8d 100644 (file)
@@ -149,7 +149,7 @@ static void apanel_shutdown(struct i2c_client *client)
        apanel_remove(client);
 }
 
-static struct i2c_device_id apanel_id[] = {
+static const struct i2c_device_id apanel_id[] = {
        { "fujitsu_apanel", 0 },
        { }
 };
index 90be30e..9169d15 100644 (file)
@@ -68,10 +68,6 @@ module_param(post_interrupt_delay, int, 0644);
 MODULE_PARM_DESC(post_interrupt_delay,
        "delay (ms) before recal after recal interrupt detected");
 
-static int autorecal = 1;
-module_param(autorecal, int, 0644);
-MODULE_PARM_DESC(autorecal, "enable recalibration in the driver");
-
 /*
  * When the touchpad gets ultra-sensitive, one can keep their finger 1/2"
  * above the pad and still have it send packets.  This causes a jump cursor
index 1dacbe0..797314b 100644 (file)
@@ -186,7 +186,7 @@ static void __devexit pcips2_remove(struct pci_dev *dev)
        pci_disable_device(dev);
 }
 
-static struct pci_device_id pcips2_ids[] = {
+static const struct pci_device_id pcips2_ids[] = {
        {
                .vendor         = 0x14f2,       /* MOBILITY */
                .device         = 0x0123,       /* Keyboard */
index e0f3018..c3b626e 100644 (file)
@@ -26,6 +26,8 @@
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/stddef.h>
 #include <linux/module.h>
 #include <linux/serio.h>
@@ -119,11 +121,10 @@ static int serio_bind_driver(struct serio *serio, struct serio_driver *drv)
 
                error = device_bind_driver(&serio->dev);
                if (error) {
-                       printk(KERN_WARNING
-                               "serio: device_bind_driver() failed "
-                               "for %s (%s) and %s, error: %d\n",
-                               serio->phys, serio->name,
-                               drv->description, error);
+                       dev_warn(&serio->dev,
+                                "device_bind_driver() failed for %s (%s) and %s, error: %d\n",
+                                serio->phys, serio->name,
+                                drv->description, error);
                        serio_disconnect_driver(serio);
                        serio->dev.driver = NULL;
                        return error;
@@ -138,9 +139,9 @@ static void serio_find_driver(struct serio *serio)
 
        error = device_attach(&serio->dev);
        if (error < 0)
-               printk(KERN_WARNING
-                       "serio: device_attach() failed for %s (%s), error: %d\n",
-                       serio->phys, serio->name, error);
+               dev_warn(&serio->dev,
+                        "device_attach() failed for %s (%s), error: %d\n",
+                        serio->phys, serio->name, error);
 }
 
 
@@ -194,17 +195,14 @@ static int serio_queue_event(void *object, struct module *owner,
 
        event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC);
        if (!event) {
-               printk(KERN_ERR
-                       "serio: Not enough memory to queue event %d\n",
-                       event_type);
+               pr_err("Not enough memory to queue event %d\n", event_type);
                retval = -ENOMEM;
                goto out;
        }
 
        if (!try_module_get(owner)) {
-               printk(KERN_WARNING
-                       "serio: Can't get module reference, dropping event %d\n",
-                       event_type);
+               pr_warning("Can't get module reference, dropping event %d\n",
+                          event_type);
                kfree(event);
                retval = -EINVAL;
                goto out;
@@ -230,14 +228,12 @@ static void serio_free_event(struct serio_event *event)
 
 static void serio_remove_duplicate_events(struct serio_event *event)
 {
-       struct list_head *node, *next;
-       struct serio_event *e;
+       struct serio_event *e, *next;
        unsigned long flags;
 
        spin_lock_irqsave(&serio_event_lock, flags);
 
-       list_for_each_safe(node, next, &serio_event_list) {
-               e = list_entry(node, struct serio_event, node);
+       list_for_each_entry_safe(e, next, &serio_event_list, node) {
                if (event->object == e->object) {
                        /*
                         * If this event is of different type we should not
@@ -247,7 +243,7 @@ static void serio_remove_duplicate_events(struct serio_event *event)
                        if (event->type != e->type)
                                break;
 
-                       list_del_init(node);
+                       list_del_init(&e->node);
                        serio_free_event(e);
                }
        }
@@ -258,23 +254,18 @@ static void serio_remove_duplicate_events(struct serio_event *event)
 
 static struct serio_event *serio_get_event(void)
 {
-       struct serio_event *event;
-       struct list_head *node;
+       struct serio_event *event = NULL;
        unsigned long flags;
 
        spin_lock_irqsave(&serio_event_lock, flags);
 
-       if (list_empty(&serio_event_list)) {
-               spin_unlock_irqrestore(&serio_event_lock, flags);
-               return NULL;
+       if (!list_empty(&serio_event_list)) {
+               event = list_first_entry(&serio_event_list,
+                                        struct serio_event, node);
+               list_del_init(&event->node);
        }
 
-       node = serio_event_list.next;
-       event = list_entry(node, struct serio_event, node);
-       list_del_init(node);
-
        spin_unlock_irqrestore(&serio_event_lock, flags);
-
        return event;
 }
 
@@ -287,29 +278,27 @@ static void serio_handle_event(void)
        while ((event = serio_get_event())) {
 
                switch (event->type) {
-                       case SERIO_REGISTER_PORT:
-                               serio_add_port(event->object);
-                               break;
 
-                       case SERIO_RECONNECT_PORT:
-                               serio_reconnect_port(event->object);
-                               break;
+               case SERIO_REGISTER_PORT:
+                       serio_add_port(event->object);
+                       break;
 
-                       case SERIO_RESCAN_PORT:
-                               serio_disconnect_port(event->object);
-                               serio_find_driver(event->object);
-                               break;
+               case SERIO_RECONNECT_PORT:
+                       serio_reconnect_port(event->object);
+                       break;
 
-                       case SERIO_RECONNECT_CHAIN:
-                               serio_reconnect_chain(event->object);
-                               break;
+               case SERIO_RESCAN_PORT:
+                       serio_disconnect_port(event->object);
+                       serio_find_driver(event->object);
+                       break;
 
-                       case SERIO_ATTACH_DRIVER:
-                               serio_attach_driver(event->object);
-                               break;
+               case SERIO_RECONNECT_CHAIN:
+                       serio_reconnect_chain(event->object);
+                       break;
 
-                       default:
-                               break;
+               case SERIO_ATTACH_DRIVER:
+                       serio_attach_driver(event->object);
+                       break;
                }
 
                serio_remove_duplicate_events(event);
@@ -325,16 +314,14 @@ static void serio_handle_event(void)
  */
 static void serio_remove_pending_events(void *object)
 {
-       struct list_head *node, *next;
-       struct serio_event *event;
+       struct serio_event *event, *next;
        unsigned long flags;
 
        spin_lock_irqsave(&serio_event_lock, flags);
 
-       list_for_each_safe(node, next, &serio_event_list) {
-               event = list_entry(node, struct serio_event, node);
+       list_for_each_entry_safe(event, next, &serio_event_list, node) {
                if (event->object == object) {
-                       list_del_init(node);
+                       list_del_init(&event->node);
                        serio_free_event(event);
                }
        }
@@ -380,7 +367,6 @@ static int serio_thread(void *nothing)
                        kthread_should_stop() || !list_empty(&serio_event_list));
        } while (!kthread_should_stop());
 
-       printk(KERN_DEBUG "serio: kseriod exiting\n");
        return 0;
 }
 
@@ -445,6 +431,11 @@ static struct attribute_group serio_id_attr_group = {
        .attrs  = serio_device_id_attrs,
 };
 
+static const struct attribute_group *serio_device_attr_groups[] = {
+       &serio_id_attr_group,
+       NULL
+};
+
 static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
        struct serio *serio = to_serio_port(dev);
@@ -532,6 +523,7 @@ static void serio_init_port(struct serio *serio)
                        (long)atomic_inc_return(&serio_no) - 1);
        serio->dev.bus = &serio_bus;
        serio->dev.release = serio_release_port;
+       serio->dev.groups = serio_device_attr_groups;
        if (serio->parent) {
                serio->dev.parent = &serio->parent->dev;
                serio->depth = serio->parent->depth + 1;
@@ -555,21 +547,15 @@ static void serio_add_port(struct serio *serio)
        }
 
        list_add_tail(&serio->node, &serio_list);
+
        if (serio->start)
                serio->start(serio);
+
        error = device_add(&serio->dev);
        if (error)
-               printk(KERN_ERR
-                       "serio: device_add() failed for %s (%s), error: %d\n",
+               dev_err(&serio->dev,
+                       "device_add() failed for %s (%s), error: %d\n",
                        serio->phys, serio->name, error);
-       else {
-               serio->registered = true;
-               error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group);
-               if (error)
-                       printk(KERN_ERR
-                               "serio: sysfs_create_group() failed for %s (%s), error: %d\n",
-                               serio->phys, serio->name, error);
-       }
 }
 
 /*
@@ -596,11 +582,8 @@ static void serio_destroy_port(struct serio *serio)
                serio->parent = NULL;
        }
 
-       if (serio->registered) {
-               sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group);
+       if (device_is_registered(&serio->dev))
                device_del(&serio->dev);
-               serio->registered = false;
-       }
 
        list_del_init(&serio->node);
        serio_remove_pending_events(serio);
@@ -798,9 +781,8 @@ static void serio_attach_driver(struct serio_driver *drv)
 
        error = driver_attach(&drv->driver);
        if (error)
-               printk(KERN_WARNING
-                       "serio: driver_attach() failed for %s with error %d\n",
-                       drv->driver.name, error);
+               pr_warning("driver_attach() failed for %s with error %d\n",
+                          drv->driver.name, error);
 }
 
 int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name)
@@ -820,8 +802,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons
 
        error = driver_register(&drv->driver);
        if (error) {
-               printk(KERN_ERR
-                       "serio: driver_register() failed for %s, error: %d\n",
+               pr_err("driver_register() failed for %s, error: %d\n",
                        drv->driver.name, error);
                return error;
        }
@@ -987,7 +968,7 @@ irqreturn_t serio_interrupt(struct serio *serio,
 
         if (likely(serio->drv)) {
                 ret = serio->drv->interrupt(serio, data, dfl);
-       } else if (!dfl && serio->registered) {
+       } else if (!dfl && device_is_registered(&serio->dev)) {
                serio_rescan(serio);
                ret = IRQ_HANDLED;
        }
@@ -1018,7 +999,7 @@ static int __init serio_init(void)
 
        error = bus_register(&serio_bus);
        if (error) {
-               printk(KERN_ERR "serio: failed to register serio bus, error: %d\n", error);
+               pr_err("Failed to register serio bus, error: %d\n", error);
                return error;
        }
 
@@ -1026,7 +1007,7 @@ static int __init serio_init(void)
        if (IS_ERR(serio_task)) {
                bus_unregister(&serio_bus);
                error = PTR_ERR(serio_task);
-               printk(KERN_ERR "serio: Failed to start kseriod, error: %d\n", error);
+               pr_err("Failed to start kseriod, error: %d\n", error);
                return error;
        }
 
index ebb22f8..78c64fb 100644 (file)
@@ -354,7 +354,7 @@ static int __devexit xps2_of_remove(struct of_device *of_dev)
 }
 
 /* Match table for of_platform binding */
-static struct of_device_id xps2_of_match[] __devinitdata = {
+static const struct of_device_id xps2_of_match[] __devinitconst = {
        { .compatible = "xlnx,xps-ps2-1.00.a", },
        { /* end of list */ },
 };
index 3d32d3f..866a9ee 100644 (file)
@@ -92,7 +92,7 @@ Scott Hill shill@gtcocalcomp.com
 /* DATA STRUCTURES */
 
 /* Device table */
-static struct usb_device_id gtco_usbid_table [] = {
+static const struct usb_device_id gtco_usbid_table[] = {
        { USB_DEVICE(VENDOR_ID_GTCO, PID_400) },
        { USB_DEVICE(VENDOR_ID_GTCO, PID_401) },
        { USB_DEVICE(VENDOR_ID_GTCO, PID_1000) },
index 8f38c5e..486d31b 100644 (file)
@@ -72,45 +72,49 @@ static void elo_process_data_10(struct elo *elo, unsigned char data)
        struct input_dev *dev = elo->dev;
 
        elo->data[elo->idx] = data;
-       switch (elo->idx++) {
-               case 0:
-                       elo->csum = 0xaa;
-                       if (data != ELO10_LEAD_BYTE) {
-                               pr_debug("elo: unsynchronized data: 0x%02x\n", data);
-                               elo->idx = 0;
-                       }
-                       break;
 
-               case 9:
+       switch (elo->idx++) {
+       case 0:
+               elo->csum = 0xaa;
+               if (data != ELO10_LEAD_BYTE) {
+                       dev_dbg(&elo->serio->dev,
+                               "unsynchronized data: 0x%02x\n", data);
                        elo->idx = 0;
-                       if (data != elo->csum) {
-                               pr_debug("elo: bad checksum: 0x%02x, expected 0x%02x\n",
-                                        data, elo->csum);
-                               break;
-                       }
-                       if (elo->data[1] != elo->expected_packet) {
-                               if (elo->data[1] != ELO10_TOUCH_PACKET)
-                                       pr_debug("elo: unexpected packet: 0x%02x\n",
-                                                elo->data[1]);
-                               break;
-                       }
-                       if (likely(elo->data[1] == ELO10_TOUCH_PACKET)) {
-                               input_report_abs(dev, ABS_X, (elo->data[4] << 8) | elo->data[3]);
-                               input_report_abs(dev, ABS_Y, (elo->data[6] << 8) | elo->data[5]);
-                               if (elo->data[2] & ELO10_PRESSURE)
-                                       input_report_abs(dev, ABS_PRESSURE,
-                                                       (elo->data[8] << 8) | elo->data[7]);
-                               input_report_key(dev, BTN_TOUCH, elo->data[2] & ELO10_TOUCH);
-                               input_sync(dev);
-                       } else if (elo->data[1] == ELO10_ACK_PACKET) {
-                               if (elo->data[2] == '0')
-                                       elo->expected_packet = ELO10_TOUCH_PACKET;
-                               complete(&elo->cmd_done);
-                       } else {
-                               memcpy(elo->response, &elo->data[1], ELO10_PACKET_LEN);
-                               elo->expected_packet = ELO10_ACK_PACKET;
-                       }
+               }
+               break;
+
+       case 9:
+               elo->idx = 0;
+               if (data != elo->csum) {
+                       dev_dbg(&elo->serio->dev,
+                               "bad checksum: 0x%02x, expected 0x%02x\n",
+                                data, elo->csum);
+                       break;
+               }
+               if (elo->data[1] != elo->expected_packet) {
+                       if (elo->data[1] != ELO10_TOUCH_PACKET)
+                               dev_dbg(&elo->serio->dev,
+                                       "unexpected packet: 0x%02x\n",
+                                        elo->data[1]);
                        break;
+               }
+               if (likely(elo->data[1] == ELO10_TOUCH_PACKET)) {
+                       input_report_abs(dev, ABS_X, (elo->data[4] << 8) | elo->data[3]);
+                       input_report_abs(dev, ABS_Y, (elo->data[6] << 8) | elo->data[5]);
+                       if (elo->data[2] & ELO10_PRESSURE)
+                               input_report_abs(dev, ABS_PRESSURE,
+                                               (elo->data[8] << 8) | elo->data[7]);
+                       input_report_key(dev, BTN_TOUCH, elo->data[2] & ELO10_TOUCH);
+                       input_sync(dev);
+               } else if (elo->data[1] == ELO10_ACK_PACKET) {
+                       if (elo->data[2] == '0')
+                               elo->expected_packet = ELO10_TOUCH_PACKET;
+                       complete(&elo->cmd_done);
+               } else {
+                       memcpy(elo->response, &elo->data[1], ELO10_PACKET_LEN);
+                       elo->expected_packet = ELO10_ACK_PACKET;
+               }
+               break;
        }
        elo->csum += data;
 }
@@ -123,42 +127,53 @@ static void elo_process_data_6(struct elo *elo, unsigned char data)
 
        switch (elo->idx++) {
 
-               case 0: if ((data & 0xc0) != 0xc0) elo->idx = 0; break;
-               case 1: if ((data & 0xc0) != 0x80) elo->idx = 0; break;
-               case 2: if ((data & 0xc0) != 0x40) elo->idx = 0; break;
-
-               case 3:
-                       if (data & 0xc0) {
-                               elo->idx = 0;
-                               break;
-                       }
+       case 0:
+               if ((data & 0xc0) != 0xc0)
+                       elo->idx = 0;
+               break;
 
-                       input_report_abs(dev, ABS_X, ((elo->data[0] & 0x3f) << 6) | (elo->data[1] & 0x3f));
-                       input_report_abs(dev, ABS_Y, ((elo->data[2] & 0x3f) << 6) | (elo->data[3] & 0x3f));
+       case 1:
+               if ((data & 0xc0) != 0x80)
+                       elo->idx = 0;
+               break;
 
-                       if (elo->id == 2) {
-                               input_report_key(dev, BTN_TOUCH, 1);
-                               input_sync(dev);
-                               elo->idx = 0;
-                       }
+       case 2:
+               if ((data & 0xc0) != 0x40)
+                       elo->idx = 0;
+               break;
 
+       case 3:
+               if (data & 0xc0) {
+                       elo->idx = 0;
                        break;
+               }
 
-               case 4:
-                       if (data) {
-                               input_sync(dev);
-                               elo->idx = 0;
-                       }
-                       break;
+               input_report_abs(dev, ABS_X, ((elo->data[0] & 0x3f) << 6) | (elo->data[1] & 0x3f));
+               input_report_abs(dev, ABS_Y, ((elo->data[2] & 0x3f) << 6) | (elo->data[3] & 0x3f));
 
-               case 5:
-                       if ((data & 0xf0) == 0) {
-                               input_report_abs(dev, ABS_PRESSURE, elo->data[5]);
-                               input_report_key(dev, BTN_TOUCH, !!elo->data[5]);
-                       }
+               if (elo->id == 2) {
+                       input_report_key(dev, BTN_TOUCH, 1);
                        input_sync(dev);
                        elo->idx = 0;
-                       break;
+               }
+
+               break;
+
+       case 4:
+               if (data) {
+                       input_sync(dev);
+                       elo->idx = 0;
+               }
+               break;
+
+       case 5:
+               if ((data & 0xf0) == 0) {
+                       input_report_abs(dev, ABS_PRESSURE, elo->data[5]);
+                       input_report_key(dev, BTN_TOUCH, !!elo->data[5]);
+               }
+               input_sync(dev);
+               elo->idx = 0;
+               break;
        }
 }
 
@@ -170,17 +185,17 @@ static void elo_process_data_3(struct elo *elo, unsigned char data)
 
        switch (elo->idx++) {
 
-               case 0:
-                       if ((data & 0x7f) != 0x01)
-                               elo->idx = 0;
-                       break;
-               case 2:
-                       input_report_key(dev, BTN_TOUCH, !(elo->data[1] & 0x80));
-                       input_report_abs(dev, ABS_X, elo->data[1]);
-                       input_report_abs(dev, ABS_Y, elo->data[2]);
-                       input_sync(dev);
+       case 0:
+               if ((data & 0x7f) != 0x01)
                        elo->idx = 0;
-                       break;
+               break;
+       case 2:
+               input_report_key(dev, BTN_TOUCH, !(elo->data[1] & 0x80));
+               input_report_abs(dev, ABS_X, elo->data[1]);
+               input_report_abs(dev, ABS_Y, elo->data[2]);
+               input_sync(dev);
+               elo->idx = 0;
+               break;
        }
 }
 
@@ -189,19 +204,19 @@ static irqreturn_t elo_interrupt(struct serio *serio,
 {
        struct elo *elo = serio_get_drvdata(serio);
 
-       switch(elo->id) {
-               case 0:
-                       elo_process_data_10(elo, data);
-                       break;
-
-               case 1:
-               case 2:
-                       elo_process_data_6(elo, data);
-                       break;
-
-               case 3:
-                       elo_process_data_3(elo, data);
-                       break;
+       switch (elo->id) {
+       case 0:
+               elo_process_data_10(elo, data);
+               break;
+
+       case 1:
+       case 2:
+               elo_process_data_6(elo, data);
+               break;
+
+       case 3:
+               elo_process_data_3(elo, data);
+               break;
        }
 
        return IRQ_HANDLED;
@@ -261,10 +276,10 @@ static int elo_setup_10(struct elo *elo)
        if (packet[3] & ELO10_PRESSURE)
                input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0);
 
-       printk(KERN_INFO "elo: %sTouch touchscreen, fw: %02x.%02x, "
-               "features: 0x%02x, controller: 0x%02x\n",
-               elo_types[(packet[1] -'0') & 0x03],
-               packet[5], packet[4], packet[3], packet[7]);
+       dev_info(&elo->serio->dev,
+                "%sTouch touchscreen, fw: %02x.%02x, features: 0x%02x, controller: 0x%02x\n",
+                elo_types[(packet[1] -'0') & 0x03],
+                packet[5], packet[4], packet[3], packet[7]);
 
        return 0;
 }
@@ -330,24 +345,24 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv)
 
        switch (elo->id) {
 
-               case 0: /* 10-byte protocol */
-                       if (elo_setup_10(elo))
-                               goto fail3;
+       case 0: /* 10-byte protocol */
+               if (elo_setup_10(elo))
+                       goto fail3;
 
-                       break;
+               break;
 
-               case 1: /* 6-byte protocol */
-                       input_set_abs_params(input_dev, ABS_PRESSURE, 0, 15, 0, 0);
+       case 1: /* 6-byte protocol */
+               input_set_abs_params(input_dev, ABS_PRESSURE, 0, 15, 0, 0);
 
-               case 2: /* 4-byte protocol */
-                       input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0);
-                       input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0);
-                       break;
+       case 2: /* 4-byte protocol */
+               input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0);
+               input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0);
+               break;
 
-               case 3: /* 3-byte protocol */
-                       input_set_abs_params(input_dev, ABS_X, 0, 255, 0, 0);
-                       input_set_abs_params(input_dev, ABS_Y, 0, 255, 0, 0);
-                       break;
+       case 3: /* 3-byte protocol */
+               input_set_abs_params(input_dev, ABS_X, 0, 255, 0, 0);
+               input_set_abs_params(input_dev, ABS_Y, 0, 255, 0, 0);
+               break;
        }
 
        err = input_register_device(elo->dev);
index 7ef0d14..be23780 100644 (file)
@@ -358,7 +358,7 @@ static int __devexit tsc2007_remove(struct i2c_client *client)
        return 0;
 }
 
-static struct i2c_device_id tsc2007_idtable[] = {
+static const struct i2c_device_id tsc2007_idtable[] = {
        { "tsc2007", 0 },
        { }
 };
index 09a5e73..b1b99e9 100644 (file)
@@ -144,7 +144,7 @@ enum {
        .bInterfaceClass = USB_INTERFACE_CLASS_HID, \
        .bInterfaceProtocol = USB_INTERFACE_PROTOCOL_MOUSE
 
-static struct usb_device_id usbtouch_devices[] = {
+static const struct usb_device_id usbtouch_devices[] = {
 #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
        /* ignore the HID capable devices, handled by usbhid */
        {USB_DEVICE_HID_CLASS(0x0eef, 0x0001), .driver_info = DEVTYPE_IGNORE},
index c721c0a..d30436f 100644 (file)
@@ -321,7 +321,7 @@ InitWait:
        }
 }
 
-static struct xenbus_device_id xenkbd_ids[] = {
+static const struct xenbus_device_id xenkbd_ids[] = {
        { "vkbd" },
        { "" }
 };
index 1bc0854..48e68da 100644 (file)
@@ -46,7 +46,6 @@ struct gameport {
        struct mutex drv_mutex;         /* protects serio->drv so attributes can pin driver */
 
        struct device dev;
-       unsigned int registered;        /* port has been fully registered with driver core */
 
        struct list_head node;
 };
index c211b5c..2aff38b 100644 (file)
@@ -1,10 +1,11 @@
 #ifndef __SH_KEYSC_H__
 #define __SH_KEYSC_H__
 
-#define SH_KEYSC_MAXKEYS 30
+#define SH_KEYSC_MAXKEYS 42
 
 struct sh_keysc_info {
-       enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3 } mode;
+       enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3,
+              SH_KEYSC_MODE_4, SH_KEYSC_MODE_5 } mode;
        int scan_timing; /* 0 -> 7, see KYCR1, SCN[2:0] */
        int delay;
        int kycr2_delay;
index 813d26c..64b4730 100644 (file)
@@ -30,7 +30,6 @@ struct serio {
        char phys[32];
 
        bool manual_bind;
-       bool registered;        /* port has been fully registered with driver core */
 
        struct serio_device_id id;