Hi,

Julia is right about the typdef dev_t.
It is infered automatically.

Note that dev_t devid is sometime not local and thus
you can not write

 dev_t devid;
 ...
 foo(devid)

The following seems to work on cuse and rtc-dev.
I haven't not look at the other sites which are
proposed for modification.
=====================================

@ fs_h @
// no metavars here
@@

#include <linux/fs.h>

// depending upon this fs_h rule defeats below rules in some
// instances, cuz some users dont include header (directly)
// ex: drivers/tty/pty.c


@ register_chrdev_region @ // depends on fs_h @
dev_t devid;
expression ct;
identifier name;
@@

- register_chrdev_region(devid, ct, name)
+ register_chrdev_ids(&devid, ct, name)

@ for_fuse_cuse @
int rc;
dev_t devt;
expression min;
expression ct, devname;
@@

        devt = MKDEV(...);
        ... when != devt  // no harm to purpose, may help other apps?
-        if (!MAJOR(devt))
-                rc = alloc_chrdev_region(&devt, min, ct, devname);
-        else
-                rc = register_chrdev_region(devt, ct, devname);
+       rc = register_chrdev_ids(&devt, CT, devname);

@ for_rtc_dev depends on !for_fuse_cuse @ // ./drivers/rtc/rtc-dev.c
dev_t rtc_devt;
expression maj, ct, nm;
@@
-       alloc_chrdev_region(&rtc_devt, maj, ct, nm)
+       register_chrdev_ids(&rtc_devt, maj, ct, nm)
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to