[cocci] [PATCH v3 2/6] coccinelle: misc: Add field_modify script
Markus Elfring
Markus.Elfring at web.de
Wed Apr 23 09:35:50 PDT 2025
…
>> -reg &= ~mask;
>> -reg |= FIELD_PREP
>> + FIELD_MODIFY
>> (mask,
>> + ®,
>> val
>> );
…
> With this code variant, there is no space prior to ®, here is the
> example code changes generated by the SmPL code as below, is this expected?
…
> +++ b/drivers/phy/starfive/phy-jh7110-dphy-tx.c
> @@ -244,8 +244,7 @@ static int stf_dphy_configure(struct phy
> i = stf_dphy_get_config_index(bitrate);
>
> tmp = readl(dphy->topsys + STF_DPHY_APBIFSAIF_SYSCFG(100));
> - tmp &= ~STF_DPHY_REFCLK_IN_SEL;
> - tmp |= FIELD_PREP(STF_DPHY_REFCLK_IN_SEL, STF_DPHY_REFCLK_12M);
> + FIELD_MODIFY(STF_DPHY_REFCLK_IN_SEL,&tmp, STF_DPHY_REFCLK_12M);
> writel(tmp, dphy->topsys + STF_DPHY_APBIFSAIF_SYSCFG(100));
The Coccinelle software is still evolving somehow.
Thus your test result can trigger further development considerations.
I hope that clarifications and corresponding improvements can be achieved
also according to such source code layout concerns.
Regards,
Markus
More information about the linux-arm-kernel
mailing list