Message ID | 20221115111347.3705732-5-u.kleine-koenig@pengutronix.de |
---|---|
State | Accepted |
Headers | show |
Series | pwm: Use regmap_clear_bits and regmap_set_bits where applicable | expand |
On 11/15/22 12:13, Uwe Kleine-König wrote: > Found using coccinelle and the following semantic patch: > > @@ > expression map, reg, bits; > @@ > > - regmap_update_bits(map, reg, bits, bits) > + regmap_set_bits(map, reg, bits) > > @@ > expression map, reg, bits; > @@ > > - regmap_update_bits(map, reg, bits, 0) > + regmap_clear_bits(map, reg, bits) > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > --- > drivers/pwm/pwm-stm32-lp.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c > index 3115abb3f52a..212bdc7d51ee 100644 > --- a/drivers/pwm/pwm-stm32-lp.c > +++ b/drivers/pwm/pwm-stm32-lp.c > @@ -140,9 +140,8 @@ static int stm32_pwm_lp_apply(struct pwm_chip *chip, struct pwm_device *pwm, > > if (reenable) { > /* Start LP timer in continuous mode */ > - ret = regmap_update_bits(priv->regmap, STM32_LPTIM_CR, > - STM32_LPTIM_CNTSTRT, > - STM32_LPTIM_CNTSTRT); > + ret = regmap_set_bits(priv->regmap, STM32_LPTIM_CR, > + STM32_LPTIM_CNTSTRT); Hi Uwe, One minor suggestion here: could fit into a single line. You can add my: Tested-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> Best Regards, Thanks Fabrice > if (ret) { > regmap_write(priv->regmap, STM32_LPTIM_CR, 0); > goto err;
On Wed, Nov 23, 2022 at 11:23:14AM +0100, Fabrice Gasnier wrote: > On 11/15/22 12:13, Uwe Kleine-König wrote: > > Found using coccinelle and the following semantic patch: > > > > @@ > > expression map, reg, bits; > > @@ > > > > - regmap_update_bits(map, reg, bits, bits) > > + regmap_set_bits(map, reg, bits) > > > > @@ > > expression map, reg, bits; > > @@ > > > > - regmap_update_bits(map, reg, bits, 0) > > + regmap_clear_bits(map, reg, bits) > > > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > > --- > > drivers/pwm/pwm-stm32-lp.c | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c > > index 3115abb3f52a..212bdc7d51ee 100644 > > --- a/drivers/pwm/pwm-stm32-lp.c > > +++ b/drivers/pwm/pwm-stm32-lp.c > > @@ -140,9 +140,8 @@ static int stm32_pwm_lp_apply(struct pwm_chip *chip, struct pwm_device *pwm, > > > > if (reenable) { > > /* Start LP timer in continuous mode */ > > - ret = regmap_update_bits(priv->regmap, STM32_LPTIM_CR, > > - STM32_LPTIM_CNTSTRT, > > - STM32_LPTIM_CNTSTRT); > > + ret = regmap_set_bits(priv->regmap, STM32_LPTIM_CR, > > + STM32_LPTIM_CNTSTRT); > > Hi Uwe, > > One minor suggestion here: could fit into a single line. That would make the line 89 chars long (counting tag as usual as 8). Up to now there is no line longer than 78 chars. So I'd not join the two lines. Best regards Uwe
diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c index 3115abb3f52a..212bdc7d51ee 100644 --- a/drivers/pwm/pwm-stm32-lp.c +++ b/drivers/pwm/pwm-stm32-lp.c @@ -140,9 +140,8 @@ static int stm32_pwm_lp_apply(struct pwm_chip *chip, struct pwm_device *pwm, if (reenable) { /* Start LP timer in continuous mode */ - ret = regmap_update_bits(priv->regmap, STM32_LPTIM_CR, - STM32_LPTIM_CNTSTRT, - STM32_LPTIM_CNTSTRT); + ret = regmap_set_bits(priv->regmap, STM32_LPTIM_CR, + STM32_LPTIM_CNTSTRT); if (ret) { regmap_write(priv->regmap, STM32_LPTIM_CR, 0); goto err;
Found using coccinelle and the following semantic patch: @@ expression map, reg, bits; @@ - regmap_update_bits(map, reg, bits, bits) + regmap_set_bits(map, reg, bits) @@ expression map, reg, bits; @@ - regmap_update_bits(map, reg, bits, 0) + regmap_clear_bits(map, reg, bits) Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- drivers/pwm/pwm-stm32-lp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)