Commit 4bbde777 authored by Tejun Heo's avatar Tejun Heo

swim[3]: Convert to bdops->check_events()

Convert from ->media_changed() to ->check_events().

Both swim and swim3 buffer media changed state and clear it on
revalidation.  They will behave correctly with kernel event polling.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Laurent Vivier <laurent@lvivier.info>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
parent 507daea2
...@@ -741,11 +741,12 @@ static int floppy_getgeo(struct block_device *bdev, struct hd_geometry *geo) ...@@ -741,11 +741,12 @@ static int floppy_getgeo(struct block_device *bdev, struct hd_geometry *geo)
return 0; return 0;
} }
static int floppy_check_change(struct gendisk *disk) static unsigned int floppy_check_events(struct gendisk *disk,
unsigned int clearing)
{ {
struct floppy_state *fs = disk->private_data; struct floppy_state *fs = disk->private_data;
return fs->ejected; return fs->ejected ? DISK_EVENT_MEDIA_CHANGE : 0;
} }
static int floppy_revalidate(struct gendisk *disk) static int floppy_revalidate(struct gendisk *disk)
...@@ -772,7 +773,7 @@ static const struct block_device_operations floppy_fops = { ...@@ -772,7 +773,7 @@ static const struct block_device_operations floppy_fops = {
.release = floppy_release, .release = floppy_release,
.ioctl = floppy_ioctl, .ioctl = floppy_ioctl,
.getgeo = floppy_getgeo, .getgeo = floppy_getgeo,
.media_changed = floppy_check_change, .check_events = floppy_check_events,
.revalidate_disk = floppy_revalidate, .revalidate_disk = floppy_revalidate,
}; };
...@@ -857,6 +858,7 @@ static int __devinit swim_floppy_init(struct swim_priv *swd) ...@@ -857,6 +858,7 @@ static int __devinit swim_floppy_init(struct swim_priv *swd)
swd->unit[drive].disk->first_minor = drive; swd->unit[drive].disk->first_minor = drive;
sprintf(swd->unit[drive].disk->disk_name, "fd%d", drive); sprintf(swd->unit[drive].disk->disk_name, "fd%d", drive);
swd->unit[drive].disk->fops = &floppy_fops; 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]; swd->unit[drive].disk->private_data = &swd->unit[drive];
swd->unit[drive].disk->queue = swd->queue; swd->unit[drive].disk->queue = swd->queue;
set_capacity(swd->unit[drive].disk, 2880); set_capacity(swd->unit[drive].disk, 2880);
......
...@@ -250,7 +250,8 @@ static int floppy_ioctl(struct block_device *bdev, fmode_t mode, ...@@ -250,7 +250,8 @@ static int floppy_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long param); unsigned int cmd, unsigned long param);
static int floppy_open(struct block_device *bdev, fmode_t mode); static int floppy_open(struct block_device *bdev, fmode_t mode);
static int floppy_release(struct gendisk *disk, fmode_t mode); static int floppy_release(struct gendisk *disk, fmode_t mode);
static int floppy_check_change(struct gendisk *disk); static unsigned int floppy_check_events(struct gendisk *disk,
unsigned int clearing);
static int floppy_revalidate(struct gendisk *disk); static int floppy_revalidate(struct gendisk *disk);
static bool swim3_end_request(int err, unsigned int nr_bytes) static bool swim3_end_request(int err, unsigned int nr_bytes)
...@@ -975,10 +976,11 @@ static int floppy_release(struct gendisk *disk, fmode_t mode) ...@@ -975,10 +976,11 @@ static int floppy_release(struct gendisk *disk, fmode_t mode)
return 0; return 0;
} }
static int floppy_check_change(struct gendisk *disk) static unsigned int floppy_check_events(struct gendisk *disk,
unsigned int clearing)
{ {
struct floppy_state *fs = disk->private_data; struct floppy_state *fs = disk->private_data;
return fs->ejected; return fs->ejected ? DISK_EVENT_MEDIA_CHANGE : 0;
} }
static int floppy_revalidate(struct gendisk *disk) static int floppy_revalidate(struct gendisk *disk)
...@@ -1025,7 +1027,7 @@ static const struct block_device_operations floppy_fops = { ...@@ -1025,7 +1027,7 @@ static const struct block_device_operations floppy_fops = {
.open = floppy_unlocked_open, .open = floppy_unlocked_open,
.release = floppy_release, .release = floppy_release,
.ioctl = floppy_ioctl, .ioctl = floppy_ioctl,
.media_changed = floppy_check_change, .check_events = floppy_check_events,
.revalidate_disk= floppy_revalidate, .revalidate_disk= floppy_revalidate,
}; };
...@@ -1161,6 +1163,7 @@ static int __devinit swim3_attach(struct macio_dev *mdev, const struct of_device ...@@ -1161,6 +1163,7 @@ static int __devinit swim3_attach(struct macio_dev *mdev, const struct of_device
disk->major = FLOPPY_MAJOR; disk->major = FLOPPY_MAJOR;
disk->first_minor = i; disk->first_minor = i;
disk->fops = &floppy_fops; disk->fops = &floppy_fops;
disk->events = DISK_EVENT_MEDIA_CHANGE;
disk->private_data = &floppy_states[i]; disk->private_data = &floppy_states[i];
disk->queue = swim3_queue; disk->queue = swim3_queue;
disk->flags |= GENHD_FL_REMOVABLE; disk->flags |= GENHD_FL_REMOVABLE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment