Skip to content

Commit f79f060

Browse files
committed
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>
1 parent 09857e3 commit f79f060

5 files changed

Lines changed: 17 additions & 10 deletions

File tree

‎block/bsg.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,8 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
10441044
bcd->release = release;
10451045
kref_init(&bcd->ref);
10461046
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);
10481049
if (IS_ERR(class_dev)) {
10491050
ret = PTR_ERR(class_dev);
10501051
goto put_dev;

‎drivers/block/aoe/aoechr.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,9 @@ aoechr_init(void)
277277
return PTR_ERR(aoe_class);
278278
}
279279
for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
280-
device_create(aoe_class, NULL,
281-
MKDEV(AOE_MAJOR, chardevs[i].minor), chardevs[i].name);
280+
device_create_drvdata(aoe_class, NULL,
281+
MKDEV(AOE_MAJOR, chardevs[i].minor),
282+
NULL, chardevs[i].name);
282283

283284
return 0;
284285
}

‎drivers/block/paride/pg.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,9 @@ static int __init pg_init(void)
686686
for (unit = 0; unit < PG_UNITS; unit++) {
687687
struct pg *dev = &devices[unit];
688688
if (dev->present)
689-
device_create(pg_class, NULL, MKDEV(major, unit),
690-
"pg%u", unit);
689+
device_create_drvdata(pg_class, NULL,
690+
MKDEV(major, unit), NULL,
691+
"pg%u", unit);
691692
}
692693
err = 0;
693694
goto out;

‎drivers/block/paride/pt.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -979,10 +979,12 @@ static int __init pt_init(void)
979979

980980
for (unit = 0; unit < PT_UNITS; unit++)
981981
if (pt[unit].present) {
982-
device_create(pt_class, NULL, MKDEV(major, unit),
983-
"pt%d", unit);
984-
device_create(pt_class, NULL, MKDEV(major, unit + 128),
985-
"pt%dn", unit);
982+
device_create_drvdata(pt_class, NULL,
983+
MKDEV(major, unit), NULL,
984+
"pt%d", unit);
985+
device_create_drvdata(pt_class, NULL,
986+
MKDEV(major, unit + 128), NULL,
987+
"pt%dn", unit);
986988
}
987989
goto out;
988990

‎drivers/block/pktcdvd.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ static struct kobj_type kobj_pkt_type_wqueue = {
303303
static void pkt_sysfs_dev_new(struct pktcdvd_device *pd)
304304
{
305305
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);
307309
if (IS_ERR(pd->dev))
308310
pd->dev = NULL;
309311
}

0 commit comments

Comments
 (0)