Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f79f0605 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 09857e35
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1044,7 +1044,8 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
	bcd->release = release;
	bcd->release = release;
	kref_init(&bcd->ref);
	kref_init(&bcd->ref);
	dev = MKDEV(bsg_major, bcd->minor);
	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)) {
	if (IS_ERR(class_dev)) {
		ret = PTR_ERR(class_dev);
		ret = PTR_ERR(class_dev);
		goto put_dev;
		goto put_dev;
+3 −2
Original line number Original line Diff line number Diff line
@@ -277,8 +277,9 @@ aoechr_init(void)
		return PTR_ERR(aoe_class);
		return PTR_ERR(aoe_class);
	}
	}
	for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
	for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
		device_create(aoe_class, NULL,
		device_create_drvdata(aoe_class, NULL,
			      MKDEV(AOE_MAJOR, chardevs[i].minor), chardevs[i].name);
				      MKDEV(AOE_MAJOR, chardevs[i].minor),
				      NULL, chardevs[i].name);


	return 0;
	return 0;
}
}
+3 −2
Original line number Original line Diff line number Diff line
@@ -686,7 +686,8 @@ static int __init pg_init(void)
	for (unit = 0; unit < PG_UNITS; unit++) {
	for (unit = 0; unit < PG_UNITS; unit++) {
		struct pg *dev = &devices[unit];
		struct pg *dev = &devices[unit];
		if (dev->present)
		if (dev->present)
			device_create(pg_class, NULL, MKDEV(major, unit),
			device_create_drvdata(pg_class, NULL,
					      MKDEV(major, unit), NULL,
					      "pg%u", unit);
					      "pg%u", unit);
	}
	}
	err = 0;
	err = 0;
+6 −4
Original line number Original line Diff line number Diff line
@@ -979,9 +979,11 @@ static int __init pt_init(void)


	for (unit = 0; unit < PT_UNITS; unit++)
	for (unit = 0; unit < PT_UNITS; unit++)
		if (pt[unit].present) {
		if (pt[unit].present) {
			device_create(pt_class, NULL, MKDEV(major, unit),
			device_create_drvdata(pt_class, NULL,
					      MKDEV(major, unit), NULL,
					      "pt%d", unit);
					      "pt%d", unit);
			device_create(pt_class, NULL, MKDEV(major, unit + 128),
			device_create_drvdata(pt_class, NULL,
					      MKDEV(major, unit + 128), NULL,
					      "pt%dn", unit);
					      "pt%dn", unit);
		}
		}
	goto out;
	goto out;
+3 −1
Original line number Original line Diff line number Diff line
@@ -303,7 +303,9 @@ static struct kobj_type kobj_pkt_type_wqueue = {
static void pkt_sysfs_dev_new(struct pktcdvd_device *pd)
static void pkt_sysfs_dev_new(struct pktcdvd_device *pd)
{
{
	if (class_pktcdvd) {
	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))
		if (IS_ERR(pd->dev))
			pd->dev = NULL;
			pd->dev = NULL;
	}
	}