From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Replace the if-else with a direct call to the regmap_assign_bits()
helper and save a couple lines of code.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpio-wcove.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c
index 1ec24f6f9300f33f5b3f0f8deb539e08392b8188..816fb8d113e66b27070f286755f3192b2a8f8512 100644
--- a/drivers/gpio/gpio-wcove.c
+++ b/drivers/gpio/gpio-wcove.c
@@ -208,10 +208,7 @@ static void wcove_gpio_set(struct gpio_chip *chip, unsigned int gpio, int value)
if (reg < 0)
return;
- if (value)
- regmap_set_bits(wg->regmap, reg, 1);
- else
- regmap_clear_bits(wg->regmap, reg, 1);
+ regmap_assign_bits(wg->regmap, reg, 1, value);
}
static int wcove_gpio_set_config(struct gpio_chip *chip, unsigned int gpio,
--
2.48.1
On 7/15/25 1:19 AM, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> > > Replace the if-else with a direct call to the regmap_assign_bits() > helper and save a couple lines of code. > > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> > --- Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> > drivers/gpio/gpio-wcove.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c > index 1ec24f6f9300f33f5b3f0f8deb539e08392b8188..816fb8d113e66b27070f286755f3192b2a8f8512 100644 > --- a/drivers/gpio/gpio-wcove.c > +++ b/drivers/gpio/gpio-wcove.c > @@ -208,10 +208,7 @@ static void wcove_gpio_set(struct gpio_chip *chip, unsigned int gpio, int value) > if (reg < 0) > return; > > - if (value) > - regmap_set_bits(wg->regmap, reg, 1); > - else > - regmap_clear_bits(wg->regmap, reg, 1); > + regmap_assign_bits(wg->regmap, reg, 1, value); > } > > static int wcove_gpio_set_config(struct gpio_chip *chip, unsigned int gpio, > -- Sathyanarayanan Kuppuswamy Linux Kernel Developer
On Tue, Jul 15, 2025 at 10:19:44AM +0200, Bartosz Golaszewski wrote: > > Replace the if-else with a direct call to the regmap_assign_bits() > helper and save a couple lines of code. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> -- With Best Regards, Andy Shevchenko
On Tue, Jul 15, 2025 at 11:21:53AM +0300, Andy Shevchenko wrote: > On Tue, Jul 15, 2025 at 10:19:44AM +0200, Bartosz Golaszewski wrote: > > Replace the if-else with a direct call to the regmap_assign_bits() > > helper and save a couple lines of code. '...a couple of lines of code.' > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> -- With Best Regards, Andy Shevchenko
© 2016 - 2025 Red Hat, Inc.