Re: [PATCH] gpio: sim: fix setting and getting multiple lines

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

 



On Wed, Apr 13, 2022 at 04:01:32PM +0200, Bartosz Golaszewski wrote:
> We need to take mask into account in the set/get_multiple() callbacks.
> Use bitmap_replace() instead of bitmap_copy().

Good catch!
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

> Fixes: cb8c474e79be ("gpio: sim: new testing module")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Bartosz Golaszewski <brgl@xxxxxxxx>
> ---
>  drivers/gpio/gpio-sim.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
> index 8e5d87984a48..41c31b10ae84 100644
> --- a/drivers/gpio/gpio-sim.c
> +++ b/drivers/gpio/gpio-sim.c
> @@ -134,7 +134,7 @@ static int gpio_sim_get_multiple(struct gpio_chip *gc,
>  	struct gpio_sim_chip *chip = gpiochip_get_data(gc);
>  
>  	mutex_lock(&chip->lock);
> -	bitmap_copy(bits, chip->value_map, gc->ngpio);
> +	bitmap_replace(bits, bits, chip->value_map, mask, gc->ngpio);
>  	mutex_unlock(&chip->lock);
>  
>  	return 0;
> @@ -146,7 +146,7 @@ static void gpio_sim_set_multiple(struct gpio_chip *gc,
>  	struct gpio_sim_chip *chip = gpiochip_get_data(gc);
>  
>  	mutex_lock(&chip->lock);
> -	bitmap_copy(chip->value_map, bits, gc->ngpio);
> +	bitmap_replace(chip->value_map, chip->value_map, bits, mask, gc->ngpio);
>  	mutex_unlock(&chip->lock);
>  }
>  
> -- 
> 2.32.0
> 

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux