On 8/30/20 3:43 AM, Joe Perches wrote: > $ cat sysfs_emit.cocci > @@ > identifier d_show =~ "^.*show.*$"; I think this additional pattern will allow to take more functions into the scope. @da@ identifier show, store; expression name, mode; @@ ( DEVICE_ATTR(name, mode, show, store) | DEVICE_ATTR_PREALLOC(name, mode, show, store) | DEVICE_ATTR_IGNORE_LOCKDEP(name, mode, show, store) ) @@ // I think device_show_ulong, device_show_int, device_show_bool // functions deserve explicit handling because they are somewhat // reference implementations. identifier d_show = { da.show, device_show_ulong, device_show_int, device_show_bool }; identifier dev, attr, buf; @@ * ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf) { ... } I tried also to handle DEVICE_ATTR_RW, but I failed to use fresh identifier. This doesn't work: @darw@ identifier name; @@ ( DEVICE_ATTR_RW(name) | DEVICE_ATTR_RO(name) | DEVICE_ATTR_WO(name) ) @@ identifier darw.name; fresh identifier d_show = name ## "_show"; // <== parse error identifier dev, attr, buf; @@ * ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf) { ... } Regards, Denis