Is it me not understanding cocci grammar again? Given these input and cocci script files: Why isn't the show_test1 function transformed? Why is only the show_test2 function transformed? The only difference between the files is some commented out lines with a for loop and if test. $ cat test.c static ssize_t test1_show(struct device *d, struct device_attribute *a, char *buffer) { ssize_t rc = 0; for (cnt = 0; cnt < s_attr->size; cnt++) { if (cnt && !(cnt % 16)) { if (PAGE_SIZE - rc) buffer[rc++] = '\n'; } rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "%02x ", ((unsigned char *)s_attr->data)[cnt]); } return rc; } static ssize_t test2_show(struct device *d, struct device_attribute *a, char *buffer) { ssize_t rc = 0; // for (cnt = 0; cnt < s_attr->size; cnt++) { // if (cnt && !(cnt % 16)) { if (PAGE_SIZE - rc) buffer[rc++] = '\n'; // } rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "%02x ", ((unsigned char *)s_attr->data)[cnt]); // } return rc; } $ cat sysfs_emit_rename.cocci @@ identifier d_show =~ "^.*show.*$"; identifier arg1, arg2, arg3; @@ ssize_t d_show(struct device * - arg1 + dev , struct device_attribute * - arg2 + attr , char * - arg3 + buf ) { ... ( - arg1 + dev | - arg2 + attr | - arg3 + buf ) ... when any } $ spatch -sp-file sysfs_emit_rename.cocci test.c init_defs_builtins: /usr/local/bin/../lib/coccinelle/standard.h HANDLING: test.c diff = --- test.c +++ /tmp/cocci-output-68270-4c9b1f-test.c @@ -16,18 +16,18 @@ static ssize_t test1_show(struct device return rc; } -static ssize_t test2_show(struct device *d, - struct device_attribute *a, - char *buffer) +static ssize_t test2_show(struct device *dev, + struct device_attribute *attr, + char *buf) { ssize_t rc = 0; // for (cnt = 0; cnt < s_attr->size; cnt++) { // if (cnt && !(cnt % 16)) { if (PAGE_SIZE - rc) - buffer[rc++] = '\n'; + buf[rc++] = '\n'; // } - rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "%02x ", + rc += scnprintf(buf + rc, PAGE_SIZE - rc, "%02x ", ((unsigned char *)s_attr->data)[cnt]); // } return rc; $