mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-17 01:34:00 +08:00
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>
This commit is contained in:
parent
3a200911ad
commit
f47350fdec
@ -695,20 +695,22 @@ static int i2o_block_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
};
|
||||
|
||||
/**
|
||||
* i2o_block_media_changed - Have we seen a media change?
|
||||
* i2o_block_check_events - Have we seen a media change?
|
||||
* @disk: gendisk which should be verified
|
||||
* @clearing: events being cleared
|
||||
*
|
||||
* Verifies if the media has changed.
|
||||
*
|
||||
* Returns 1 if the media was changed or 0 otherwise.
|
||||
*/
|
||||
static int i2o_block_media_changed(struct gendisk *disk)
|
||||
static unsigned int i2o_block_check_events(struct gendisk *disk,
|
||||
unsigned int clearing)
|
||||
{
|
||||
struct i2o_block_device *p = disk->private_data;
|
||||
|
||||
if (p->media_change_flag) {
|
||||
p->media_change_flag = 0;
|
||||
return 1;
|
||||
return DISK_EVENT_MEDIA_CHANGE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -950,7 +952,7 @@ static const struct block_device_operations i2o_block_fops = {
|
||||
.ioctl = i2o_block_ioctl,
|
||||
.compat_ioctl = i2o_block_ioctl,
|
||||
.getgeo = i2o_block_getgeo,
|
||||
.media_changed = i2o_block_media_changed
|
||||
.check_events = i2o_block_check_events,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1002,6 +1004,7 @@ static struct i2o_block_device *i2o_block_device_alloc(void)
|
||||
gd->major = I2O_MAJOR;
|
||||
gd->queue = queue;
|
||||
gd->fops = &i2o_block_fops;
|
||||
gd->events = DISK_EVENT_MEDIA_CHANGE;
|
||||
gd->private_data = dev;
|
||||
|
||||
dev->gd = gd;
|
||||
|
Loading…
Reference in New Issue
Block a user