Nicolas, Julia,

thanks for the help.
With it, Ive gotten most call-sites (40 of them) transformed automatically.

the ones that remain have MKDEV () calls inline.
There are only a few of these, so I could do them manually,
but, well, I want to build my spatch-fu.


drivers/tty/tty_io.c:   unregister_chrdev_region(MKDEV(driver->major,
driver->minor_start),
drivers/tty/tty_io.c:       register_chrdev_region(MKDEV(TTYAUX_MAJOR,
0), 1, "/dev/tty") < 0)
drivers/tty/tty_io.c:       register_chrdev_region(MKDEV(TTYAUX_MAJOR,
1), 1, "/dev/console") < 0)

Ive tried this rule to fix it:

@ mdev_inline @
dev_t devid;
expression ct, name;
expression major, minor;
position p;
@@

 {
 @p
 ...
- register_chrdev_region(MKDEV(major, minor), ct, name)
 ...
 }

 @p
+ dev_t devid = MKDEV(major, minor);

+ register_chrdev_ids(devid, ct, name)


181 186
Fatal error: exception Failure("plus: parse error:
 = File "../chrdev.cocci-inline", line 17, column 8,  charpos = 181
    around = 'devid', whole content = + dev_t devid = MKDEV(major, minor);
")

Even if this was legal, it would probably put
the declaration-initialization statement below code,
which isnt C89 - maybe C99 is ok for kernel, but probly not.

How do I insert it at the top of the innermost scope ?
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to