aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-08-25 06:56:05 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 02:56:07 -0400
commited9e1982347b36573cd622ee5f4e2a7ccd79b3fd (patch)
tree79d834094d655ec97cfc0a382a9207ebc8e711a5 /drivers
parent870d6656126add8e383645732b03df2b7ccd4f94 (diff)
block: implement and use {disk|part}_to_dev()
Implement {disk|part}_to_dev() and use them to access generic device instead of directly dereferencing {disk|part}->dev. To make sure no user is left behind, rename generic devices fields to __dev. This is in preparation of unifying partition 0 handling with other partitions. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/aoe/aoeblk.c4
-rw-r--r--drivers/block/nbd.c4
-rw-r--r--drivers/ide/ide-probe.c2
-rw-r--r--drivers/md/dm.c4
-rw-r--r--drivers/md/md.c10
5 files changed, 12 insertions, 12 deletions
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index 0c39782b2660..3edb6cb7d68f 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -109,12 +109,12 @@ static const struct attribute_group attr_group = {
109static int 109static int
110aoedisk_add_sysfs(struct aoedev *d) 110aoedisk_add_sysfs(struct aoedev *d)
111{ 111{
112 return sysfs_create_group(&d->gd->dev.kobj, &attr_group); 112 return sysfs_create_group(&disk_to_dev(d->gd)->kobj, &attr_group);
113} 113}
114void 114void
115aoedisk_rm_sysfs(struct aoedev *d) 115aoedisk_rm_sysfs(struct aoedev *d)
116{ 116{
117 sysfs_remove_group(&d->gd->dev.kobj, &attr_group); 117 sysfs_remove_group(&disk_to_dev(d->gd)->kobj, &attr_group);
118} 118}
119 119
120static int 120static int
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 1778e4a2c672..7b3351260d56 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -403,7 +403,7 @@ static int nbd_do_it(struct nbd_device *lo)
403 BUG_ON(lo->magic != LO_MAGIC); 403 BUG_ON(lo->magic != LO_MAGIC);
404 404
405 lo->pid = current->pid; 405 lo->pid = current->pid;
406 ret = sysfs_create_file(&lo->disk->dev.kobj, &pid_attr.attr); 406 ret = sysfs_create_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr);
407 if (ret) { 407 if (ret) {
408 printk(KERN_ERR "nbd: sysfs_create_file failed!"); 408 printk(KERN_ERR "nbd: sysfs_create_file failed!");
409 return ret; 409 return ret;
@@ -412,7 +412,7 @@ static int nbd_do_it(struct nbd_device *lo)
412 while ((req = nbd_read_stat(lo)) != NULL) 412 while ((req = nbd_read_stat(lo)) != NULL)
413 nbd_end_request(req); 413 nbd_end_request(req);
414 414
415 sysfs_remove_file(&lo->disk->dev.kobj, &pid_attr.attr); 415 sysfs_remove_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr);
416 return 0; 416 return 0;
417} 417}
418 418
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index a51a30e9eab3..70aa86c8807e 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1188,7 +1188,7 @@ static struct kobject *exact_match(dev_t dev, int *part, void *data)
1188{ 1188{
1189 struct gendisk *p = data; 1189 struct gendisk *p = data;
1190 *part &= (1 << PARTN_BITS) - 1; 1190 *part &= (1 << PARTN_BITS) - 1;
1191 return &p->dev.kobj; 1191 return &disk_to_dev(p)->kobj;
1192} 1192}
1193 1193
1194static int exact_lock(dev_t dev, void *data) 1194static int exact_lock(dev_t dev, void *data)
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 653624792eaf..637806695bb9 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1186,7 +1186,7 @@ static void event_callback(void *context)
1186 list_splice_init(&md->uevent_list, &uevents); 1186 list_splice_init(&md->uevent_list, &uevents);
1187 spin_unlock_irqrestore(&md->uevent_lock, flags); 1187 spin_unlock_irqrestore(&md->uevent_lock, flags);
1188 1188
1189 dm_send_uevents(&uevents, &md->disk->dev.kobj); 1189 dm_send_uevents(&uevents, &disk_to_dev(md->disk)->kobj);
1190 1190
1191 atomic_inc(&md->event_nr); 1191 atomic_inc(&md->event_nr);
1192 wake_up(&md->eventq); 1192 wake_up(&md->eventq);
@@ -1643,7 +1643,7 @@ out:
1643 *---------------------------------------------------------------*/ 1643 *---------------------------------------------------------------*/
1644void dm_kobject_uevent(struct mapped_device *md) 1644void dm_kobject_uevent(struct mapped_device *md)
1645{ 1645{
1646 kobject_uevent(&md->disk->dev.kobj, KOBJ_CHANGE); 1646 kobject_uevent(&disk_to_dev(md->disk)->kobj, KOBJ_CHANGE);
1647} 1647}
1648 1648
1649uint32_t dm_next_uevent_seq(struct mapped_device *md) 1649uint32_t dm_next_uevent_seq(struct mapped_device *md)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index deeac4b44173..96e9fccd2eab 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1465,9 +1465,9 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1465 goto fail; 1465 goto fail;
1466 1466
1467 if (rdev->bdev->bd_part) 1467 if (rdev->bdev->bd_part)
1468 ko = &rdev->bdev->bd_part->dev.kobj; 1468 ko = &part_to_dev(rdev->bdev->bd_part)->kobj;
1469 else 1469 else
1470 ko = &rdev->bdev->bd_disk->dev.kobj; 1470 ko = &disk_to_dev(rdev->bdev->bd_disk)->kobj;
1471 if ((err = sysfs_create_link(&rdev->kobj, ko, "block"))) { 1471 if ((err = sysfs_create_link(&rdev->kobj, ko, "block"))) {
1472 kobject_del(&rdev->kobj); 1472 kobject_del(&rdev->kobj);
1473 goto fail; 1473 goto fail;
@@ -3470,8 +3470,8 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data)
3470 disk->queue = mddev->queue; 3470 disk->queue = mddev->queue;
3471 add_disk(disk); 3471 add_disk(disk);
3472 mddev->gendisk = disk; 3472 mddev->gendisk = disk;
3473 error = kobject_init_and_add(&mddev->kobj, &md_ktype, &disk->dev.kobj, 3473 error = kobject_init_and_add(&mddev->kobj, &md_ktype,
3474 "%s", "md"); 3474 &disk_to_dev(disk)->kobj, "%s", "md");
3475 mutex_unlock(&disks_mutex); 3475 mutex_unlock(&disks_mutex);
3476 if (error) 3476 if (error)
3477 printk(KERN_WARNING "md: cannot register %s/md - name in use\n", 3477 printk(KERN_WARNING "md: cannot register %s/md - name in use\n",
@@ -3761,7 +3761,7 @@ static int do_md_run(mddev_t * mddev)
3761 sysfs_notify(&mddev->kobj, NULL, "array_state"); 3761 sysfs_notify(&mddev->kobj, NULL, "array_state");
3762 sysfs_notify(&mddev->kobj, NULL, "sync_action"); 3762 sysfs_notify(&mddev->kobj, NULL, "sync_action");
3763 sysfs_notify(&mddev->kobj, NULL, "degraded"); 3763 sysfs_notify(&mddev->kobj, NULL, "degraded");
3764 kobject_uevent(&mddev->gendisk->dev.kobj, KOBJ_CHANGE); 3764 kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE);
3765 return 0; 3765 return 0;
3766} 3766}
3767 3767