device create: block: convert device_create to device_create_drvdata
authorGreg Kroah-Hartman <gregkh@suse.de>
Wed, 21 May 2008 19:52:33 +0000 (12:52 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 22 Jul 2008 04:54:41 +0000 (21:54 -0700)
device_create() is race-prone, so use the race-free
device_create_drvdata() instead as device_create() is going away.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
block/bsg.c
drivers/block/aoe/aoechr.c
drivers/block/paride/pg.c
drivers/block/paride/pt.c
drivers/block/pktcdvd.c

index 5fb9b0bdbe85b60776eb60bd6486f8f86c629587..5a68b09a69bac112758f83f855ee1a94df785df9 100644 (file)
@@ -1044,7 +1044,8 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
        bcd->release = release;
        kref_init(&bcd->ref);
        dev = MKDEV(bsg_major, bcd->minor);
-       class_dev = device_create(bsg_class, parent, dev, "%s", devname);
+       class_dev = device_create_drvdata(bsg_class, parent, dev, NULL,
+                                         "%s", devname);
        if (IS_ERR(class_dev)) {
                ret = PTR_ERR(class_dev);
                goto put_dev;
index d1de68a3192088b11f20317d5405d05c35cd5071..c04440cd6a32d5bc5031aed5ec4fe50c4d50dd67 100644 (file)
@@ -277,8 +277,9 @@ aoechr_init(void)
                return PTR_ERR(aoe_class);
        }
        for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
-               device_create(aoe_class, NULL,
-                             MKDEV(AOE_MAJOR, chardevs[i].minor), chardevs[i].name);
+               device_create_drvdata(aoe_class, NULL,
+                                     MKDEV(AOE_MAJOR, chardevs[i].minor),
+                                     NULL, chardevs[i].name);
 
        return 0;
 }
index 9d92636350e5f67f1d2ebd7b60466859b4e301f9..d731ca42f8024f48a12214b064ed5ff3d13b8543 100644 (file)
@@ -686,8 +686,9 @@ static int __init pg_init(void)
        for (unit = 0; unit < PG_UNITS; unit++) {
                struct pg *dev = &devices[unit];
                if (dev->present)
-                       device_create(pg_class, NULL, MKDEV(major, unit),
-                                     "pg%u", unit);
+                       device_create_drvdata(pg_class, NULL,
+                                             MKDEV(major, unit), NULL,
+                                             "pg%u", unit);
        }
        err = 0;
        goto out;
index 5c74c3574a5adf77bb9120d77e9f45442cb3debe..673b8b2fd337a1e22b442eba939aa4c90a407b86 100644 (file)
@@ -979,10 +979,12 @@ static int __init pt_init(void)
 
        for (unit = 0; unit < PT_UNITS; unit++)
                if (pt[unit].present) {
-                       device_create(pt_class, NULL, MKDEV(major, unit),
-                                     "pt%d", unit);
-                       device_create(pt_class, NULL, MKDEV(major, unit + 128),
-                                     "pt%dn", unit);
+                       device_create_drvdata(pt_class, NULL,
+                                             MKDEV(major, unit), NULL,
+                                             "pt%d", unit);
+                       device_create_drvdata(pt_class, NULL,
+                                             MKDEV(major, unit + 128), NULL,
+                                             "pt%dn", unit);
                }
        goto out;
 
index 45bee918c46a821e5a5c4ec3c2a74ad96b8d8e72..158eed4d516188deb82b50b9f60ddbbd502b8302 100644 (file)
@@ -303,7 +303,9 @@ static struct kobj_type kobj_pkt_type_wqueue = {
 static void pkt_sysfs_dev_new(struct pktcdvd_device *pd)
 {
        if (class_pktcdvd) {
-               pd->dev = device_create(class_pktcdvd, NULL, pd->pkt_dev, "%s", pd->name);
+               pd->dev = device_create_drvdata(class_pktcdvd, NULL,
+                                               pd->pkt_dev, NULL,
+                                               "%s", pd->name);
                if (IS_ERR(pd->dev))
                        pd->dev = NULL;
        }