aboutsummaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorGreg Kroah-Hartman2007-12-17 23:05:35 -0700
committerGreg Kroah-Hartman2008-01-24 20:40:37 -0800
commit649316b25b148e57c8ef71748fc69fa6db276ad1 (patch)
treead8fb0a11b90f0cac75bbadf53a8e344fd43574a /drivers/md
parentd5a379f77bc79c0a78b26f8c0159f55c8b11d68b (diff)
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: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index f79efb359215..7ae9740c483d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1383,16 +1383,13 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
return -EBUSY;
}
bdevname(rdev->bdev,b);
- if (kobject_set_name(&rdev->kobj, "dev-%s", b) < 0)
- return -ENOMEM;
- while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL)
+ while ( (s=strchr(b, '/')) != NULL)
*s = '!';
-
+
rdev->mddev = mddev;
printk(KERN_INFO "md: bind<%s>\n", b);
- rdev->kobj.parent = &mddev->kobj;
- if ((err = kobject_add(&rdev->kobj)))
+ if ((err = kobject_add_ng(&rdev->kobj, &mddev->kobj, "dev-%s", b)))
goto fail;
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
if (err)
goto abort_free;
- rdev->kobj.parent = NULL;
- rdev->kobj.ktype = &rdev_ktype;
- kobject_init(&rdev->kobj);
+ kobject_init_ng(&rdev->kobj, &rdev_ktype);
rdev->desc_nr = -1;
rdev->saved_raid_disk = -1;