block: convert to device_add_disk()
authorDan Williams <dan.j.williams@intel.com>
Thu, 16 Jun 2016 02:44:20 +0000 (19:44 -0700)
committerDan Williams <dan.j.williams@intel.com>
Mon, 27 Jun 2016 19:26:08 +0000 (12:26 -0700)
For block drivers that specify a parent device, convert them to use
device_add_disk().

This conversion was done with the following semantic patch:

    @@
    struct gendisk *disk;
    expression E;
    @@

    - disk->driverfs_dev = E;
    ...
    - add_disk(disk);
    + device_add_disk(E, disk);

    @@
    struct gendisk *disk;
    expression E1, E2;
    @@

    - disk->driverfs_dev = E1;
    ...
    E2 = disk;
    ...
    - add_disk(E2);
    + device_add_disk(E1, E2);

...plus some manual fixups for a few missed conversions.

Cc: Jens Axboe <axboe@fb.com>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: James Bottomley <James.Bottomley@hansenpartnership.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
25 files changed:
arch/powerpc/sysdev/axonram.c
drivers/block/cciss.c
drivers/block/floppy.c
drivers/block/mtip32xx/mtip32xx.c
drivers/block/ps3disk.c
drivers/block/ps3vram.c
drivers/block/rsxx/dev.c
drivers/block/skd_main.c
drivers/block/sunvdc.c
drivers/block/virtio_blk.c
drivers/block/xen-blkfront.c
drivers/ide/ide-cd.c
drivers/ide/ide-gd.c
drivers/memstick/core/ms_block.c
drivers/memstick/core/mspro_block.c
drivers/mtd/mtd_blkdevs.c
drivers/nvdimm/blk.c
drivers/nvdimm/btt.c
drivers/nvdimm/pmem.c
drivers/nvme/host/core.c
drivers/s390/block/dasd_genhd.c
drivers/s390/block/dcssblk.c
drivers/s390/block/scm_blk.c
drivers/scsi/sd.c
drivers/scsi/sr.c

index ff75d70f7285dd21bd42ba5e8b5b2b6b9e69ab70..f9af6461521ab899396ce101d54e5a61af5a9df0 100644 (file)
@@ -223,7 +223,6 @@ static int axon_ram_probe(struct platform_device *device)
        bank->disk->first_minor = azfs_minor;
        bank->disk->fops = &axon_ram_devops;
        bank->disk->private_data = bank;
-       bank->disk->driverfs_dev = &device->dev;
 
        sprintf(bank->disk->disk_name, "%s%d",
                        AXON_RAM_DEVICE_NAME, axon_ram_bank_id);
@@ -238,7 +237,7 @@ static int axon_ram_probe(struct platform_device *device)
        set_capacity(bank->disk, bank->size >> AXON_RAM_SECTOR_SHIFT);
        blk_queue_make_request(bank->disk->queue, axon_ram_make_request);
        blk_queue_logical_block_size(bank->disk->queue, AXON_RAM_SECTOR_SIZE);
-       add_disk(bank->disk);
+       device_add_disk(&device->dev, bank->disk);
 
        bank->irq_id = irq_of_parse_and_map(device->dev.of_node, 0);
        if (bank->irq_id == NO_IRQ) {
index 63c2064689f864aa515bf8a5b78c5841e7e91bab..db9d6bb6352d97a0a2cc9099a16317227edca96f 100644 (file)
@@ -1951,7 +1951,6 @@ static int cciss_add_disk(ctlr_info_t *h, struct gendisk *disk,
        if (cciss_create_ld_sysfs_entry(h, drv_index))
                goto cleanup_queue;
        disk->private_data = h->drv[drv_index];
-       disk->driverfs_dev = &h->drv[drv_index]->dev;
 
        /* Set up queue information */
        blk_queue_bounce_limit(disk->queue, h->pdev->dma_mask);
@@ -1973,7 +1972,7 @@ static int cciss_add_disk(ctlr_info_t *h, struct gendisk *disk,
        /* allows the interrupt handler to start the queue */
        wmb();
        h->drv[drv_index]->queue = disk->queue;
-       add_disk(disk);
+       device_add_disk(&h->drv[drv_index]->dev, disk);
        return 0;
 
 cleanup_queue:
index f9bfecd733a8fe28a2cb6bfb56871576044fef74..c557057fe8ae05fd3ce2f93dc8f0c801083cb24f 100644 (file)
@@ -4350,8 +4350,7 @@ static int __init do_floppy_init(void)
                /* to be cleaned up... */
                disks[drive]->private_data = (void *)(long)drive;
                disks[drive]->flags |= GENHD_FL_REMOVABLE;
-               disks[drive]->driverfs_dev = &floppy_device[drive].dev;
-               add_disk(disks[drive]);
+               device_add_disk(&floppy_device[drive].dev, disks[drive]);
        }
 
        return 0;
index 8e3e708cb9ee9e85fbf449bec55647541fb6b848..2aca98e8e42739c8d6c6c928ce52fa30fc60fc5d 100644 (file)
@@ -3956,7 +3956,6 @@ static int mtip_block_initialize(struct driver_data *dd)
        if (rv)
                goto disk_index_error;
 
-       dd->disk->driverfs_dev  = &dd->pdev->dev;
        dd->disk->major         = dd->major;
        dd->disk->first_minor   = index * MTIP_MAX_MINORS;
        dd->disk->minors        = MTIP_MAX_MINORS;
@@ -4008,7 +4007,7 @@ skip_create_disk:
 
        /*
         * if rebuild pending, start the service thread, and delay the block
-        * queue creation and add_disk()
+        * queue creation and device_add_disk()
         */
        if (wait_for_rebuild == MTIP_FTL_REBUILD_MAGIC)
                goto start_service_thread;
@@ -4042,7 +4041,7 @@ skip_create_disk:
        set_capacity(dd->disk, capacity);
 
        /* Enable the block device and add it to /dev */
-       add_disk(dd->disk);
+       device_add_disk(&dd->pdev->dev, dd->disk);
 
        dd->bdev = bdget_disk(dd->disk, 0);
        /*
index acb44529c05e8e6a50d8ee707000042a5fc817d0..76f33c84ce3dfb2eb6228d7bc5afdecb284e6ba9 100644 (file)
@@ -487,7 +487,6 @@ static int ps3disk_probe(struct ps3_system_bus_device *_dev)
        gendisk->fops = &ps3disk_fops;
        gendisk->queue = queue;
        gendisk->private_data = dev;
-       gendisk->driverfs_dev = &dev->sbd.core;
        snprintf(gendisk->disk_name, sizeof(gendisk->disk_name), PS3DISK_NAME,
                 devidx+'a');
        priv->blocking_factor = dev->blk_size >> 9;
@@ -499,7 +498,7 @@ static int ps3disk_probe(struct ps3_system_bus_device *_dev)
                 gendisk->disk_name, priv->model, priv->raw_capacity >> 11,
                 get_capacity(gendisk) >> 11);
 
-       add_disk(gendisk);
+       device_add_disk(&dev->sbd.core, gendisk);
        return 0;
 
 fail_cleanup_queue:
index 56847fcda0860aad24b0dbf84c822691e343dce3..456b4fe21559877c825b4e3da05b3c0de841a7e4 100644 (file)
@@ -773,14 +773,13 @@ static int ps3vram_probe(struct ps3_system_bus_device *dev)
        gendisk->fops = &ps3vram_fops;
        gendisk->queue = queue;
        gendisk->private_data = dev;
-       gendisk->driverfs_dev = &dev->core;
        strlcpy(gendisk->disk_name, DEVICE_NAME, sizeof(gendisk->disk_name));
        set_capacity(gendisk, priv->size >> 9);
 
        dev_info(&dev->core, "%s: Using %lu MiB of GPU memory\n",
                 gendisk->disk_name, get_capacity(gendisk) >> 11);
 
-       add_disk(gendisk);
+       device_add_disk(&dev->core, gendisk);
        return 0;
 
 fail_cleanup_queue:
index e1b8b7061d2f8b224f851131e9324726bf89277c..f81d70b39d1096da4ea5338cdcb5c8aa22defcb4 100644 (file)
@@ -230,8 +230,7 @@ int rsxx_attach_dev(struct rsxx_cardinfo *card)
                        set_capacity(card->gendisk, card->size8 >> 9);
                else
                        set_capacity(card->gendisk, 0);
-               add_disk(card->gendisk);
-
+               device_add_disk(CARD_TO_DEV(card), card->gendisk);
                card->bdev_attached = 1;
        }
 
@@ -308,7 +307,6 @@ int rsxx_setup_dev(struct rsxx_cardinfo *card)
 
        snprintf(card->gendisk->disk_name, sizeof(card->gendisk->disk_name),
                 "rsxx%d", card->disk_id);
-       card->gendisk->driverfs_dev = &card->dev->dev;
        card->gendisk->major = card->major;
        card->gendisk->first_minor = 0;
        card->gendisk->fops = &rsxx_fops;
index 5c07a23e2adabf51ae2ed7463d6a27fdd9e0bf25..3822eae102db33ebba2fe4e2ec9d80a59c077c21 100644 (file)
@@ -4690,10 +4690,10 @@ static int skd_bdev_getgeo(struct block_device *bdev, struct hd_geometry *geo)
        return -EIO;
 }
 
-static int skd_bdev_attach(struct skd_device *skdev)
+static int skd_bdev_attach(struct device *parent, struct skd_device *skdev)
 {
        pr_debug("%s:%s:%d add_disk\n", skdev->name, __func__, __LINE__);
-       add_disk(skdev->disk);
+       device_add_disk(parent, skdev->disk);
        return 0;
 }
 
@@ -4812,8 +4812,6 @@ static int skd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        pci_set_drvdata(pdev, skdev);
 
-       skdev->disk->driverfs_dev = &pdev->dev;
-
        for (i = 0; i < SKD_MAX_BARS; i++) {
                skdev->mem_phys[i] = pci_resource_start(pdev, i);
                skdev->mem_size[i] = (u32)pci_resource_len(pdev, i);
@@ -4851,7 +4849,7 @@ static int skd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                                              (SKD_START_WAIT_SECONDS * HZ));
        if (skdev->gendisk_on > 0) {
                /* device came on-line after reset */
-               skd_bdev_attach(skdev);
+               skd_bdev_attach(&pdev->dev, skdev);
                rc = 0;
        } else {
                /* we timed out, something is wrong with the device,
index 4b911ed96ea3e8ee6996c74299fe8a9d414c1be0..cab157331c4eae29a65d50df6204a5a46c2587a6 100644 (file)
@@ -804,7 +804,6 @@ static int probe_disk(struct vdc_port *port)
        g->fops = &vdc_fops;
        g->queue = q;
        g->private_data = port;
-       g->driverfs_dev = &port->vio.vdev->dev;
 
        set_capacity(g, port->vdisk_size);
 
@@ -835,7 +834,7 @@ static int probe_disk(struct vdc_port *port)
               port->vdisk_size, (port->vdisk_size >> (20 - 9)),
               port->vio.ver.major, port->vio.ver.minor);
 
-       add_disk(g);
+       device_add_disk(&port->vio.vdev->dev, g);
 
        return 0;
 }
index 18e4069dd24b2fe7d3fdd80e290994832fbe55de..5fd2e0ac2711456e7069900d428f489e6193721e 100644 (file)
@@ -656,7 +656,6 @@ static int virtblk_probe(struct virtio_device *vdev)
        vblk->disk->first_minor = index_to_minor(index);
        vblk->disk->private_data = vblk;
        vblk->disk->fops = &virtblk_fops;
-       vblk->disk->driverfs_dev = &vdev->dev;
        vblk->disk->flags |= GENHD_FL_EXT_DEVT;
        vblk->index = index;
 
@@ -733,7 +732,7 @@ static int virtblk_probe(struct virtio_device *vdev)
 
        virtio_device_ready(vdev);
 
-       add_disk(vblk->disk);
+       device_add_disk(&vdev->dev, vblk->disk);
        err = device_create_file(disk_to_dev(vblk->disk), &dev_attr_serial);
        if (err)
                goto out_del_disk;
index 10711292da2c40e7577881a568df996c7faa18b4..89525d10d1a7bcc963c5662058b8e1041d347423 100644 (file)
@@ -1137,7 +1137,6 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity,
        gd->first_minor = minor;
        gd->fops = &xlvbd_block_fops;
        gd->private_data = info;
-       gd->driverfs_dev = &(info->xbdev->dev);
        set_capacity(gd, capacity);
 
        if (xlvbd_init_blk_queue(gd, sector_size, physical_sector_size,
@@ -2463,7 +2462,7 @@ static void blkfront_connect(struct blkfront_info *info)
        for (i = 0; i < info->nr_rings; i++)
                kick_pending_request_queues(&info->rinfo[i]);
 
-       add_disk(info->gd);
+       device_add_disk(&info->xbdev->dev, info->gd);
 
        info->is_ready = 1;
 }
index ef907fd5ba98a036d98d24478af49ec0a4c5831b..bf9a2ad296edea6602fa3a3eafe4aa11cf2edbea 100644 (file)
@@ -1770,7 +1770,6 @@ static int ide_cd_probe(ide_drive_t *drive)
        drive->driver_data = info;
 
        g->minors = 1;
-       g->driverfs_dev = &drive->gendev;
        g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE;
        if (ide_cdrom_setup(drive)) {
                put_device(&info->dev);
@@ -1780,7 +1779,7 @@ static int ide_cd_probe(ide_drive_t *drive)
        ide_cd_read_toc(drive, &sense);
        g->fops = &idecd_ops;
        g->flags |= GENHD_FL_REMOVABLE | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE;
-       add_disk(g);
+       device_add_disk(&drive->gendev, g);
        return 0;
 
 out_free_disk:
index 838996a0039e18547a929099e5e631ccbb96f924..e823394ed543470e98114a8a33e3ceb9ab084b24 100644 (file)
@@ -412,12 +412,11 @@ static int ide_gd_probe(ide_drive_t *drive)
        set_capacity(g, ide_gd_capacity(drive));
 
        g->minors = IDE_DISK_MINORS;
-       g->driverfs_dev = &drive->gendev;
        g->flags |= GENHD_FL_EXT_DEVT;
        if (drive->dev_flags & IDE_DFLAG_REMOVABLE)
                g->flags = GENHD_FL_REMOVABLE;
        g->fops = &ide_gd_ops;
-       add_disk(g);
+       device_add_disk(&drive->gendev, g);
        return 0;
 
 out_free_disk:
index 3cd68152ddf8c426bd26601f4b00c56bc3a5b43e..0fc43c7cc93c86deddd8f184c91e8ca0d8863d13 100644 (file)
@@ -2146,7 +2146,6 @@ static int msb_init_disk(struct memstick_dev *card)
        msb->disk->fops = &msb_bdops;
        msb->disk->private_data = msb;
        msb->disk->queue = msb->queue;
-       msb->disk->driverfs_dev = &card->dev;
        msb->disk->flags |= GENHD_FL_EXT_DEVT;
 
        capacity = msb->pages_in_block * msb->logical_block_count;
@@ -2163,7 +2162,7 @@ static int msb_init_disk(struct memstick_dev *card)
                set_disk_ro(msb->disk, 1);
 
        msb_start(card);
-       add_disk(msb->disk);
+       device_add_disk(&card->dev, msb->disk);
        dbg("Disk added");
        return 0;
 
index 0fb27d3388110909e172a25750fce141d5cdd176..25b66c54045798a6cd17b3dbe0bfce489b548305 100644 (file)
@@ -1243,7 +1243,6 @@ static int mspro_block_init_disk(struct memstick_dev *card)
        msb->usage_count = 1;
        msb->disk->private_data = msb;
        msb->disk->queue = msb->queue;
-       msb->disk->driverfs_dev = &card->dev;
 
        sprintf(msb->disk->disk_name, "mspblk%d", disk_id);
 
@@ -1255,7 +1254,7 @@ static int mspro_block_init_disk(struct memstick_dev *card)
        set_capacity(msb->disk, capacity);
        dev_dbg(&card->dev, "capacity set %ld\n", capacity);
 
-       add_disk(msb->disk);
+       device_add_disk(&card->dev, msb->disk);
        msb->active = 1;
        return 0;
 
index 78b3eb45faf602ebe4681590ce2c30cd77228349..8d58acf33021b5aa8723d50501c30eb9f92ed352 100644 (file)
@@ -431,12 +431,10 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
                goto error4;
        INIT_WORK(&new->work, mtd_blktrans_work);
 
-       gd->driverfs_dev = &new->mtd->dev;
-
        if (new->readonly)
                set_disk_ro(gd, 1);
 
-       add_disk(gd);
+       device_add_disk(&new->mtd->dev, gd);
 
        if (new->disk_attributes) {
                ret = sysfs_create_group(&disk_to_dev(gd)->kobj,
index 495e06d9f7e7f39013d910e4459720b61ebd90f5..7e262ef06ede793ebb378770977fd12fefaf79a6 100644 (file)
@@ -287,14 +287,13 @@ static int nsblk_attach_disk(struct nd_namespace_blk *nsblk)
                return -ENOMEM;
        }
 
-       disk->driverfs_dev      = dev;
        disk->first_minor       = 0;
        disk->fops              = &nd_blk_fops;
        disk->queue             = q;
        disk->flags             = GENHD_FL_EXT_DEVT;
        nvdimm_namespace_disk_name(&nsblk->common, disk->disk_name);
        set_capacity(disk, 0);
-       add_disk(disk);
+       device_add_disk(dev, disk);
 
        if (nsblk_meta_size(nsblk)) {
                int rc = nd_integrity_init(disk, nsblk_meta_size(nsblk));
index 68a7c3c1eed9115bb23a7c0501c2134b4c238e39..9dce03f420eb5f77e8dc625c018c35014591abe4 100644 (file)
@@ -1243,7 +1243,6 @@ static int btt_blk_init(struct btt *btt)
        }
 
        nvdimm_namespace_disk_name(ndns, btt->btt_disk->disk_name);
-       btt->btt_disk->driverfs_dev = &btt->nd_btt->dev;
        btt->btt_disk->first_minor = 0;
        btt->btt_disk->fops = &btt_fops;
        btt->btt_disk->private_data = btt;
@@ -1258,7 +1257,7 @@ static int btt_blk_init(struct btt *btt)
        btt->btt_queue->queuedata = btt;
 
        set_capacity(btt->btt_disk, 0);
-       add_disk(btt->btt_disk);
+       device_add_disk(&btt->nd_btt->dev, btt->btt_disk);
        if (btt_meta_size(btt)) {
                int rc = nd_integrity_init(btt->btt_disk, btt_meta_size(btt));
 
index 608fc4464574e1d9edb4037c53b6998afdb11ebe..066e07d9330f9aa8ce7f19bee995061191316f47 100644 (file)
@@ -297,14 +297,13 @@ static int pmem_attach_disk(struct device *dev,
        disk->queue             = q;
        disk->flags             = GENHD_FL_EXT_DEVT;
        nvdimm_namespace_disk_name(ndns, disk->disk_name);
-       disk->driverfs_dev = dev;
        set_capacity(disk, (pmem->size - pmem->pfn_pad - pmem->data_offset)
                        / 512);
        if (devm_init_badblocks(dev, &pmem->bb))
                return -ENOMEM;
        nvdimm_badblocks_populate(to_nd_region(dev->parent), &pmem->bb, res);
        disk->bb = &pmem->bb;
-       add_disk(disk);
+       device_add_disk(dev, disk);
        revalidate_disk(disk);
 
        return 0;
index 9d7cee463fd6d16b460e37722e37f37b0cf1054a..959173bfe9f01905f42372fb6d7526b187067010 100644 (file)
@@ -1480,7 +1480,6 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
        disk->fops = &nvme_fops;
        disk->private_data = ns;
        disk->queue = ns->queue;
-       disk->driverfs_dev = ctrl->device;
        disk->flags = GENHD_FL_EXT_DEVT;
        sprintf(disk->disk_name, "nvme%dn%d", ctrl->instance, ns->instance);
 
@@ -1492,7 +1491,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
        if (ns->type == NVME_NS_LIGHTNVM)
                return;
 
-       add_disk(ns->disk);
+       device_add_disk(ctrl->device, ns->disk);
        if (sysfs_create_group(&disk_to_dev(ns->disk)->kobj,
                                        &nvme_ns_attr_group))
                pr_warn("%s: failed to create sysfs group for identification\n",
index 31d544a87ba95e1781245e73b5d14754a68a04df..e2fa759bf2ad42683b571e8a44a434ff3936b408 100644 (file)
@@ -45,7 +45,6 @@ int dasd_gendisk_alloc(struct dasd_block *block)
        gdp->major = DASD_MAJOR;
        gdp->first_minor = base->devindex << DASD_PARTN_BITS;
        gdp->fops = &dasd_device_operations;
-       gdp->driverfs_dev = &base->cdev->dev;
 
        /*
         * Set device name.
@@ -76,7 +75,7 @@ int dasd_gendisk_alloc(struct dasd_block *block)
        gdp->queue = block->request_queue;
        block->gdp = gdp;
        set_capacity(block->gdp, 0);
-       add_disk(block->gdp);
+       device_add_disk(&base->cdev->dev, block->gdp);
        return 0;
 }
 
index bed53c46dd90657f5432dd053f4cee8e774763b8..2f056b2662f663d21515b72eb25b41e3f32a8e05 100644 (file)
@@ -615,7 +615,6 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
        dev_info->dcssblk_queue = blk_alloc_queue(GFP_KERNEL);
        dev_info->gd->queue = dev_info->dcssblk_queue;
        dev_info->gd->private_data = dev_info;
-       dev_info->gd->driverfs_dev = &dev_info->dev;
        blk_queue_make_request(dev_info->dcssblk_queue, dcssblk_make_request);
        blk_queue_logical_block_size(dev_info->dcssblk_queue, 4096);
 
@@ -655,7 +654,7 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
                goto put_dev;
 
        get_device(&dev_info->dev);
-       add_disk(dev_info->gd);
+       device_add_disk(&dev_info->dev, dev_info->gd);
 
        switch (dev_info->segment_type) {
                case SEG_TYPE_SR:
index e6f54d3b89690613e94d388f1e325adfd32b25ad..9f16ea6964ec6182e996168c0f67408b61c93f6e 100644 (file)
@@ -512,7 +512,6 @@ int scm_blk_dev_setup(struct scm_blk_dev *bdev, struct scm_device *scmdev)
                goto out_queue;
 
        rq->queuedata = scmdev;
-       bdev->gendisk->driverfs_dev = &scmdev->dev;
        bdev->gendisk->private_data = scmdev;
        bdev->gendisk->fops = &scm_blk_devops;
        bdev->gendisk->queue = rq;
@@ -531,7 +530,7 @@ int scm_blk_dev_setup(struct scm_blk_dev *bdev, struct scm_device *scmdev)
 
        /* 512 byte sectors */
        set_capacity(bdev->gendisk, scmdev->size >> 9);
-       add_disk(bdev->gendisk);
+       device_add_disk(&scmdev->dev, bdev->gendisk);
        return 0;
 
 out_queue:
index 5a9db0fe1ee0d9cb12954f70545666e3e25ad45b..84b9373309dd5b2c33b46d899af497002155aae2 100644 (file)
@@ -2994,7 +2994,6 @@ static void sd_probe_async(void *data, async_cookie_t cookie)
 
        sd_revalidate_disk(gd);
 
-       gd->driverfs_dev = &sdp->sdev_gendev;
        gd->flags = GENHD_FL_EXT_DEVT;
        if (sdp->removable) {
                gd->flags |= GENHD_FL_REMOVABLE;
@@ -3002,7 +3001,7 @@ static void sd_probe_async(void *data, async_cookie_t cookie)
        }
 
        blk_pm_runtime_init(sdp->request_queue, dev);
-       add_disk(gd);
+       device_add_disk(dev, gd);
        if (sdkp->capacity)
                sd_dif_config_host(sdkp);
 
index 64c867405ad4ff2d5e53972a8ba34f785cc81962..ed179348de80b6d39a5600caf2784f37a3413237 100644 (file)
@@ -713,7 +713,6 @@ static int sr_probe(struct device *dev)
        get_capabilities(cd);
        sr_vendor_init(cd);
 
-       disk->driverfs_dev = &sdev->sdev_gendev;
        set_capacity(disk, cd->capacity);
        disk->private_data = &cd->driver;
        disk->queue = sdev->request_queue;
@@ -730,7 +729,7 @@ static int sr_probe(struct device *dev)
 
        dev_set_drvdata(dev, cd);
        disk->flags |= GENHD_FL_REMOVABLE;
-       add_disk(disk);
+       device_add_disk(&sdev->sdev_gendev, disk);
 
        sdev_printk(KERN_DEBUG, sdev,
                    "Attached scsi CD-ROM %s\n", cd->cdi.name);