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


Groups > linux.kernel > #1301309

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

From Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] input: gpio_keys: Fix check for disabling unsupported key
Date 2016-01-05 08:30 +0100
Message-ID <qNue6-77C-5@gated-at.bofh.it> (permalink)
References <qMYnU-2l7-5@gated-at.bofh.it> <qNos1-34q-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

On  5.01.2016 03:19, Dmitry Torokhov wrote:
>>   	/* 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()?

Yeah, seems I must have overslept that helper, will send an updated version.

>
> OTOH maybe we should do
>
> 	bitmap = get_bitmap_events_by_type(type); // new, return keybit or swbit

new helper function? or static function in gpio-keys? who 
allocates/frees the bitmap memory? or this is static data? Maybe I don't 
get the idea :) .

> 	if (!bitmap_subset(bits, bitmap, n_events)) {
> 		error = -EINVAL;
> 		goto out;
> 	}
>
> ... and leave the rest of the loop as is?
>

Not sure about that. Unless I miss something, what we want is:

1. make sure that what user has written is within the range of the event 
type. I hope bitmap_parselist already does it for us.

2. Make sure that for every bit in bits set based on what user has 
provided, there is a matching gpio in this particular gpio-keys device.

3. Make sure that every gpio user wants disabled is actually allowed to 
be disabled.

I don't see how 2 is achieved with ^^^ code.

So, shall I send a new version of the patch with for_each_set_bit() 
used, or you'll fix the $subject problem with whatever magic you think 
is needed?

Thanks,
Ivo
--
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