All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: pali.rohar@gmail.com, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] input: gpio_keys: Fix check for disabling unsupported key
Date: Tue, 5 Jan 2016 09:24:40 +0200	[thread overview]
Message-ID: <568B6FB8.6000101@gmail.com> (raw)
In-Reply-To: <20160105011942.GD11801@dtor-ws>

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

  reply	other threads:[~2016-01-05  7:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-03 21:21 [PATCH] input: gpio_keys: Fix check for disabling unsupported key Ivaylo Dimitrov
2016-01-05  1:19 ` Dmitry Torokhov
2016-01-05  7:24   ` Ivaylo Dimitrov [this message]
2016-01-06 22:38     ` Dmitry Torokhov
2016-01-10 17:39       ` Ivaylo Dimitrov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=568B6FB8.6000101@gmail.com \
    --to=ivo.g.dimitrov.75@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.