linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Clouter <alex@digriz.org.uk>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Paul Mundt <lethal@linux-sh.org>, linux-input@vger.kernel.org
Subject: Re: [PATCH] input: gpio_keys: polling mode support
Date: Tue, 13 Jul 2010 08:26:05 +0100	[thread overview]
Message-ID: <20100713072605.GS6976@chipmunk> (raw)
In-Reply-To: <20100713012819.GA15800@core.coreip.homeip.net>

Hi,

* Dmitry Torokhov <dmitry.torokhov@gmail.com> [2010-07-12 18:28:19-0700]:
>
> > > > +#if defined(CONFIG_INPUT_POLLDEV) || defined(CONFIG_INPUT_POLLDEV_MODULE)
> > > > +static void gpio_keys_poll(struct input_polled_dev *dev)
> > > > +{
> > > > +	struct gpio_keys_drvdata *ddata = dev->private;
> > > > +	int i;
> > > > +
> > > > +	for (i = 0; i < ddata->n_buttons; i++) {
> > > > +		struct gpio_button_data *bdata = &ddata->data[i];
> > > > +		struct gpio_keys_button *button = bdata->button;
> > > > +
> > > > +		gpio_handle_button_event(button, bdata);
> > > > +	}
> > > > +}
> > > > +#endif
> >
> > This gets back to why I opted to select the polldev stuff in the first
> > place, to avoid the total mess that all of the ifdeffery causes without
> > it.
>
Well, for me the ifdef madness really only looks bad as (took me a while 
to work out) as when configuring polldev to be a module things do not 
set CONFIG_INPUT_POLLDEV.  Is this normal?

grep'ing /usr/src/linux/{arch,drivers/input} for 
CONFIG_INPUT_POLLDEV_MODULE comes up with no matchs at all (except for 
gpio_keys.c after my patch is applied).

To clean up the ifdef madness, the only approach I can think of is to 
define some dummy noop input_allocate_polled_device(), 
input_free_polled_device() and input_unregister_polled_device() 
functions defined in gpio_keys.c when CONFIG_INPUT_POLLDEV is not 
compiled in.

I am happy to do this if preferred?

I can see the argument against forcing gpio_key users having to use 
polldev (it adds 10kB to the kernel for me), especially on my platform I 
have a 4MB Flash and my kernel can only be 768kB...

> > It's also inconsistent, as you have the poll interval tested openly
> > in some places and always defined, while the poll dev itself is always
> > under ifdef due to the input layer definitions.
>
It was meant to me, you will notice the non-ifdef sections do not do 
anything other than check if poll_interval is non-zero.  As this is not 
an expensive check for the CPU but it is argubly expensive on 
readability throwing in some more ifdef's...I felt it a good compromise.
 
> > Personally I've never found the argument that the polling stuff should be
> > optional very convincing. It's a reasonable mode of operation for devices
> > that don't have IRQs bound to GPIOs, and having to depend on the platform
> > to select random bits of input subsystem infrastructure to support a
> > driver that may or may not be enabled at all is ugly at best.
> 
> Let me play a tad with it and if I can't untangle it reasonably I'll
> just dig up old Paul's patch.
> 
Paul's patch unneccessarily extends gpio_keys_drvdata with 
gpio_keys_platform_data.

Cheers

-- 
Alexander Clouter
.sigmonster says: Never argue with a woman when she's tired -- or rested.

  reply	other threads:[~2010-07-13  7:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-06 19:01 [PATCH] input: gpio_keys: polling mode support Alexander Clouter
2010-07-08 16:26 ` Alexander Clouter
2010-07-12 19:29 ` Alexander Clouter
2010-07-13  1:17   ` Paul Mundt
2010-07-13  1:28     ` Dmitry Torokhov
2010-07-13  7:26       ` Alexander Clouter [this message]
2010-07-13 19:57         ` [PATCHv2] " Alexander Clouter
2010-07-13 20:04           ` [PATCHv3] " Alexander Clouter
2010-07-19 21:26             ` Ferenc Wagner
2010-07-24  7:46               ` Dmitry Torokhov
2010-07-24 19:17                 ` Ferenc Wagner
  -- strict thread matches above, loose matches on Subject: below --
2008-10-21  8:38 [PATCH] input: gpio_keys: Polling " Paul Mundt
2008-10-28 10:18 ` Paul Mundt
2008-10-29  3:51   ` Dmitry Torokhov
2008-11-25 20:43     ` Paul Mundt
2008-12-08  3:32       ` Paul Mundt
2008-12-24  1:47         ` Paul Mundt

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=20100713072605.GS6976@chipmunk \
    --to=alex@digriz.org.uk \
    --cc=dmitry.torokhov@gmail.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-input@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).