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 | |
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>
-rw-r--r-- | drivers/block/swim.c | 8 | ||||
-rw-r--r-- | drivers/block/swim3.c | 11 |
2 files changed, 12 insertions, 7 deletions
diff --git a/drivers/block/swim.c b/drivers/block/swim.c index 75333d0a332..24a482f2fbd 100644 --- a/drivers/block/swim.c +++ b/drivers/block/swim.c | |||
@@ -741,11 +741,12 @@ static int floppy_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
741 | return 0; | 741 | return 0; |
742 | } | 742 | } |
743 | 743 | ||
744 | static int floppy_check_change(struct gendisk *disk) | 744 | static unsigned int floppy_check_events(struct gendisk *disk, |
745 | unsigned int clearing) | ||
745 | { | 746 | { |
746 | struct floppy_state *fs = disk->private_data; | 747 | struct floppy_state *fs = disk->private_data; |
747 | 748 | ||
748 | return fs->ejected; | 749 | return fs->ejected ? DISK_EVENT_MEDIA_CHANGE : 0; |
749 | } | 750 | } |
750 | 751 | ||
751 | static int floppy_revalidate(struct gendisk *disk) | 752 | static int floppy_revalidate(struct gendisk *disk) |
@@ -772,7 +773,7 @@ static const struct block_device_operations floppy_fops = { | |||
772 | .release = floppy_release, | 773 | .release = floppy_release, |
773 | .ioctl = floppy_ioctl, | 774 | .ioctl = floppy_ioctl, |
774 | .getgeo = floppy_getgeo, | 775 | .getgeo = floppy_getgeo, |
775 | .media_changed = floppy_check_change, | 776 | .check_events = floppy_check_events, |
776 | .revalidate_disk = floppy_revalidate, | 777 | .revalidate_disk = floppy_revalidate, |
777 | }; | 778 | }; |
778 | 779 | ||
@@ -857,6 +858,7 @@ static int __devinit swim_floppy_init(struct swim_priv *swd) | |||
857 | swd->unit[drive].disk->first_minor = drive; | 858 | swd->unit[drive].disk->first_minor = drive; |
858 | sprintf(swd->unit[drive].disk->disk_name, "fd%d", drive); | 859 | sprintf(swd->unit[drive].disk->disk_name, "fd%d", drive); |
859 | swd->unit[drive].disk->fops = &floppy_fops; | 860 | swd->unit[drive].disk->fops = &floppy_fops; |
861 | swd->unit[drive].disk->events = DISK_EVENT_MEDIA_CHANGE; | ||
860 | swd->unit[drive].disk->private_data = &swd->unit[drive]; | 862 | swd->unit[drive].disk->private_data = &swd->unit[drive]; |
861 | swd->unit[drive].disk->queue = swd->queue; | 863 | swd->unit[drive].disk->queue = swd->queue; |
862 | set_capacity(swd->unit[drive].disk, 2880); | 864 | set_capacity(swd->unit[drive].disk, 2880); |
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index bf3a5b85929..4c10f56facb 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; |