@@ -138,7 +138,7 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 bsize)
set_capacity(dev->disk, (sector_t)blocks * (bsize / 512));
dev->disk->queue = dev->queue;
- add_disk(dev->disk);
+ device_add_disk(NULL, dev->disk);
list_add_tail(&dev->list, &nfhd_list);
@@ -288,7 +288,7 @@ static int __init simdisk_setup(struct simdisk *dev, int which,
dev->gd->private_data = dev;
snprintf(dev->gd->disk_name, 32, "simdisk%d", which);
set_capacity(dev->gd, 0);
- add_disk(dev->gd);
+ device_add_disk(NULL, dev->gd);
dev->procfile = proc_create_data(tmp, 0644, procdir, &fops, dev);
return 0;
@@ -3175,7 +3175,7 @@ DAC960_Probe(struct pci_dev *dev, const struct pci_device_id *entry)
for (disk = 0; disk < DAC960_MaxLogicalDrives; disk++) {
set_capacity(Controller->disks[disk], disk_size(Controller, disk));
- add_disk(Controller->disks[disk]);
+ device_add_disk(NULL, Controller->disks[disk]);
}
DAC960_CreateProcEntries(Controller);
return 0;
@@ -1738,7 +1738,7 @@ static int __init fd_probe_drives(void)
sprintf(disk->disk_name, "fd%d", drive);
disk->private_data = &unit[drive];
set_capacity(disk, 880*2);
- add_disk(disk);
+ device_add_disk(NULL, disk);
}
if ((drives > 0) || (nomem == 0)) {
if (drives == 0)
@@ -345,7 +345,7 @@ static const struct block_device_operations aoe_bdops = {
.owner = THIS_MODULE,
};
-/* alloc_disk and add_disk can sleep */
+/* alloc_disk and device_add_disk can sleep */
void
aoeblk_gdalloc(void *vp)
{
@@ -417,7 +417,7 @@ aoeblk_gdalloc(void *vp)
spin_unlock_irqrestore(&d->lock, flags);
- add_disk(gd);
+ device_add_disk(NULL, gd);
aoedisk_add_sysfs(d);
aoedisk_add_debugfs(d);
@@ -1969,7 +1969,7 @@ static int __init atari_floppy_init (void)
if (!unit[i].disk->queue)
goto Enomem;
set_capacity(unit[i].disk, MAX_DISK_SIZE * 2);
- add_disk(unit[i].disk);
+ device_add_disk(NULL, unit[i].disk);
}
blk_register_region(MKDEV(FLOPPY_MAJOR, 0), 256, THIS_MODULE,
@@ -549,7 +549,7 @@ static struct brd_device *brd_init_one(int i, bool *new)
brd = brd_alloc(i);
if (brd) {
- add_disk(brd->brd_disk);
+ device_add_disk(NULL, brd->brd_disk);
list_add_tail(&brd->brd_list, &brd_devices);
}
*new = true;
@@ -617,7 +617,7 @@ static int __init brd_init(void)
/* point of no return */
list_for_each_entry(brd, &brd_devices, brd_list)
- add_disk(brd->brd_disk);
+ device_add_disk(NULL, brd->brd_disk);
blk_register_region(MKDEV(RAMDISK_MAJOR, 0), 1UL << MINORBITS,
THIS_MODULE, brd_probe, NULL, NULL);
@@ -2897,7 +2897,7 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig
goto out_idr_remove_vol;
}
- add_disk(disk);
+ device_add_disk(NULL, disk);
/* inherit the connection state */
device->state.conn = first_connection(resource)->cstate;
@@ -4605,7 +4605,7 @@ static void __exit floppy_module_exit(void)
blk_cleanup_queue(disks[drive]->queue);
/*
- * These disks have not called add_disk(). Don't put down
+ * These disks have not called device_add_disk(). Don't put down
* queue reference in put_disk().
*/
if (!(allowed_drive_mask & (1 << drive)) ||
@@ -767,7 +767,7 @@ static int __init hd_init(void)
/* Let them fly */
for (drive = 0; drive < NR_HD; drive++)
- add_disk(hd_gendisk[drive]);
+ device_add_disk(NULL, hd_gendisk[drive]);
return 0;
@@ -1794,7 +1794,7 @@ static int loop_add(struct loop_device **l, int i)
disk->private_data = lo;
disk->queue = lo->lo_queue;
sprintf(disk->disk_name, "loop%d", i);
- add_disk(disk);
+ device_add_disk(NULL, disk);
*l = lo;
return lo->lo_number;
@@ -1006,7 +1006,7 @@ static int mg_probe(struct platform_device *plat_dev)
set_capacity(host->gd, host->n_sectors);
- add_disk(host->gd);
+ device_add_disk(NULL, host->gd);
return err;
@@ -1085,7 +1085,7 @@ static int __init nbd_init(void)
disk->private_data = &nbd_dev[i];
sprintf(disk->disk_name, "nbd%d", i);
nbd_reset(&nbd_dev[i]);
- add_disk(disk);
+ device_add_disk(NULL, disk);
}
return 0;
@@ -740,7 +740,7 @@ static int null_add_dev(void)
disk->queue = nullb->q;
strncpy(disk->disk_name, nullb->disk_name, DISK_NAME_LEN);
- add_disk(disk);
+ device_add_disk(NULL, disk);
done:
mutex_lock(&lock);
@@ -448,7 +448,7 @@ static int osdblk_init_disk(struct osdblk_device *osdev)
/* finally, announce the disk to the world */
set_capacity(disk, obj_size / 512ULL);
- add_disk(disk);
+ device_add_disk(NULL, disk);
printk(KERN_INFO "%s: Added of size 0x%llx\n",
disk->disk_name, (unsigned long long)obj_size);
@@ -970,7 +970,7 @@ static int __init pcd_init(void)
register_cdrom(&cd->info);
cd->disk->private_data = cd;
cd->disk->queue = pcd_queue;
- add_disk(cd->disk);
+ device_add_disk(NULL, cd->disk);
}
}
@@ -906,7 +906,7 @@ static int pd_detect(void)
for (unit = 0, disk = pd; unit < PD_UNITS; unit++, disk++) {
if (disk->gd) {
set_capacity(disk->gd, disk->capacity);
- add_disk(disk->gd);
+ device_add_disk(NULL, disk->gd);
found = 1;
}
}
@@ -989,7 +989,7 @@ static int __init pf_init(void)
continue;
disk->private_data = pf;
disk->queue = pf_queue;
- add_disk(disk);
+ device_add_disk(NULL, disk);
}
return 0;
}
@@ -2785,7 +2785,7 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev)
disk->events = pd->bdev->bd_disk->events;
disk->async_events = pd->bdev->bd_disk->async_events;
- add_disk(disk);
+ device_add_disk(NULL, disk);
pkt_sysfs_dev_new(pd);
pkt_debugfs_dev_new(pd);
@@ -5160,7 +5160,7 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev)
set_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags);
up_write(&rbd_dev->header_rwsem);
- add_disk(rbd_dev->disk);
+ device_add_disk(NULL, rbd_dev->disk);
pr_info("%s: added with size 0x%llx\n", rbd_dev->disk->disk_name,
(unsigned long long) rbd_dev->mapping.size);
@@ -4692,7 +4692,7 @@ static int skd_bdev_getgeo(struct block_device *bdev, struct hd_geometry *geo)
static int skd_bdev_attach(struct device *parent, struct skd_device *skdev)
{
- pr_debug("%s:%s:%d add_disk\n", skdev->name, __func__, __LINE__);
+ pr_debug("%s:%s:%d device_add_disk\n", skdev->name, __func__, __LINE__);
device_add_disk(parent, skdev->disk);
return 0;
}
@@ -858,7 +858,7 @@ static int swim_floppy_init(struct swim_priv *swd)
swd->unit[drive].disk->private_data = &swd->unit[drive];
swd->unit[drive].disk->queue = swd->queue;
set_capacity(swd->unit[drive].disk, 2880);
- add_disk(swd->unit[drive].disk);
+ device_add_disk(NULL, swd->unit[drive].disk);
}
blk_register_region(MKDEV(FLOPPY_MAJOR, 0), 256, THIS_MODULE,
@@ -1240,7 +1240,7 @@ static int swim3_attach(struct macio_dev *mdev,
disk->flags |= GENHD_FL_REMOVABLE;
sprintf(disk->disk_name, "fd%d", index);
set_capacity(disk, 2880);
- add_disk(disk);
+ device_add_disk(NULL, disk);
return 0;
}
@@ -1333,7 +1333,7 @@ static void carm_fsm_task (struct work_struct *work)
struct gendisk *disk = port->disk;
set_capacity(disk, port->capacity);
- add_disk(disk);
+ device_add_disk(NULL, disk);
activated++;
}
@@ -1096,7 +1096,7 @@ static int __init mm_init(void)
disk->private_data = &cards[i];
disk->queue = cards[i].queue;
set_capacity(disk, cards[i].mm_size << 1);
- add_disk(disk);
+ device_add_disk(NULL, disk);
}
init_battery_timer();
@@ -1057,7 +1057,7 @@ static int ace_setup(struct ace_device *ace)
ace_revalidate_disk(ace->gd);
/* Make the sysace device 'live' */
- add_disk(ace->gd);
+ device_add_disk(NULL, ace->gd);
return 0;
@@ -364,7 +364,7 @@ z2_init(void)
sprintf(z2ram_gendisk->disk_name, "z2ram");
z2ram_gendisk->queue = z2_queue;
- add_disk(z2ram_gendisk);
+ device_add_disk(NULL, z2ram_gendisk);
blk_register_region(MKDEV(Z2RAM_MAJOR, 0), Z2MINOR_COUNT, THIS_MODULE,
z2_find, NULL, NULL);
@@ -1298,7 +1298,7 @@ static int zram_add(void)
zram->disk->queue->limits.discard_zeroes_data = 0;
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, zram->disk->queue);
- add_disk(zram->disk);
+ device_add_disk(NULL, zram->disk);
ret = sysfs_create_group(&disk_to_dev(zram->disk)->kobj,
&zram_disk_attr_group);
@@ -817,7 +817,7 @@ static int probe_gdrom(struct platform_device *devptr)
gd.toc = kzalloc(sizeof(struct gdromtoc), GFP_KERNEL);
if (!gd.toc)
goto probe_fail_toc;
- add_disk(gd.disk);
+ device_add_disk(NULL, gd.disk);
return 0;
probe_fail_toc:
@@ -90,7 +90,7 @@ static int gen_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create)
blk_queue_max_hw_sectors(tqueue, 8 * dev->ops->max_phys_sect);
set_capacity(tdisk, tt->capacity(targetdata));
- add_disk(tdisk);
+ device_add_disk(NULL, tdisk);
t->type = tt;
t->disk = tdisk;
@@ -866,7 +866,7 @@ void bch_cached_dev_run(struct cached_dev *dc)
closure_sync(&cl);
}
- add_disk(d->disk);
+ device_add_disk(NULL, d->disk);
bd_link_disk_holder(dc->bdev, dc->disk.disk);
/* won't show up in the uevent file, use udevadm monitor -e instead
* only class / kset properties are persistent */
@@ -1229,7 +1229,7 @@ static int flash_dev_run(struct cache_set *c, struct uuid_entry *u)
bcache_device_attach(d, c, u - c->uuids);
bch_flash_dev_request_init(d);
- add_disk(d->disk);
+ device_add_disk(NULL, d->disk);
if (kobject_add(&d->kobj, &disk_to_dev(d->disk)->kobj, "bcache"))
goto err;
@@ -1514,7 +1514,7 @@ static struct mapped_device *alloc_dev(int minor)
md->disk->queue = md->queue;
md->disk->private_data = md;
sprintf(md->disk->disk_name, "dm-%d", minor);
- add_disk(md->disk);
+ device_add_disk(NULL, md->disk);
format_dev_t(md->name, MKDEV(_major, minor));
md->wq = alloc_workqueue("kdmflush", WQ_MEM_RECLAIM, 0);
@@ -5062,11 +5062,11 @@ static int md_alloc(dev_t dev, char *name)
*/
disk->flags |= GENHD_FL_EXT_DEVT;
mddev->gendisk = disk;
- /* As soon as we call add_disk(), another thread could get
+ /* As soon as we call device_add_disk(), another thread could get
* through to md_open, so make sure it doesn't get too far
*/
mutex_lock(&mddev->open_mutex);
- add_disk(disk);
+ device_add_disk(NULL, disk);
error = kobject_init_and_add(&mddev->kobj, &md_ktype,
&disk_to_dev(disk)->kobj, "%s", "md");
@@ -445,7 +445,7 @@ int ubiblock_create(struct ubi_volume_info *vi)
mutex_unlock(&devices_mutex);
/* Must be the last step: anyone can call file ops from now on */
- add_disk(dev->gd);
+ device_add_disk(NULL, dev->gd);
dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)",
dev->ubi_num, dev->vol_id, vi->name);
return 0;
@@ -377,7 +377,7 @@ static int __init xpram_setup_blkdev(void)
disk->queue = xpram_queues[i];
sprintf(disk->disk_name, "slram%d", i);
set_capacity(disk, xpram_sizes[i] << 1);
- add_disk(disk);
+ device_add_disk(NULL, disk);
}
return 0;
@@ -590,7 +590,7 @@ static int jsfd_init(void)
set_capacity(disk, jdp->dsize >> 9);
disk->private_data = jdp;
disk->queue = jsf_queue;
- add_disk(disk);
+ device_add_disk(NULL, disk);
set_disk_ro(disk, 1);
}
return 0;
@@ -723,7 +723,7 @@ static int sr_probe(struct device *dev)
/*
* Initialize block layer runtime PM stuffs before the
- * periodic event checking request gets started in add_disk.
+ * periodic event checking request gets started in device_add_disk.
*/
blk_pm_runtime_init(sdev->request_queue, dev);
@@ -4299,8 +4299,8 @@ static int st_probe(struct device *dev)
tpnt->disk = disk;
disk->private_data = &tpnt->driver;
disk->queue = SDp->request_queue;
- /* SCSI tape doesn't register this gendisk via add_disk(). Manually
- * take queue reference that release_disk() expects. */
+ /* SCSI tape doesn't register this gendisk via device_add_disk().
+ * Manually take queue reference that release_disk() expects. */
if (!blk_get_queue(disk->queue))
goto out_put_disk;
tpnt->driver = &st_template;
@@ -1028,7 +1028,7 @@ int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk)
WARN_ON_ONCE(!bdev->bd_holder);
- /* FIXME: remove the following once add_disk() handles errors */
+ /* FIXME: remove the following once device_add_disk() handles errors */
if (WARN_ON(!disk->slave_dir || !bdev->bd_part->holder_dir))
goto out_unlock;
@@ -414,10 +414,6 @@ extern void part_round_stats(int cpu, struct hd_struct *part);
/* block/genhd.c */
extern void device_add_disk(struct device *parent, struct gendisk *disk);
-static inline void add_disk(struct gendisk *disk)
-{
- device_add_disk(NULL, disk);
-}
extern void del_gendisk(struct gendisk *gp);
extern struct gendisk *get_gendisk(dev_t dev, int *partno);
add_disk is now a "convenience" wrapper of device_add_disk. Unwrap it so that callers can be later converted to handle error and attribute group more easily. Callers are converted with coccinelle: @@ expression x; @@ - add_disk(x) + device_add_disk(NULL, x) Removal of add_disk and update of related comments are done manually. Signed-off-by: Fam Zheng <famz@redhat.com> --- arch/m68k/emu/nfblock.c | 2 +- arch/xtensa/platforms/iss/simdisk.c | 2 +- drivers/block/DAC960.c | 2 +- drivers/block/amiflop.c | 2 +- drivers/block/aoe/aoeblk.c | 4 ++-- drivers/block/ataflop.c | 2 +- drivers/block/brd.c | 4 ++-- drivers/block/drbd/drbd_main.c | 2 +- drivers/block/floppy.c | 2 +- drivers/block/hd.c | 2 +- drivers/block/loop.c | 2 +- drivers/block/mg_disk.c | 2 +- drivers/block/nbd.c | 2 +- drivers/block/null_blk.c | 2 +- drivers/block/osdblk.c | 2 +- drivers/block/paride/pcd.c | 2 +- drivers/block/paride/pd.c | 2 +- drivers/block/paride/pf.c | 2 +- drivers/block/pktcdvd.c | 2 +- drivers/block/rbd.c | 2 +- drivers/block/skd_main.c | 2 +- drivers/block/swim.c | 2 +- drivers/block/swim3.c | 2 +- drivers/block/sx8.c | 2 +- drivers/block/umem.c | 2 +- drivers/block/xsysace.c | 2 +- drivers/block/z2ram.c | 2 +- drivers/block/zram/zram_drv.c | 2 +- drivers/cdrom/gdrom.c | 2 +- drivers/lightnvm/gennvm.c | 2 +- drivers/md/bcache/super.c | 4 ++-- drivers/md/dm.c | 2 +- drivers/md/md.c | 4 ++-- drivers/mtd/ubi/block.c | 2 +- drivers/s390/block/xpram.c | 2 +- drivers/sbus/char/jsflash.c | 2 +- drivers/scsi/sr.c | 2 +- drivers/scsi/st.c | 4 ++-- fs/block_dev.c | 2 +- include/linux/genhd.h | 4 ---- 40 files changed, 44 insertions(+), 48 deletions(-)