[cocci] [PATCH v3 2/6] coccinelle: misc: Add field_modify script
Markus Elfring
Markus.Elfring at web.de
Wed Apr 23 04:01:03 PDT 2025
> This script finds and suggests conversions of opencoded field
> modify patterns with the wrapper FIELD_MODIFY() API defined in
> include/linux/bitfield.h for better readability.
See also:
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.15-rc3#n94
…
> +++ b/scripts/coccinelle/misc/field_modify.cocci
> @@ -0,0 +1,24 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +///
I suggest to omit a blank comment line here.
> +/// Replaced below code with the wrapper FIELD_MODIFY(MASK, ®, val)
Replace?
…
> +// Copyright (C) 2025 Qualcomm Innovation Center, Inc.
Copyright: ?
> +// URL: https://coccinelle.gitlabpages.inria.fr/website
I suggest to omit such information here.
…
> +virtual patch
How do you think about to support additional operation modes?
…
> +- reg &= ~mask;
> +- reg |= FIELD_PREP(mask, val);
> ++ FIELD_MODIFY(mask, ®, val);
Would you like to integrate the following SmPL code variant?
-reg &= ~mask;
-reg |= FIELD_PREP
+ FIELD_MODIFY
(mask,
+ ®,
val
);
Regards,
Markus
More information about the linux-arm-kernel
mailing list