diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-12-18 01:05:35 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:37 -0500 |
commit | 649316b25b148e57c8ef71748fc69fa6db276ad1 (patch) | |
tree | ad8fb0a11b90f0cac75bbadf53a8e344fd43574a /drivers | |
parent | d5a379f77bc79c0a78b26f8c0159f55c8b11d68b (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')
-rw-r--r-- | drivers/md/md.c | 13 |
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) | |||
1383 | return -EBUSY; | 1383 | return -EBUSY; |
1384 | } | 1384 | } |
1385 | bdevname(rdev->bdev,b); | 1385 | bdevname(rdev->bdev,b); |
1386 | if (kobject_set_name(&rdev->kobj, "dev-%s", b) < 0) | 1386 | while ( (s=strchr(b, '/')) != NULL) |
1387 | return -ENOMEM; | ||
1388 | while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL) | ||
1389 | *s = '!'; | 1387 | *s = '!'; |
1390 | 1388 | ||
1391 | rdev->mddev = mddev; | 1389 | rdev->mddev = mddev; |
1392 | printk(KERN_INFO "md: bind<%s>\n", b); | 1390 | printk(KERN_INFO "md: bind<%s>\n", b); |
1393 | 1391 | ||
1394 | rdev->kobj.parent = &mddev->kobj; | 1392 | if ((err = kobject_add_ng(&rdev->kobj, &mddev->kobj, "dev-%s", b))) |
1395 | if ((err = kobject_add(&rdev->kobj))) | ||
1396 | goto fail; | 1393 | goto fail; |
1397 | 1394 | ||
1398 | if (rdev->bdev->bd_part) | 1395 | 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 | if (err) | 2033 | if (err) |
2037 | goto abort_free; | 2034 | goto abort_free; |
2038 | 2035 | ||
2039 | rdev->kobj.parent = NULL; | 2036 | kobject_init_ng(&rdev->kobj, &rdev_ktype); |
2040 | rdev->kobj.ktype = &rdev_ktype; | ||
2041 | kobject_init(&rdev->kobj); | ||
2042 | 2037 | ||
2043 | rdev->desc_nr = -1; | 2038 | rdev->desc_nr = -1; |
2044 | rdev->saved_raid_disk = -1; | 2039 | rdev->saved_raid_disk = -1; |