[PATCH 0/5] pwm: Use regmap_clear_bits and regmap_set_bits where applicable
Uwe Kleine-König
u.kleine-koenig at pengutronix.de
Thu Nov 17 05:52:37 PST 2022
Hello,
On Tue, Nov 15, 2022 at 12:13:42PM +0100, Uwe Kleine-König wrote:
> I recently learned a bit of coccinelle and triggered by Paul Cercueil's
> patch that replaces regmap_update_bits() by regmap_set_bits() and
> regmap_clear_bits() where applicable in the jz4740 pwm driver[1] I
> created a cocci patch for such calls.
Pointing to this series I asked broonie in irc if a conversion like that
would be suitable to do in the complete tree. He objected that doing
that mechanically is probably wrong. His explicit concern was that a
call to regmap_clear_bits() (or regmap_set_bits()) in a series of
regmap_update_bits() is more disturbing than helpful.
So I looked at the remaining calls to regmap_update_bits() in the
drivers I converted in this series:
- pwm-fsl-ftm
There are two calls left that set bits in a mask (these should stay
as they are) and one:
reg_polarity = 0;
if (newstate->polarity == PWM_POLARITY_INVERSED)
reg_polarity = BIT(pwm->hwpwm);
regmap_update_bits(fpc->regmap, FTM_POL, BIT(pwm->hwpwm), reg_polarity);
which could benefit from a conversion (though I expect that to be
controversial).
The converted calls are all independent of the remaining
regmap_update_bits().
- pwm-img
No regmap_update_bits() calls left.
- pwm-iqs620a
There is one call left that does:
return regmap_update_bits(iqs62x->regmap, IQS620_PWR_SETTINGS,
IQS620_PWR_SETTINGS_PWM_OUT, 0xff);
I think this is a bug because IQS620_PWR_SETTINGS_PWM_OUT is only
0xf.
- pwm-stm32-lp
No regmap_update_bits() calls left.
- pwm-stm32
There are several calls left, some of them also near converted calls.
My personal opinion is, that the conversion is fine anyhow.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20221117/b7209386/attachment.sig>
More information about the linux-arm-kernel
mailing list