Re: [PATCH v1 08/13] gpio: dwapb: Switch to more usual pattern of RMW in dwapb_gpio_set_debounce()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 09, 2020 at 05:12:23PM +0300, Andy Shevchenko wrote:
> More usual pattern is to prepare value and then write it in a single place.
> Switch code in dwapb_gpio_set_debounce() to it.

Seems appropriate. Thanks.

Reviewed-by: Serge Semin <fancer.lancer@xxxxxxxxx>

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>  drivers/gpio/gpio-dwapb.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index 916a42fea456..a15652ff9495 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -327,9 +327,10 @@ static int dwapb_gpio_set_debounce(struct gpio_chip *gc,
>  
>  	val_deb = dwapb_read(gpio, GPIO_PORTA_DEBOUNCE);
>  	if (debounce)
> -		dwapb_write(gpio, GPIO_PORTA_DEBOUNCE, val_deb | mask);
> +		val_deb |= mask;
>  	else
> -		dwapb_write(gpio, GPIO_PORTA_DEBOUNCE, val_deb & ~mask);
> +		val_deb &= ~mask;
> +	dwapb_write(gpio, GPIO_PORTA_DEBOUNCE, val_deb);
>  
>  	spin_unlock_irqrestore(&gc->bgpio_lock, flags);
>  
> -- 
> 2.25.1
> 



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux