summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@inria.fr>2024-01-20 21:56:11 +0100
committerJulia Lawall <Julia.Lawall@inria.fr>2024-01-20 21:56:11 +0100
commitff82e84e80fc0c93095f5a36e0a3508ac121ab80 (patch)
tree3279cd0ec1274b4cd443bfebce403a8e5f0d60ad
parentcoccinelle: device_attr_show: Adapt to the latest Documentation/filesystems/s... (diff)
downloadlinux-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>
-rw-r--r--scripts/coccinelle/api/device_attr_show.cocci11
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
+ ,...);
...>
}