Message ID | 20250113-b4-imx-gpio-base-warning-v1-2-0a28731a5cf6@pengutronix.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | gpio: mxc: silence warning about GPIO base being statically allocated | expand |
On Mon, Jan 13, 2025 at 11:19 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote: > gpio_chip::legacy_state_base was recently added as opt-out for > existing drivers and shouldn't be used for new drivers. It's thus > sensible to add a deprecation warning whenever it's used. > > This doesn't fit with the existing deprecated API check, because it > requires a `(' to follow the symbol name, so a new member specific > pattern is introduced instead. > > Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Thanks Ahmad, much appreciated!! Acked-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 7b28ad3317427a6bf9e27b77065aa3915cb13053..6c57a08833a4298573c7967b2a178fd7f46aa7ce 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -848,6 +848,13 @@ foreach my $entry (keys %deprecated_apis) { } $deprecated_apis_search = "(?:${deprecated_apis_search})"; +our %deprecated_members = ( + "legacy_static_base" => "setting .base to -1", +); + +our $deprecated_memb_search = "(?:" . join("|", keys %deprecated_members) . ")"; +%deprecated_apis = (%deprecated_apis, %deprecated_members); + our $mode_perms_world_writable = qr{ S_IWUGO | S_IWOTH | @@ -7407,8 +7414,8 @@ sub process { } # check for deprecated apis - if ($line =~ /\b($deprecated_apis_search)\b\s*\(/) { - my $deprecated_api = $1; + if ($line =~ /\b(?<old>$deprecated_apis_search)\b\s*\(|(?:->|\.)(?<old>$deprecated_memb_search)\b/) { + my $deprecated_api = ${^CAPTURE}{old}; my $new_api = $deprecated_apis{$deprecated_api}; WARN("DEPRECATED_API", "Deprecated use of '$deprecated_api', prefer '$new_api' instead\n" . $herecurr);
gpio_chip::legacy_state_base was recently added as opt-out for existing drivers and shouldn't be used for new drivers. It's thus sensible to add a deprecation warning whenever it's used. This doesn't fit with the existing deprecated API check, because it requires a `(' to follow the symbol name, so a new member specific pattern is introduced instead. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- scripts/checkpatch.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)