Skip to contentSkip to conversation

pwm: iqs620a: Replace one remaining instance of regmap_update_bits()

PATCH Superseded Jeff LaBundy 2 participants 3 messages Dec 27, 2022 PWM

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pwm: iqs620a: Replace one remaining instance of regmap_update_bits()

The call to regmap_update_bits() which was responsible for clearing the PWM output enable register bit was recently dropped in favor of a call to regmap_clear_bits(), thereby simplifying the code.

Similarly, the call to regmap_update_bits() which sets the same bit can be simplified with a call to regmap_set_bits().

Fixes 2c85895bf3d2 ("pwm: iqs620a: Use regmap_clear_bits and regmap_set_bits where applicable")
---
 drivers/pwm/pwm-iqs620a.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-iqs620a.c +2 -2
index 4987ca940b64..8362b4870c66 100644
@@ -55,8 +55,8 @@ static int iqs620_pwm_init(struct iqs620_pwm_private *iqs620_pwm,
 	if (ret)
 		return ret;
 
-	return regmap_update_bits(iqs62x->regmap, IQS620_PWR_SETTINGS,
-				  IQS620_PWR_SETTINGS_PWM_OUT, 0xff);
+	return regmap_set_bits(iqs62x->regmap, IQS620_PWR_SETTINGS,
+			       IQS620_PWR_SETTINGS_PWM_OUT);
 }
 
 static int iqs620_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
Signature · 1 line
2.34.1
#1 lore raw

Hello Jeff,

Quoted 8 lines · Jeff LaBundy

The call to regmap_update_bits() which was responsible for clearing the PWM output enable register bit was recently dropped in favor of a call to regmap_clear_bits(), thereby simplifying the code.

Similarly, the call to regmap_update_bits() which sets the same bit can be simplified with a call to regmap_set_bits().

Fixes 2c85895bf3d2 ("pwm: iqs620a: Use regmap_clear_bits and regmap_set_bits where applicable")

I wouldn't call this a fix. This trailer triggers the stable guys to backport the commit for stable. I wouldn't support that.

Quoted 10 lines
---
 drivers/pwm/pwm-iqs620a.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-iqs620a.c +0 -0
index 4987ca940b64..8362b4870c66 100644

drivers/pwm/pwm-iqs620a.c static int iqs620_pwm_init(struct iqs620_pwm_private *iqs620_pwm, · line 59

Quoted 5 lines
drivers/pwm/pwm-iqs620a.c +0 -2
@@ -55,8 +55,8 @@ static int iqs620_pwm_init(struct iqs620_pwm_private *iqs620_pwm,
 	if (ret)
 		return ret;
 
-	return regmap_update_bits(iqs62x->regmap, IQS620_PWR_SETTINGS,
-				  IQS620_PWR_SETTINGS_PWM_OUT, 0xff);

This is strange, because val has more bits set than mask (IQS620_PWR_SETTINGS_PWM_OUT == 0x80).

drivers/pwm/pwm-iqs620a.c static int iqs620_pwm_init(struct iqs620_pwm_private *iqs620_pwm, · line 60

Quoted 3 lines
drivers/pwm/pwm-iqs620a.c +2 -0
+	return regmap_set_bits(iqs62x->regmap, IQS620_PWR_SETTINGS,
+			       IQS620_PWR_SETTINGS_PWM_OUT);
 }

The change looks fine however.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#2 lore raw

Hi Uwe,

Thank you for taking a look!

Quoted 7 lines · Uwe Kleine-König

Hello Jeff,

Quoted 4 lines · Jeff LaBundy

The call to regmap_update_bits() which was responsible for clearing the PWM output enable register bit was recently dropped in favor of a call to regmap_clear_bits(), thereby simplifying the code.

Quoted 7 lines
Quoted 4 lines

Similarly, the call to regmap_update_bits() which sets the same bit can be simplified with a call to regmap_set_bits().

Fixes 2c85895bf3d2 ("pwm: iqs620a: Use regmap_clear_bits and regmap_set_bits where applicable")

I wouldn't call this a fix. This trailer triggers the stable guys to backport the commit for stable. I wouldn't support that.

My naive assumption was this commit would get ignored by stable for the foreseeable future, since the original commit itself is not yet in any stable trees. Rather, the intent was to complete the good intentions of a recent commit and provide some context.

That being said, there is no functional change or bug to be addressed, so the argument to not call this a fix is valid as well. I will update the commit message.

Quoted 14 lines
Quoted 14 lines
---
 drivers/pwm/pwm-iqs620a.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-iqs620a.c +0 -0
index 4987ca940b64..8362b4870c66 100644
@@ -55,8 +55,8 @@ static int iqs620_pwm_init(struct iqs620_pwm_private *iqs620_pwm,
 	if (ret)
 		return ret;
 
Quoted 5 lines

drivers/pwm/pwm-iqs620a.c static int iqs620_pwm_init(struct iqs620_pwm_private *iqs620_pwm, · line 59

Quoted 2 lines
drivers/pwm/pwm-iqs620a.c +0 -2
-	return regmap_update_bits(iqs62x->regmap, IQS620_PWR_SETTINGS,
-				  IQS620_PWR_SETTINGS_PWM_OUT, 0xff);

This is strange, because val has more bits set than mask (IQS620_PWR_SETTINGS_PWM_OUT == 0x80).

Right, the intent was to make it blatantly obvious that all masked bits are to be set, prior to being aware that regmap_set_bits() was recently introduced at the time. Both are functionally equivalent to each other as well as regmap_update_bits(regmap, reg, mask, ~0), the last of which still exists in a handful of places. Granted I'm responsible for a few of them ;)

Quoted 13 lines

drivers/pwm/pwm-iqs620a.c static int iqs620_pwm_init(struct iqs620_pwm_private *iqs620_pwm, · line 60

Quoted 4 lines
drivers/pwm/pwm-iqs620a.c +2 -0
+	return regmap_set_bits(iqs62x->regmap, IQS620_PWR_SETTINGS,
+			       IQS620_PWR_SETTINGS_PWM_OUT);
 }

The change looks fine however.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Kind regards,
Jeff LaBundy