diff options
author | Julia Lawall <Julia.Lawall@inria.fr> | 2024-01-20 21:56:11 +0100 |
---|---|---|
committer | Julia Lawall <Julia.Lawall@inria.fr> | 2024-01-20 21:56:11 +0100 |
commit | ff82e84e80fc0c93095f5a36e0a3508ac121ab80 (patch) | |
tree | 3279cd0ec1274b4cd443bfebce403a8e5f0d60ad /scripts | |
parent | coccinelle: device_attr_show: Adapt to the latest Documentation/filesystems/s... (diff) | |
download | linux-ff82e84e80fc0c93095f5a36e0a3508ac121ab80.tar.xz linux-ff82e84e80fc0c93095f5a36e0a3508ac121ab80.zip |
coccinelle: device_attr_show: simplify patch case
Replacing the final expression argument by ... allows the format
string to have multiple arguments.
It also has the advantage of allowing the change to be recognized as
a change in a single statement, thus avoiding adding unneeded braces.
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/coccinelle/api/device_attr_show.cocci | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/scripts/coccinelle/api/device_attr_show.cocci b/scripts/coccinelle/api/device_attr_show.cocci index 634514937e63..550d1d2fc02a 100644 --- a/scripts/coccinelle/api/device_attr_show.cocci +++ b/scripts/coccinelle/api/device_attr_show.cocci @@ -34,15 +34,10 @@ expression BUF, SZ, FORMAT, STR; ssize_t show(struct device *dev, struct device_attribute *attr, char *buf) { <... -( return -- snprintf(BUF, SZ, FORMAT, STR); -+ sysfs_emit(BUF, FORMAT, STR); -| - return -- snprintf(BUF, SZ, STR); -+ sysfs_emit(BUF, STR); -) +- snprintf(BUF, SZ, FORMAT ++ sysfs_emit(BUF, FORMAT + ,...); ...> } |