um: track 'parent' device in a local variable
authorDan Williams <dan.j.williams@intel.com>
Mon, 20 Jun 2016 17:44:32 +0000 (10:44 -0700)
committerDan Williams <dan.j.williams@intel.com>
Wed, 22 Jun 2016 17:19:16 +0000 (10:19 -0700)
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

index ef6b4d960badeba6f477eca9b745f4c0f104cd4a..f3540270d09686d6ca6884c05f15481ae831ee0e 100644 (file)
@@ -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;