lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 18 Nov 2020 23:34:28 -0800
From:   Joe Perches <joe@...ches.com>
To:     Dmitry Torokhov <dmitry.torokhov@...il.com>,
        linux-input@...r.kernel.org
Cc:     Alexandru Ardelean <alexandru.ardelean@...log.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Input: adp5589-keys - use BIT()

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;

>  			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;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ