<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/input/keyboard/gpio_keys.c, branch linux-5.14.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.14.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.14.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-04-08T06:20:52Z</updated>
<entry>
<title>Input: gpio-keys - fix crash when disabliing GPIO-less buttons</title>
<updated>2021-04-08T06:20:52Z</updated>
<author>
<name>Dmitry Torokhov</name>
</author>
<published>2021-04-08T06:14:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2531fdbf8bfc22b0a2554bb3e3772dd8105d74ad'/>
<id>urn:sha1:2531fdbf8bfc22b0a2554bb3e3772dd8105d74ad</id>
<content type='text'>
My brain-damaged adjustments to Paul's patch caused crashes in
gpio_keys_disable_button() when driver is used in GPIO-less (i.e.
purely interrupt-driven) setups, because I mixed together debounce and
release timers when they are in fact separate:

Unable to handle kernel NULL pointer dereference at virtual address 0000000c
...
PC is at hrtimer_active+0xc/0x98
LR is at hrtimer_try_to_cancel+0x24/0x140
...
[&lt;c01c43b8&gt;] (hrtimer_active) from [&lt;c01c50f4&gt;] (hrtimer_try_to_cancel+0x24/0x140)
[&lt;c01c50f4&gt;] (hrtimer_try_to_cancel) from [&lt;c01c5224&gt;] (hrtimer_cancel+0x14/0x4c)
[&lt;c01c5224&gt;] (hrtimer_cancel) from [&lt;bf1cae24&gt;] (gpio_keys_attr_store_helper+0x1b8/0x1d8 [gpio_keys])
[&lt;bf1cae24&gt;] (gpio_keys_attr_store_helper [gpio_keys]) from [&lt;bf1cae80&gt;] (gpio_keys_store_disabled_keys+0x18/0x24 [gpio_keys])
[&lt;bf1cae80&gt;] (gpio_keys_store_disabled_keys [gpio_keys]) from [&lt;c038ec7c&gt;] (kernfs_fop_write_iter+0x10c/0x1cc)
[&lt;c038ec7c&gt;] (kernfs_fop_write_iter) from [&lt;c02df858&gt;] (vfs_write+0x2ac/0x404)
[&lt;c02df858&gt;] (vfs_write) from [&lt;c02dfaf4&gt;] (ksys_write+0x64/0xdc)
[&lt;c02dfaf4&gt;] (ksys_write) from [&lt;c0100080&gt;] (ret_fast_syscall+0x0/0x58)

Let's fix it up.

Fixes: c9efb0ba281e ("Input: gpio-keys - use hrtimer for software debounce, if possible")
Reported-by: Tony Lindgren &lt;tony@atomide.com&gt;
Tested-by: Tony Lindgren &lt;tony@atomide.com&gt;
Link: https://lore.kernel.org/r/YG1DFFgojSVfdpaz@google.com
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</content>
</entry>
<entry>
<title>Input: gpio-keys - use hrtimer for software debounce, if possible</title>
<updated>2021-03-25T18:14:08Z</updated>
<author>
<name>Paul Cercueil</name>
</author>
<published>2021-03-21T23:09:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c9efb0ba281e88e2faec6ad919be509b6ab8ead6'/>
<id>urn:sha1:c9efb0ba281e88e2faec6ad919be509b6ab8ead6</id>
<content type='text'>
We want to be able to report the input event as soon as the debounce
delay elapsed. However, the current code does not really ensure that,
as it uses the jiffies-based schedule_delayed_work() API. With a small
enough HZ value (HZ &lt;= 100), this results in some input events being
lost, when a key is quickly pressed then released (on a human's time
scale).

Switching to hrtimers fixes this issue, and will work even on extremely
low HZ values (tested at HZ=24). This is however only possible if
reading the GPIO is possible without sleeping. If this condition is not
met, the previous approach of using a jiffies-based timer is taken.

Signed-off-by: Paul Cercueil &lt;paul@crapouillou.net&gt;
Link: https://lore.kernel.org/r/20210307222240.380583-3-paul@crapouillou.net
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</content>
</entry>
<entry>
<title>Input: gpio-keys - use hrtimer for release timer</title>
<updated>2021-03-25T18:14:08Z</updated>
<author>
<name>Paul Cercueil</name>
</author>
<published>2021-03-21T23:06:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=019002f20cb5b9f78d39360aff244265d035e08a'/>
<id>urn:sha1:019002f20cb5b9f78d39360aff244265d035e08a</id>
<content type='text'>
Dealing with input, timing is important; if the button should be
released in one millisecond, then it should be done in one millisecond
and not a hundred milliseconds.

Therefore, the standard timer API is not really suitable for this task.

Convert the gpio-keys driver to use a hrtimer instead of the standard
timer to address this issue.

Note that by using a hard IRQ for the hrtimer callback, we can get rid
of the spin_lock_irqsave() and spin_unlock_irqrestore().

Signed-off-by: Paul Cercueil &lt;paul@crapouillou.net&gt;
Link: https://lore.kernel.org/r/20210307222240.380583-2-paul@crapouillou.net
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</content>
</entry>
<entry>
<title>Input: gpio-keys - remove extra call to input_sync</title>
<updated>2021-03-25T18:14:08Z</updated>
<author>
<name>Paul Cercueil</name>
</author>
<published>2021-03-21T23:06:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=36a8fc6fa230eb936385884391cac80420cd0e6f'/>
<id>urn:sha1:36a8fc6fa230eb936385884391cac80420cd0e6f</id>
<content type='text'>
The input_sync() function is already called after the loop in
gpio_keys_report_state(), so it does not need to be called after each
iteration within gpio_keys_gpio_report_event().

Signed-off-by: Paul Cercueil &lt;paul@crapouillou.net&gt;
Link: https://lore.kernel.org/r/20210307222240.380583-1-paul@crapouillou.net
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</content>
</entry>
<entry>
<title>Input: use input_device_enabled()</title>
<updated>2020-12-03T06:10:33Z</updated>
<author>
<name>Andrzej Pietrasiewicz</name>
</author>
<published>2020-10-05T04:16:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d69f0a43c677e8afc67a222e1e7b51b9acc69cd3'/>
<id>urn:sha1:d69f0a43c677e8afc67a222e1e7b51b9acc69cd3</id>
<content type='text'>
Use the newly added helper in relevant input drivers.

Signed-off-by: Andrzej Pietrasiewicz &lt;andrzej.p@collabora.com&gt;
Link: https://lore.kernel.org/r/20200608112211.12125-3-andrzej.p@collabora.com
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</content>
</entry>
<entry>
<title>Input: gpio_keys - fix misnamed function parameter 'dev'</title>
<updated>2020-11-09T06:23:59Z</updated>
<author>
<name>Lee Jones</name>
</author>
<published>2020-11-09T06:08:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2216c0e414c6596b03a354b5c08ba98af4cbef85'/>
<id>urn:sha1:2216c0e414c6596b03a354b5c08ba98af4cbef85</id>
<content type='text'>
Fixes the following W=1 kernel build warning(s):

 drivers/input/keyboard/gpio_keys.c:119: warning: Function parameter or member 'dev' not described in 'get_bm_events_by_type'
 drivers/input/keyboard/gpio_keys.c:119: warning: Excess function parameter 'input' description in 'get_bm_events_by_type'

Signed-off-by: Lee Jones &lt;lee.jones@linaro.org&gt;
Link: https://lore.kernel.org/r/20201104162427.2984742-12-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</content>
</entry>
<entry>
<title>Input: Use fallthrough pseudo-keyword</title>
<updated>2020-07-07T18:25:54Z</updated>
<author>
<name>Gustavo A. R. Silva</name>
</author>
<published>2020-07-07T18:24:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6f49c4f5b95b9ac8ead1ec39066489fb10fcbde8'/>
<id>urn:sha1:6f49c4f5b95b9ac8ead1ec39066489fb10fcbde8</id>
<content type='text'>
Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva &lt;gustavoars@kernel.org&gt;
Link: https://lore.kernel.org/r/20200707180857.GA30600@embeddedor
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</content>
</entry>
<entry>
<title>Input: gpio_keys - replace zero-length array with flexible-array member</title>
<updated>2020-02-14T01:09:47Z</updated>
<author>
<name>Gustavo A. R. Silva</name>
</author>
<published>2020-02-14T00:57:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a1b9b65edfd8f195dafaebf68f7d321eb9b3ab82'/>
<id>urn:sha1:a1b9b65edfd8f195dafaebf68f7d321eb9b3ab82</id>
<content type='text'>
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva &lt;gustavo@embeddedor.com&gt;
Link: https://lore.kernel.org/r/20200213002600.GA31916@embeddedor.com
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;</content>
</entry>
<entry>
<title>Input: gpio_keys - switch to using devm_fwnode_gpiod_get()</title>
<updated>2019-10-27T18:12:47Z</updated>
<author>
<name>Dmitry Torokhov</name>
</author>
<published>2019-09-14T00:43:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2a60f598777d8b819383698c3dd4fd35dff21182'/>
<id>urn:sha1:2a60f598777d8b819383698c3dd4fd35dff21182</id>
<content type='text'>
devm_fwnode_get_gpiod_from_child() is going away as the name is too
unwieldy, let's switch to using the new devm_fwnode_gpiod_get().

Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</content>
</entry>
<entry>
<title>Input: gpio_keys - convert driver to use dev_groups</title>
<updated>2019-08-12T07:02:38Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2019-08-12T06:41:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cf1b2a208d2e1b4c436a56672d09d12c34c06384'/>
<id>urn:sha1:cf1b2a208d2e1b4c436a56672d09d12c34c06384</id>
<content type='text'>
Drivers now have the option to have the driver core create and remove any
needed sysfs attribute files.  So take advantage of that and do not
register "by hand" a bunch of sysfs files.

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
</content>
</entry>
</feed>
