aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 11:34:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 11:35:13 -0500
commitdf8dc74e8a383eaf2d9b44b80a71ec6f0e52b42e (patch)
treebc3799a43e8b94fa84b32e37b1c124d5e4868f50 /drivers/md/md.c
parent556a169dab38b5100df6f4a45b655dddd3db94c1 (diff)
parent4a3ad20ccd8f4d2a0535cf98fa83f7b561ba59a9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
This can be broken down into these major areas: - Documentation updates (language translations and fixes, as well as kobject and kset documenatation updates.) - major kset/kobject/ktype rework and fixes. This cleans up the kset and kobject and ktype relationship and architecture, making sense of things now, and good documenation and samples are provided for others to use. Also the attributes for kobjects are much easier to handle now. This cleaned up a LOT of code all through the kernel, making kobjects easier to use if you want to. - struct bus_type has been reworked to now handle the lifetime rules properly, as the kobject is properly dynamic. - struct driver has also been reworked, and now the lifetime issues are resolved. - the block subsystem has been converted to use struct device now, and not "raw" kobjects. This patch has been in the -mm tree for over a year now, and finally all the issues are worked out with it. Older distros now properly work with new kernels, and no userspace updates are needed at all. - nozomi driver is added. This has also been in -mm for a long time, and many people have asked for it to go in. It is now in good enough shape to do so. - lots of class_device conversions to use struct device instead. The tree is almost all cleaned up now, only SCSI and IB is the remaining code to fix up... * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: (196 commits) Driver core: coding style fixes Kobject: fix coding style issues in kobject c files Kobject: fix coding style issues in kobject.h Driver core: fix coding style issues in device.h spi: use class iteration api scsi: use class iteration api rtc: use class iteration api power supply : use class iteration api ieee1394: use class iteration api Driver Core: add class iteration api Driver core: Cleanup get_device_parent() in device_add() and device_move() UIO: constify function pointer tables Driver Core: constify the name passed to platform_device_register_simple driver core: fix build with SYSFS=n sysfs: make SYSFS_DEPRECATED depend on SYSFS Driver core: use LIST_HEAD instead of call to INIT_LIST_HEAD in __init kobject: add sample code for how to use ksets/ktypes/kobjects kobject: add sample code for how to use kobjects in a simple manner. kobject: update the kobject/kset documentation kobject: remove old, outdated documentation. ...
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index cef9ebd5a046..c28a120b4161 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -231,7 +231,7 @@ static void mddev_put(mddev_t *mddev)
231 list_del(&mddev->all_mddevs); 231 list_del(&mddev->all_mddevs);
232 spin_unlock(&all_mddevs_lock); 232 spin_unlock(&all_mddevs_lock);
233 blk_cleanup_queue(mddev->queue); 233 blk_cleanup_queue(mddev->queue);
234 kobject_unregister(&mddev->kobj); 234 kobject_put(&mddev->kobj);
235 } else 235 } else
236 spin_unlock(&all_mddevs_lock); 236 spin_unlock(&all_mddevs_lock);
237} 237}
@@ -1383,22 +1383,19 @@ 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(&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)
1399 ko = &rdev->bdev->bd_part->kobj; 1396 ko = &rdev->bdev->bd_part->dev.kobj;
1400 else 1397 else
1401 ko = &rdev->bdev->bd_disk->kobj; 1398 ko = &rdev->bdev->bd_disk->dev.kobj;
1402 if ((err = sysfs_create_link(&rdev->kobj, ko, "block"))) { 1399 if ((err = sysfs_create_link(&rdev->kobj, ko, "block"))) {
1403 kobject_del(&rdev->kobj); 1400 kobject_del(&rdev->kobj);
1404 goto fail; 1401 goto fail;
@@ -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(&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;
@@ -3054,6 +3049,7 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data)
3054 int partitioned = (MAJOR(dev) != MD_MAJOR); 3049 int partitioned = (MAJOR(dev) != MD_MAJOR);
3055 int shift = partitioned ? MdpMinorShift : 0; 3050 int shift = partitioned ? MdpMinorShift : 0;
3056 int unit = MINOR(dev) >> shift; 3051 int unit = MINOR(dev) >> shift;
3052 int error;
3057 3053
3058 if (!mddev) 3054 if (!mddev)
3059 return NULL; 3055 return NULL;
@@ -3082,12 +3078,13 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data)
3082 add_disk(disk); 3078 add_disk(disk);
3083 mddev->gendisk = disk; 3079 mddev->gendisk = disk;
3084 mutex_unlock(&disks_mutex); 3080 mutex_unlock(&disks_mutex);
3085 mddev->kobj.parent = &disk->kobj; 3081 error = kobject_init_and_add(&mddev->kobj, &md_ktype, &disk->dev.kobj,
3086 kobject_set_name(&mddev->kobj, "%s", "md"); 3082 "%s", "md");
3087 mddev->kobj.ktype = &md_ktype; 3083 if (error)
3088 if (kobject_register(&mddev->kobj))
3089 printk(KERN_WARNING "md: cannot register %s/md - name in use\n", 3084 printk(KERN_WARNING "md: cannot register %s/md - name in use\n",
3090 disk->disk_name); 3085 disk->disk_name);
3086 else
3087 kobject_uevent(&mddev->kobj, KOBJ_ADD);
3091 return NULL; 3088 return NULL;
3092} 3089}
3093 3090
@@ -3359,7 +3356,7 @@ static int do_md_run(mddev_t * mddev)
3359 3356
3360 mddev->changed = 1; 3357 mddev->changed = 1;
3361 md_new_event(mddev); 3358 md_new_event(mddev);
3362 kobject_uevent(&mddev->gendisk->kobj, KOBJ_CHANGE); 3359 kobject_uevent(&mddev->gendisk->dev.kobj, KOBJ_CHANGE);
3363 return 0; 3360 return 0;
3364} 3361}
3365 3362