[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201119074402.GH2034289@dtor-ws>
Date: Wed, 18 Nov 2020 23:44:02 -0800
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Joe Perches <joe@...ches.com>
Cc: linux-input@...r.kernel.org,
Alexandru Ardelean <alexandru.ardelean@...log.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Input: adp5589-keys - use BIT()
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
Powered by blists - more mailing lists