diff mbox

[v5,3/5] um: track 'parent' device in a local variable

Message ID 146705580842.39775.16180359577535598750.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Accepted
Commit d72a57835c92
Headers show

Commit Message

Dan Williams June 27, 2016, 7:30 p.m. UTC
In preparation for the removal of 'driverfs_dev' from 'struct gendisk'
use a local variable to track the parented vs un-parented case in
ubd_disk_register().

Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/um/drivers/ubd_kern.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Bart Van Assche June 28, 2016, 7:23 a.m. UTC | #1
On 06/27/2016 09:30 PM, Dan Williams wrote:
> In preparation for the removal of 'driverfs_dev' from 'struct gendisk'
> use a local variable to track the parented vs un-parented case in
> ubd_disk_register().

Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Richard Weinberger June 28, 2016, 8:14 a.m. UTC | #2
Am 28.06.2016 um 09:23 schrieb Bart Van Assche:
> On 06/27/2016 09:30 PM, Dan Williams wrote:
>> In preparation for the removal of 'driverfs_dev' from 'struct gendisk'
>> use a local variable to track the parented vs un-parented case in
>> ubd_disk_register().
> 
> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>

Acked-by: Richard Weinberger <richard@nod.at>

Thanks,
//richard
Christoph Hellwig June 28, 2016, 11:58 a.m. UTC | #3
Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox

Patch

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index ef6b4d960bad..f3540270d096 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -801,6 +801,7 @@  static void ubd_device_release(struct device *dev)
 static int ubd_disk_register(int major, u64 size, int unit,
 			     struct gendisk **disk_out)
 {
+	struct device *parent = NULL;
 	struct gendisk *disk;
 
 	disk = alloc_disk(1 << UBD_SHIFT);
@@ -823,12 +824,12 @@  static int ubd_disk_register(int major, u64 size, int unit,
 		ubd_devs[unit].pdev.dev.release = ubd_device_release;
 		dev_set_drvdata(&ubd_devs[unit].pdev.dev, &ubd_devs[unit]);
 		platform_device_register(&ubd_devs[unit].pdev);
-		disk->driverfs_dev = &ubd_devs[unit].pdev.dev;
+		parent = &ubd_devs[unit].pdev.dev;
 	}
 
 	disk->private_data = &ubd_devs[unit];
 	disk->queue = ubd_devs[unit].queue;
-	add_disk(disk);
+	device_add_disk(parent, disk);
 
 	*disk_out = disk;
 	return 0;