Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 15 Feb 2011 17:40:27 +0000 (09:40 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 15 Feb 2011 17:40:27 +0000 (09:40 -0800)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: matrix_keypad - increase the limit of rows and columns
  Input: wacom - fix error path in wacom_probe()
  Input: ads7846 - check proper condition when freeing gpio
  Revert "Input: do not pass injected events back to the originating handler"
  Input: sysrq - rework re-inject logic
  Input: serio - clear pending rescans after sysfs driver rebind
  Input: rotary_encoder - use proper irqflags
  Input: wacom_w8001 - report resolution to userland

1  2 
drivers/input/input.c
drivers/tty/sysrq.c
include/linux/input/matrix_keypad.h

diff --combined drivers/input/input.c
@@@ -26,6 -26,7 +26,6 @@@
  #include <linux/device.h>
  #include <linux/mutex.h>
  #include <linux/rcupdate.h>
 -#include <linux/smp_lock.h>
  #include "input-compat.h"
  
  MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
@@@ -75,7 -76,6 +75,6 @@@ static int input_defuzz_abs_event(int v
   * dev->event_lock held and interrupts disabled.
   */
  static void input_pass_event(struct input_dev *dev,
-                            struct input_handler *src_handler,
                             unsigned int type, unsigned int code, int value)
  {
        struct input_handler *handler;
                                continue;
  
                        handler = handle->handler;
-                       /*
-                        * If this is the handler that injected this
-                        * particular event we want to skip it to avoid
-                        * filters firing again and again.
-                        */
-                       if (handler == src_handler)
-                               continue;
                        if (!handler->filter) {
                                if (filtered)
                                        break;
@@@ -132,7 -123,7 +122,7 @@@ static void input_repeat_key(unsigned l
        if (test_bit(dev->repeat_key, dev->key) &&
            is_event_supported(dev->repeat_key, dev->keybit, KEY_MAX)) {
  
-               input_pass_event(dev, NULL, EV_KEY, dev->repeat_key, 2);
+               input_pass_event(dev, EV_KEY, dev->repeat_key, 2);
  
                if (dev->sync) {
                        /*
                         * Otherwise assume that the driver will send
                         * SYN_REPORT once it's done.
                         */
-                       input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1);
+                       input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
                }
  
                if (dev->rep[REP_PERIOD])
@@@ -174,7 -165,6 +164,6 @@@ static void input_stop_autorepeat(struc
  #define INPUT_PASS_TO_ALL     (INPUT_PASS_TO_HANDLERS | INPUT_PASS_TO_DEVICE)
  
  static int input_handle_abs_event(struct input_dev *dev,
-                                 struct input_handler *src_handler,
                                  unsigned int code, int *pval)
  {
        bool is_mt_event;
        /* Flush pending "slot" event */
        if (is_mt_event && dev->slot != input_abs_get_val(dev, ABS_MT_SLOT)) {
                input_abs_set_val(dev, ABS_MT_SLOT, dev->slot);
-               input_pass_event(dev, src_handler,
-                                EV_ABS, ABS_MT_SLOT, dev->slot);
+               input_pass_event(dev, EV_ABS, ABS_MT_SLOT, dev->slot);
        }
  
        return INPUT_PASS_TO_HANDLERS;
  }
  
  static void input_handle_event(struct input_dev *dev,
-                              struct input_handler *src_handler,
                               unsigned int type, unsigned int code, int value)
  {
        int disposition = INPUT_IGNORE_EVENT;
  
        case EV_ABS:
                if (is_event_supported(code, dev->absbit, ABS_MAX))
-                       disposition = input_handle_abs_event(dev, src_handler,
-                                                            code, &value);
+                       disposition = input_handle_abs_event(dev, code, &value);
  
                break;
  
                dev->event(dev, type, code, value);
  
        if (disposition & INPUT_PASS_TO_HANDLERS)
-               input_pass_event(dev, src_handler, type, code, value);
+               input_pass_event(dev, type, code, value);
  }
  
  /**
@@@ -367,7 -354,7 +353,7 @@@ void input_event(struct input_dev *dev
  
                spin_lock_irqsave(&dev->event_lock, flags);
                add_input_randomness(type, code, value);
-               input_handle_event(dev, NULL, type, code, value);
+               input_handle_event(dev, type, code, value);
                spin_unlock_irqrestore(&dev->event_lock, flags);
        }
  }
@@@ -397,8 -384,7 +383,7 @@@ void input_inject_event(struct input_ha
                rcu_read_lock();
                grab = rcu_dereference(dev->grab);
                if (!grab || grab == handle)
-                       input_handle_event(dev, handle->handler,
-                                          type, code, value);
+                       input_handle_event(dev, type, code, value);
                rcu_read_unlock();
  
                spin_unlock_irqrestore(&dev->event_lock, flags);
@@@ -611,10 -597,10 +596,10 @@@ static void input_dev_release_keys(stru
                for (code = 0; code <= KEY_MAX; code++) {
                        if (is_event_supported(code, dev->keybit, KEY_MAX) &&
                            __test_and_clear_bit(code, dev->key)) {
-                               input_pass_event(dev, NULL, EV_KEY, code, 0);
+                               input_pass_event(dev, EV_KEY, code, 0);
                        }
                }
-               input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1);
+               input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
        }
  }
  
@@@ -889,9 -875,9 +874,9 @@@ int input_set_keycode(struct input_dev 
            !is_event_supported(old_keycode, dev->keybit, KEY_MAX) &&
            __test_and_clear_bit(old_keycode, dev->key)) {
  
-               input_pass_event(dev, NULL, EV_KEY, old_keycode, 0);
+               input_pass_event(dev, EV_KEY, old_keycode, 0);
                if (dev->sync)
-                       input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1);
+                       input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
        }
  
   out:
diff --combined drivers/tty/sysrq.c
@@@ -571,6 -571,7 +571,7 @@@ struct sysrq_state 
        unsigned int alt_use;
        bool active;
        bool need_reinject;
+       bool reinjecting;
  };
  
  static void sysrq_reinject_alt_sysrq(struct work_struct *work)
        unsigned int alt_code = sysrq->alt_use;
  
        if (sysrq->need_reinject) {
+               /* we do not want the assignment to be reordered */
+               sysrq->reinjecting = true;
+               mb();
                /* Simulate press and release of Alt + SysRq */
                input_inject_event(handle, EV_KEY, alt_code, 1);
                input_inject_event(handle, EV_KEY, KEY_SYSRQ, 1);
                input_inject_event(handle, EV_KEY, KEY_SYSRQ, 0);
                input_inject_event(handle, EV_KEY, alt_code, 0);
                input_inject_event(handle, EV_SYN, SYN_REPORT, 1);
+               mb();
+               sysrq->reinjecting = false;
        }
  }
  
@@@ -599,6 -607,13 +607,13 @@@ static bool sysrq_filter(struct input_h
        bool was_active = sysrq->active;
        bool suppress;
  
+       /*
+        * Do not filter anything if we are in the process of re-injecting
+        * Alt+SysRq combination.
+        */
+       if (sysrq->reinjecting)
+               return false;
        switch (type) {
  
        case EV_SYN:
                                sysrq->alt_use = sysrq->alt;
                                /*
                                 * If nothing else will be pressed we'll need
-                                * to re-inject Alt-SysRq keysroke.
+                                * to re-inject Alt-SysRq keysroke.
                                 */
                                sysrq->need_reinject = true;
                        }
@@@ -4,12 -4,12 +4,12 @@@
  #include <linux/types.h>
  #include <linux/input.h>
  
- #define MATRIX_MAX_ROWS               16
- #define MATRIX_MAX_COLS               16
+ #define MATRIX_MAX_ROWS               32
+ #define MATRIX_MAX_COLS               32
  
  #define KEY(row, col, val)    ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\
                                 (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\
 -                               (val & 0xffff))
 +                               ((val) & 0xffff))
  
  #define KEY_ROW(k)            (((k) >> 24) & 0xff)
  #define KEY_COL(k)            (((k) >> 16) & 0xff)