linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Olliver Schinagl <oliver@schinagl.nl>
Cc: Olliver Schinagl <oliver+list@schinagl.nl>,
	Wolfram Sang <wsa@the-dreams.de>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Jingoo Han <jg1.han@samsung.com>,
	"David S. Miller" <davem@davemloft.net>,
	Sam Ravnborg <sam@ravnborg.org>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] input: make use of the input_set_capability helper
Date: Wed, 7 Jan 2015 00:26:03 -0800	[thread overview]
Message-ID: <20150107082603.GG5256@dtor-ws> (raw)
In-Reply-To: <54ACEC10.5000508@schinagl.nl>

On Wed, Jan 07, 2015 at 09:19:28AM +0100, Olliver Schinagl wrote:
> Hey Dmitry,
> 
> On 07-01-15 08:57, Dmitry Torokhov wrote:
> >Hi Olliver,
> >
> >On Wed, Jan 07, 2015 at 08:31:06AM +0100, Olliver Schinagl wrote:
> >>From: Olliver Schinagl <oliver@schinagl.nl>
> >>
> >>Almost all of the speaker drivers under input manipulate the ev bits
> >>directly, which is not needed, as there is a helper available.
> >>
> >>This patch makes use of the helper for the speaker drivers.
> >>
> >>Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
> >>---
> >>  drivers/input/misc/cm109.c         | 4 ++--
> >>  drivers/input/misc/ixp4xx-beeper.c | 5 ++---
> >>  drivers/input/misc/m68kspkr.c      | 5 ++---
> >>  drivers/input/misc/pcspkr.c        | 5 ++---
> >>  drivers/input/misc/pwm-beeper.c    | 5 +----
> >>  drivers/input/misc/sparcspkr.c     | 6 ++----
> >>  6 files changed, 11 insertions(+), 19 deletions(-)
> >>
> >>diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
> >>index 9365535..8e41070 100644
> >>--- a/drivers/input/misc/cm109.c
> >>+++ b/drivers/input/misc/cm109.c
> >>@@ -767,10 +767,10 @@ static int cm109_usb_probe(struct usb_interface *intf,
> >>  	input_dev->keycodesize = sizeof(unsigned char);
> >>  	input_dev->keycodemax = ARRAY_SIZE(dev->keymap);
> >>-	input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_SND);
> >>-	input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
> >>+	input_set_capability(input_dev, EV_SND, SND_BELL | SND_TONE);
> >No, input_set_capability() takes single event code, not bitmask. The
> >fact that it works for these 2 values of SND events is pure coincidence
> >(the old code wasn't much better though).

Ah, not, it does not work at all. Instead of setting bits 1 and 2 your
code sets bit 3 in dev->sndbit.

> What do you suggest we should do then? Fix input_set_capability to
> take bit masks? or multiline events?
> I'm not sure why __set_bits() wouldn't work for bitmasks, could you
> educate me?

Call it once per event:

	input_set_capability(input_dev, EV_SND, SND_BELL);
	input_set_capability(input_dev, EV_SND, SND_TONE);


> >
> >>  	/* register available key events */
> >>+	input_dev->evbit[0] = BIT_MASK(EV_KEY);
> >Would prefer __set_bit(EV_KEY, input_dev->evbit); here instead.
> I only moved the EV_KEY bit from above to its appropiate place here.

The original code was setting combination of bits; here we set single
one and __set_bit() is cleaner IMO.

> I can change this one (and others) to use __set_bit() for now for
> v2?

Yes, please.

Thanks.

-- 
Dmitry

  reply	other threads:[~2015-01-07  8:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07  7:31 [PATCH v1] input: make use of the input_set_capability helper Olliver Schinagl
2015-01-07  7:57 ` Dmitry Torokhov
2015-01-07  8:19   ` Olliver Schinagl
2015-01-07  8:26     ` Dmitry Torokhov [this message]
2015-01-07  9:41       ` Olliver Schinagl
2015-01-07 17:43         ` Dmitry Torokhov

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=20150107082603.GG5256@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jg1.han@samsung.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oliver+list@schinagl.nl \
    --cc=oliver@schinagl.nl \
    --cc=paul.gortmaker@windriver.com \
    --cc=sam@ravnborg.org \
    --cc=wsa@the-dreams.de \
    /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).