Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1301218

Re: [PATCH] input: gpio_keys: Fix check for disabling unsupported key

From Dmitry Torokhov <dmitry.torokhov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] input: gpio_keys: Fix check for disabling unsupported key
Date 2016-01-05 02:20 +0100
Message-ID <qNos1-34q-5@gated-at.bofh.it> (permalink)
References <qMYnU-2l7-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Jan 03, 2016 at 11:21:16PM +0200, Ivaylo Dimitrov wrote:
> Commit 4ea14a53d8f881034fa9e186653821c4e3d9a8fb ("Input: gpio-keys -
> report error when disabling unsupported key") tried to prevent an
> unsupported key to disabled. Unfortunately it effectively broke the driver
> in a way so no key is possible to be disabled. Fix that by providing the
> correct verify logic.

Hmm, indeed...

> 
> Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
> ---
>  drivers/input/keyboard/gpio_keys.c | 28 +++++++++++++++++++---------
>  1 file changed, 19 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> index bef317f..a371805 100644
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -226,22 +226,32 @@ static ssize_t gpio_keys_attr_store_helper(struct gpio_keys_drvdata *ddata,
>  		goto out;
>  
>  	/* First validate */
> -	for (i = 0; i < ddata->pdata->nbuttons; i++) {
> -		struct gpio_button_data *bdata = &ddata->data[i];
> +	for (i = 0; i < n_events; i++) {

for_each_set_bit()?

OTOH maybe we should do

	bitmap = get_bitmap_events_by_type(type); // new, return keybit or swbit
	if (!bitmap_subset(bits, bitmap, n_events)) {
		error = -EINVAL;
		goto out;
	}

... and leave the rest of the loop as is?

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] input: gpio_keys: Fix check for disabling unsupported key Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-01-03 22:30 +0100
  Re: [PATCH] input: gpio_keys: Fix check for disabling unsupported key Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-01-05 02:20 +0100
    Re: [PATCH] input: gpio_keys: Fix check for disabling unsupported key Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-01-05 08:30 +0100
      Re: [PATCH] input: gpio_keys: Fix check for disabling unsupported key Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-01-06 23:40 +0100
        Re: [PATCH] input: gpio_keys: Fix check for disabling unsupported key Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-01-10 18:40 +0100

csiph-web