]> git.karo-electronics.de Git - karo-tx-linux.git/commit
auxdisplay: ht16k33: rework input device initialization
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 9 Feb 2017 18:15:52 +0000 (10:15 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Feb 2017 14:57:28 +0000 (15:57 +0100)
commitcac513f1a9f7ace21d27665435f8fe7e39050396
treeda1a705d29a5537307ae9b264ce41a0738b95e4e
parentbbd39d1e4ada551d0d7e7a39f97382fa24b5e7c0
auxdisplay: ht16k33: rework input device initialization

This patch fixes following issues in input device (keypad) handling:

- requesting IRQ before allocating and initializing parts of the device
  that can be referenced from IRQ handler is racy, even if we try to
  disable interrupt after requesting it. Let's move allocations around
  so that everything is ready by the time we request IRQ.

- using threaded interrupt handler to schedule a work item it sub-optimal.
  Disabling and then re-enabling interrupts in work item and in open/close
  methods is prone to races and exactly the reason theraded interrupts were
  introduced. Let's use the infrastructure properly and keep scanning the
  matrix array in IRQ thread, stopping when there are no keys, or when told
  to do so.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Tested-by: Robin van der Gracht <robin@protonic.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/auxdisplay/ht16k33.c