Commit 649316b2 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Kobject: convert drivers/md/md.c to use kobject_init/add_ng()

This converts the code to use the new kobject functions, cleaning up the
logic in doing so.

Cc: Neil Brown <neilb@suse.de>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d5a379f7
...@@ -1383,16 +1383,13 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) ...@@ -1383,16 +1383,13 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
return -EBUSY; return -EBUSY;
} }
bdevname(rdev->bdev,b); bdevname(rdev->bdev,b);
if (kobject_set_name(&rdev->kobj, "dev-%s", b) < 0) while ( (s=strchr(b, '/')) != NULL)
return -ENOMEM;
while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL)
*s = '!'; *s = '!';
rdev->mddev = mddev; rdev->mddev = mddev;
printk(KERN_INFO "md: bind<%s>\n", b); printk(KERN_INFO "md: bind<%s>\n", b);
rdev->kobj.parent = &mddev->kobj; if ((err = kobject_add_ng(&rdev->kobj, &mddev->kobj, "dev-%s", b)))
if ((err = kobject_add(&rdev->kobj)))
goto fail; goto fail;
if (rdev->bdev->bd_part) if (rdev->bdev->bd_part)
...@@ -2036,9 +2033,7 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int super_format, int super_mi ...@@ -2036,9 +2033,7 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int super_format, int super_mi
if (err) if (err)
goto abort_free; goto abort_free;
rdev->kobj.parent = NULL; kobject_init_ng(&rdev->kobj, &rdev_ktype);
rdev->kobj.ktype = &rdev_ktype;
kobject_init(&rdev->kobj);
rdev->desc_nr = -1; rdev->desc_nr = -1;
rdev->saved_raid_disk = -1; rdev->saved_raid_disk = -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment