Revert "block: unexport DISK_EVENT_MEDIA_CHANGE for legacy/fringe drivers"
authorMartin Wilck <mwilck@suse.com>
Wed, 27 Mar 2019 13:51:04 +0000 (14:51 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 12 Apr 2019 19:35:27 +0000 (13:35 -0600)
This reverts commit 9fd097b14918875bd6f125ed699d7bbbba5893ee.

Instead of leaving disk->events completely empty, we now export the
supported events again, and tell the block layer not to forward events to
user space by not setting DISK_EVENT_FLAG_UEVENT. This allows the block
layer to distinguish between devices that for which events should be
handled in kernel only, and devices which don't support any meda change
events at all.

Cc: Jiri Kosina <jikos@kernel.org>
Cc: Tim Waugh <tim@cyberelk.net>
Cc: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/amiflop.c
drivers/block/ataflop.c
drivers/block/floppy.c
drivers/block/paride/pcd.c
drivers/block/paride/pd.c
drivers/block/paride/pf.c
drivers/block/swim.c
drivers/block/swim3.c
drivers/block/xsysace.c
drivers/cdrom/gdrom.c

index 0903e0803ec8e6aeaea3c99c455cea844ce7e661..92b930cb3b72b5b7a049c5180c156337d1f018eb 100644 (file)
@@ -1829,6 +1829,7 @@ static int __init fd_probe_drives(void)
                disk->major = FLOPPY_MAJOR;
                disk->first_minor = drive;
                disk->fops = &floppy_fops;
+               disk->events = DISK_EVENT_MEDIA_CHANGE;
                sprintf(disk->disk_name, "fd%d", drive);
                disk->private_data = &unit[drive];
                set_capacity(disk, 880*2);
index b0dbbdfeb33e0f70e33d78b36ab27bdcc8dbac41..c7b5c4671f05f7c2fbb2bd14205b9bd656a9d425 100644 (file)
@@ -2028,6 +2028,7 @@ static int __init atari_floppy_init (void)
                unit[i].disk->first_minor = i;
                sprintf(unit[i].disk->disk_name, "fd%d", i);
                unit[i].disk->fops = &floppy_fops;
+               unit[i].disk->events = DISK_EVENT_MEDIA_CHANGE;
                unit[i].disk->private_data = &unit[i];
                set_capacity(unit[i].disk, MAX_DISK_SIZE * 2);
                add_disk(unit[i].disk);
index 95f608d1a098a2c0d0d312e1bd6be82517bfabaf..8072bd9881e69ac30f07b252a4ce88605032838c 100644 (file)
@@ -4540,6 +4540,7 @@ static int __init do_floppy_init(void)
                disks[drive]->major = FLOPPY_MAJOR;
                disks[drive]->first_minor = TOMINOR(drive);
                disks[drive]->fops = &floppy_fops;
+               disks[drive]->events = DISK_EVENT_MEDIA_CHANGE;
                sprintf(disks[drive]->disk_name, "fd%d", drive);
 
                timer_setup(&motor_off_timer[drive], motor_off_callback, 0);
index 377a694dc22814b9d040a64a9d3ffd7666f5a6a4..5436d856e65613303235c3c5b6513b47128c21d4 100644 (file)
@@ -342,6 +342,7 @@ static void pcd_init_units(void)
                strcpy(disk->disk_name, cd->name);      /* umm... */
                disk->fops = &pcd_bdops;
                disk->flags = GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE;
+               disk->events = DISK_EVENT_MEDIA_CHANGE;
        }
 }
 
index 0ff9b12d0e350621c5a32b82fd242639249559d0..6f9ad3fc716f67b0a3fd804afa6ac5c0641a3448 100644 (file)
@@ -897,6 +897,7 @@ static void pd_probe_drive(struct pd_unit *disk)
        p->fops = &pd_fops;
        p->major = major;
        p->first_minor = (disk - pd) << PD_BITS;
+       p->events = DISK_EVENT_MEDIA_CHANGE;
        disk->gd = p;
        p->private_data = disk;
 
index 103b617cdc3184c0a381e569fbb8d8c81894585c..1aca4a8acb5548d2aee0b59177ad21406760a9bb 100644 (file)
@@ -319,6 +319,7 @@ static void __init pf_init_units(void)
                disk->first_minor = unit;
                strcpy(disk->disk_name, pf->name);
                disk->fops = &pf_fops;
+               disk->events = DISK_EVENT_MEDIA_CHANGE;
                if (!(*drives[unit])[D_PRT])
                        pf_drive_count++;
        }
index 3fa6fcc3479030a6caa63a9a760c0b2d53319fc4..67b5ec281c6d2edf128b34ac598ffa98ff3b0301 100644 (file)
@@ -862,6 +862,7 @@ static int swim_floppy_init(struct swim_priv *swd)
                swd->unit[drive].disk->first_minor = drive;
                sprintf(swd->unit[drive].disk->disk_name, "fd%d", drive);
                swd->unit[drive].disk->fops = &floppy_fops;
+               swd->unit[drive].disk->events = DISK_EVENT_MEDIA_CHANGE;
                swd->unit[drive].disk->private_data = &swd->unit[drive];
                set_capacity(swd->unit[drive].disk, 2880);
                add_disk(swd->unit[drive].disk);
index 1e2ae90d7715adfadd59a131f637f5c86667502a..cf42729c788e9ce9c6a8591dafcc31a650b991f6 100644 (file)
@@ -1216,6 +1216,7 @@ static int swim3_attach(struct macio_dev *mdev,
        disk->first_minor = floppy_count;
        disk->fops = &floppy_fops;
        disk->private_data = fs;
+       disk->events = DISK_EVENT_MEDIA_CHANGE;
        disk->flags |= GENHD_FL_REMOVABLE;
        sprintf(disk->disk_name, "fd%d", floppy_count);
        set_capacity(disk, 2880);
index 87ccef4bd69e904b1f19403e82403bd5cd13a277..8d299507efe7e34f2b4f22863f1f7d19a5070d54 100644 (file)
@@ -1032,6 +1032,7 @@ static int ace_setup(struct ace_device *ace)
        ace->gd->major = ace_major;
        ace->gd->first_minor = ace->id * ACE_NUM_MINORS;
        ace->gd->fops = &ace_fops;
+       ace->gd->events = DISK_EVENT_MEDIA_CHANGE;
        ace->gd->queue = ace->queue;
        ace->gd->private_data = ace;
        snprintf(ace->gd->disk_name, 32, "xs%c", ace->id + 'a');
index f8b7345fe1cb6071301e3df34305b1bf654d3b44..5cf3bade0d576e6f7c89fec78c9f7f4d70d4ef91 100644 (file)
@@ -786,6 +786,7 @@ static int probe_gdrom(struct platform_device *devptr)
                goto probe_fail_cdrom_register;
        }
        gd.disk->fops = &gdrom_bdops;
+       gd.disk->events = DISK_EVENT_MEDIA_CHANGE;
        /* latch on to the interrupt */
        err = gdrom_set_interrupt_handlers();
        if (err)