diff options
author | Tejun Heo <tj@kernel.org> | 2008-08-25 06:56:05 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-10-09 02:56:07 -0400 |
commit | ed9e1982347b36573cd622ee5f4e2a7ccd79b3fd (patch) | |
tree | 79d834094d655ec97cfc0a382a9207ebc8e711a5 /drivers/block | |
parent | 870d6656126add8e383645732b03df2b7ccd4f94 (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/block')
-rw-r--r-- | drivers/block/aoe/aoeblk.c | 4 | ||||
-rw-r--r-- | drivers/block/nbd.c | 4 |
2 files changed, 4 insertions, 4 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 = { | |||
109 | static int | 109 | static int |
110 | aoedisk_add_sysfs(struct aoedev *d) | 110 | aoedisk_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 | } |
114 | void | 114 | void |
115 | aoedisk_rm_sysfs(struct aoedev *d) | 115 | aoedisk_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 | ||
120 | static int | 120 | static 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 | ||