aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-03-09 13:54:28 -0500
committerTejun Heo <tj@kernel.org>2011-03-09 13:54:28 -0500
commitf47350fdecb7ce9fe715e2df4431c4b51c4ef46b (patch)
tree60825db09d0bbbf8a12c168b439fcda39e1ca9c3 /drivers
parent3a200911ada2d5b955c2c6daa22364c6de83c52c (diff)
i2o_block: Convert to bdops->check_events()
Convert from ->media_changed() to ->check_events(). i2o_block buffers media changed state and clears it after reporting. It 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: Markus Lidel <Markus.Lidel@shadowconnect.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/message/i2o/i2o_block.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index ae7cad185898..f81c25d4a125 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -695,20 +695,22 @@ static int i2o_block_ioctl(struct block_device *bdev, fmode_t mode,
695}; 695};
696 696
697/** 697/**
698 * i2o_block_media_changed - Have we seen a media change? 698 * i2o_block_check_events - Have we seen a media change?
699 * @disk: gendisk which should be verified 699 * @disk: gendisk which should be verified
700 * @clearing: events being cleared
700 * 701 *
701 * Verifies if the media has changed. 702 * Verifies if the media has changed.
702 * 703 *
703 * Returns 1 if the media was changed or 0 otherwise. 704 * Returns 1 if the media was changed or 0 otherwise.
704 */ 705 */
705static int i2o_block_media_changed(struct gendisk *disk) 706static unsigned int i2o_block_check_events(struct gendisk *disk,
707 unsigned int clearing)
706{ 708{
707 struct i2o_block_device *p = disk->private_data; 709 struct i2o_block_device *p = disk->private_data;
708 710
709 if (p->media_change_flag) { 711 if (p->media_change_flag) {
710 p->media_change_flag = 0; 712 p->media_change_flag = 0;
711 return 1; 713 return DISK_EVENT_MEDIA_CHANGE;
712 } 714 }
713 return 0; 715 return 0;
714} 716}
@@ -950,7 +952,7 @@ static const struct block_device_operations i2o_block_fops = {
950 .ioctl = i2o_block_ioctl, 952 .ioctl = i2o_block_ioctl,
951 .compat_ioctl = i2o_block_ioctl, 953 .compat_ioctl = i2o_block_ioctl,
952 .getgeo = i2o_block_getgeo, 954 .getgeo = i2o_block_getgeo,
953 .media_changed = i2o_block_media_changed 955 .check_events = i2o_block_check_events,
954}; 956};
955 957
956/** 958/**
@@ -1002,6 +1004,7 @@ static struct i2o_block_device *i2o_block_device_alloc(void)
1002 gd->major = I2O_MAJOR; 1004 gd->major = I2O_MAJOR;
1003 gd->queue = queue; 1005 gd->queue = queue;
1004 gd->fops = &i2o_block_fops; 1006 gd->fops = &i2o_block_fops;
1007 gd->events = DISK_EVENT_MEDIA_CHANGE;
1005 gd->private_data = dev; 1008 gd->private_data = dev;
1006 1009
1007 dev->gd = gd; 1010 dev->gd = gd;