diff options
author | Tejun Heo <tj@kernel.org> | 2011-03-09 13:54:28 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2011-03-09 13:54:28 -0500 |
commit | 4bbde77787270e17418dd32c7eb32e42ad16cfc7 (patch) | |
tree | 325ba3aed0ef7b5f68f20d6577c5e14876ca9107 /drivers/block/swim3.c | |
parent | 507daea2276677785ba8096d90b9e8049632fc46 (diff) |
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: Tejun 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>
Diffstat (limited to 'drivers/block/swim3.c')
-rw-r--r-- | drivers/block/swim3.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index bf3a5b859299..4c10f56facbf 100644 --- a/drivers/block/swim3.c +++ b/drivers/block/swim3.c | |||
@@ -250,7 +250,8 @@ static int floppy_ioctl(struct block_device *bdev, fmode_t mode, | |||
250 | unsigned int cmd, unsigned long param); | 250 | unsigned int cmd, unsigned long param); |
251 | static int floppy_open(struct block_device *bdev, fmode_t mode); | 251 | static int floppy_open(struct block_device *bdev, fmode_t mode); |
252 | static int floppy_release(struct gendisk *disk, fmode_t mode); | 252 | static int floppy_release(struct gendisk *disk, fmode_t mode); |
253 | static int floppy_check_change(struct gendisk *disk); | 253 | static unsigned int floppy_check_events(struct gendisk *disk, |
254 | unsigned int clearing); | ||
254 | static int floppy_revalidate(struct gendisk *disk); | 255 | static int floppy_revalidate(struct gendisk *disk); |
255 | 256 | ||
256 | static bool swim3_end_request(int err, unsigned int nr_bytes) | 257 | 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 | return 0; | 976 | return 0; |
976 | } | 977 | } |
977 | 978 | ||
978 | static int floppy_check_change(struct gendisk *disk) | 979 | static unsigned int floppy_check_events(struct gendisk *disk, |
980 | unsigned int clearing) | ||
979 | { | 981 | { |
980 | struct floppy_state *fs = disk->private_data; | 982 | struct floppy_state *fs = disk->private_data; |
981 | return fs->ejected; | 983 | return fs->ejected ? DISK_EVENT_MEDIA_CHANGE : 0; |
982 | } | 984 | } |
983 | 985 | ||
984 | static int floppy_revalidate(struct gendisk *disk) | 986 | static int floppy_revalidate(struct gendisk *disk) |
@@ -1025,7 +1027,7 @@ static const struct block_device_operations floppy_fops = { | |||
1025 | .open = floppy_unlocked_open, | 1027 | .open = floppy_unlocked_open, |
1026 | .release = floppy_release, | 1028 | .release = floppy_release, |
1027 | .ioctl = floppy_ioctl, | 1029 | .ioctl = floppy_ioctl, |
1028 | .media_changed = floppy_check_change, | 1030 | .check_events = floppy_check_events, |
1029 | .revalidate_disk= floppy_revalidate, | 1031 | .revalidate_disk= floppy_revalidate, |
1030 | }; | 1032 | }; |
1031 | 1033 | ||
@@ -1161,6 +1163,7 @@ static int __devinit swim3_attach(struct macio_dev *mdev, const struct of_device | |||
1161 | disk->major = FLOPPY_MAJOR; | 1163 | disk->major = FLOPPY_MAJOR; |
1162 | disk->first_minor = i; | 1164 | disk->first_minor = i; |
1163 | disk->fops = &floppy_fops; | 1165 | disk->fops = &floppy_fops; |
1166 | disk->events = DISK_EVENT_MEDIA_CHANGE; | ||
1164 | disk->private_data = &floppy_states[i]; | 1167 | disk->private_data = &floppy_states[i]; |
1165 | disk->queue = swim3_queue; | 1168 | disk->queue = swim3_queue; |
1166 | disk->flags |= GENHD_FL_REMOVABLE; | 1169 | disk->flags |= GENHD_FL_REMOVABLE; |