summaryrefslogtreecommitdiffstats
path: root/block/genhd.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2016-06-15 18:17:27 -0700
committerDan Williams <dan.j.williams@intel.com>2016-06-15 19:53:06 -0700
commite63a46bef01ff3064f44dba145833284fb6adeec (patch)
tree01890349347ab2a8bf4ac1bb42004647d88ea4bf /block/genhd.c
parent1b57e66384e2d21150301e68078526fac5680a16 (diff)
downloadop-kernel-dev-e63a46bef01ff3064f44dba145833284fb6adeec.zip
op-kernel-dev-e63a46bef01ff3064f44dba145833284fb6adeec.tar.gz
block: introduce device_add_disk()
In preparation for removing the ->driverfs_dev member of a gendisk, add an api that takes the parent device as a parameter to add_disk(). For now this maintains the status quo of WARN()ing on failure, but not return a error code. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 9f42526..fb2d9ae 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -506,7 +506,7 @@ static int exact_lock(dev_t devt, void *data)
return 0;
}
-static void register_disk(struct gendisk *disk)
+static void register_disk(struct device *parent, struct gendisk *disk)
{
struct device *ddev = disk_to_dev(disk);
struct block_device *bdev;
@@ -514,7 +514,7 @@ static void register_disk(struct gendisk *disk)
struct hd_struct *part;
int err;
- ddev->parent = disk->driverfs_dev;
+ ddev->parent = parent;
dev_set_name(ddev, "%s", disk->disk_name);
@@ -573,7 +573,8 @@ exit:
}
/**
- * add_disk - add partitioning information to kernel list
+ * device_add_disk - add partitioning information to kernel list
+ * @parent: parent device for the disk
* @disk: per-device partitioning information
*
* This function registers the partitioning information in @disk
@@ -581,7 +582,7 @@ exit:
*
* FIXME: error handling
*/
-void add_disk(struct gendisk *disk)
+void device_add_disk(struct device *parent, struct gendisk *disk)
{
struct backing_dev_info *bdi;
dev_t devt;
@@ -617,7 +618,11 @@ void add_disk(struct gendisk *disk)
blk_register_region(disk_devt(disk), disk->minors, NULL,
exact_match, exact_lock, disk);
- register_disk(disk);
+
+ /* temporary while we convert usages to use disk_to_dev(disk)->parent */
+ disk->driverfs_dev = parent;
+
+ register_disk(parent, disk);
blk_register_queue(disk);
/*
@@ -633,7 +638,7 @@ void add_disk(struct gendisk *disk)
disk_add_events(disk);
blk_integrity_add(disk);
}
-EXPORT_SYMBOL(add_disk);
+EXPORT_SYMBOL(device_add_disk);
void del_gendisk(struct gendisk *disk)
{
OpenPOWER on IntegriCloud