linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: linux-input@vger.kernel.org,
	Alexandru Ardelean <alexandru.ardelean@analog.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: adp5589-keys - use BIT()
Date: Wed, 18 Nov 2020 23:44:02 -0800	[thread overview]
Message-ID: <20201119074402.GH2034289@dtor-ws> (raw)
In-Reply-To: <9100d801f26e0a068462f9582b7ce193be813966.camel@perches.com>

On Wed, Nov 18, 2020 at 11:34:28PM -0800, Joe Perches wrote:
> On Wed, 2020-11-18 at 23:24 -0800, Dmitry Torokhov wrote:
> > Let's use BIT() macro instead of explicitly shifting '1'.
> []
> > diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
> 
> > @@ -651,13 +652,13 @@ static int adp5589_setup(struct adp5589_kpad *kpad)
> >  		unsigned short pin = pdata->gpimap[i].pin;
> >  
> 
> trivia:
> 
> Perhaps nicer to create and use a temporary
> 
> 	unsigned int bit = BIT(pin - kpad->var->gpi_pin_col_base);
> 
> so in these places below:
> 
> >  		if (pin <= kpad->var->gpi_pin_row_end) {
> > -			evt_mode1 |= (1 << (pin - kpad->var->gpi_pin_row_base));
> > +			evt_mode1 |= BIT(pin - kpad->var->gpi_pin_row_base);
> 
> 			evt_mode1 |= bit;
> 
> >  		} else {
> >  			evt_mode2 |=
> > -			    ((1 << (pin - kpad->var->gpi_pin_col_base)) & 0xFF);
> > +			    BIT(pin - kpad->var->gpi_pin_col_base) & 0xFF;
> 
> 			evt_mode2 |= bit & 0xff;

Different "bit" tough - row vs column.

> 
> >  			if (!kpad->is_adp5585)
> > -				evt_mode3 |= ((1 << (pin -
> > -					kpad->var->gpi_pin_col_base)) >> 8);
> > +				evt_mode3 |=
> > +				    BIT(pin - kpad->var->gpi_pin_col_base) >> 8;
> 
> 				evt_mode3 |= bit >> 8;
> 
> 

Thanks.

-- 
Dmitry

  reply	other threads:[~2020-11-19  7:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-19  7:24 [PATCH] Input: adp5589-keys - use BIT() Dmitry Torokhov
2020-11-19  7:34 ` Joe Perches
2020-11-19  7:44   ` Dmitry Torokhov [this message]
2020-11-19  8:28 ` Ardelean, Alexandru

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=20201119074402.GH2034289@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=alexandru.ardelean@analog.com \
    --cc=joe@perches.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@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).