cocci script hints request

From: Fabio Aiuto
Date: Tue Apr 13 2021 - 05:04:44 EST


Hi,

I would like to improve the following coccinelle script:

@@
expression a, fmt;
expression list var_args;
@@

- DBG_871X_LEVEL(a, fmt, var_args);
+ printk(fmt, var_args);

I would replace the DBG_871X_LEVEL macro with printk, but
I can't find a way to add KERN_* constant prefix to the fmt
argument in the + code line. If i try this

@@
expression a, fmt;
expression list var_args;
@@

- DBG_871X_LEVEL(a, fmt, var_args);
+ printk(KERN_DEBUG fmt, var_args);

plus: parse error:
File "../test.cocci", line 94, column 20, charpos = 1171
around = 'fmt',
whole content = + printk(KERN_DEBUG fmt, var_args);

how could I do this?

thank you in advance,

fabio