aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-05-21 15:52:33 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-07-22 00:54:41 -0400
commitf79f060561d04a38d41e773ade9baafce3c96179 (patch)
tree42c8510983db05ba8a68626732940cfa73d6b60f
parent09857e35cdccf2457bb03c6d7595adc210a517cc (diff)
device create: block: convert device_create to device_create_drvdata
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>
-rw-r--r--block/bsg.c3
-rw-r--r--drivers/block/aoe/aoechr.c5
-rw-r--r--drivers/block/paride/pg.c5
-rw-r--r--drivers/block/paride/pt.c10
-rw-r--r--drivers/block/pktcdvd.c4
5 files changed, 17 insertions, 10 deletions
diff --git a/block/bsg.c b/block/bsg.c
index 5fb9b0bdbe85..5a68b09a69ba 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -1044,7 +1044,8 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
1044 bcd->release = release; 1044 bcd->release = release;
1045 kref_init(&bcd->ref); 1045 kref_init(&bcd->ref);
1046 dev = MKDEV(bsg_major, bcd->minor); 1046 dev = MKDEV(bsg_major, bcd->minor);
1047 class_dev = device_create(bsg_class, parent, dev, "%s", devname); 1047 class_dev = device_create_drvdata(bsg_class, parent, dev, NULL,
1048 "%s", devname);
1048 if (IS_ERR(class_dev)) { 1049 if (IS_ERR(class_dev)) {
1049 ret = PTR_ERR(class_dev); 1050 ret = PTR_ERR(class_dev);
1050 goto put_dev; 1051 goto put_dev;
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
index d1de68a31920..c04440cd6a32 100644
--- a/drivers/block/aoe/aoechr.c
+++ b/drivers/block/aoe/aoechr.c
@@ -277,8 +277,9 @@ aoechr_init(void)
277 return PTR_ERR(aoe_class); 277 return PTR_ERR(aoe_class);
278 } 278 }
279 for (i = 0; i < ARRAY_SIZE(chardevs); ++i) 279 for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
280 device_create(aoe_class, NULL, 280 device_create_drvdata(aoe_class, NULL,
281 MKDEV(AOE_MAJOR, chardevs[i].minor), chardevs[i].name); 281 MKDEV(AOE_MAJOR, chardevs[i].minor),
282 NULL, chardevs[i].name);
282 283
283 return 0; 284 return 0;
284} 285}
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index 9d92636350e5..d731ca42f802 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -686,8 +686,9 @@ static int __init pg_init(void)
686 for (unit = 0; unit < PG_UNITS; unit++) { 686 for (unit = 0; unit < PG_UNITS; unit++) {
687 struct pg *dev = &devices[unit]; 687 struct pg *dev = &devices[unit];
688 if (dev->present) 688 if (dev->present)
689 device_create(pg_class, NULL, MKDEV(major, unit), 689 device_create_drvdata(pg_class, NULL,
690 "pg%u", unit); 690 MKDEV(major, unit), NULL,
691 "pg%u", unit);
691 } 692 }
692 err = 0; 693 err = 0;
693 goto out; 694 goto out;
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 5c74c3574a5a..673b8b2fd337 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -979,10 +979,12 @@ static int __init pt_init(void)
979 979
980 for (unit = 0; unit < PT_UNITS; unit++) 980 for (unit = 0; unit < PT_UNITS; unit++)
981 if (pt[unit].present) { 981 if (pt[unit].present) {
982 device_create(pt_class, NULL, MKDEV(major, unit), 982 device_create_drvdata(pt_class, NULL,
983 "pt%d", unit); 983 MKDEV(major, unit), NULL,
984 device_create(pt_class, NULL, MKDEV(major, unit + 128), 984 "pt%d", unit);
985 "pt%dn", unit); 985 device_create_drvdata(pt_class, NULL,
986 MKDEV(major, unit + 128), NULL,
987 "pt%dn", unit);
986 } 988 }
987 goto out; 989 goto out;
988 990
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 45bee918c46a..158eed4d5161 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -303,7 +303,9 @@ static struct kobj_type kobj_pkt_type_wqueue = {
303static void pkt_sysfs_dev_new(struct pktcdvd_device *pd) 303static void pkt_sysfs_dev_new(struct pktcdvd_device *pd)
304{ 304{
305 if (class_pktcdvd) { 305 if (class_pktcdvd) {
306 pd->dev = device_create(class_pktcdvd, NULL, pd->pkt_dev, "%s", pd->name); 306 pd->dev = device_create_drvdata(class_pktcdvd, NULL,
307 pd->pkt_dev, NULL,
308 "%s", pd->name);
307 if (IS_ERR(pd->dev)) 309 if (IS_ERR(pd->dev))
308 pd->dev = NULL; 310 pd->dev = NULL;
309 } 311 }