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 | 1c27030bd21e7e2c68ef5be9f28c63778cf4b27f (patch) | |
tree | 16308baa3d530d52d517e77e4d9f797647deb2e6 /drivers/cdrom/viocd.c | |
parent | 1a8a74f03fcde1725ff26520220f3d21dbd8faa1 (diff) |
gdrom,viocd: Convert to bdops->check_events()
Convert gdrom and viocd from ->media_changed() to ->check_events().
It's unclear how the conditions are cleared and it's possible that it
may generate spurious events when polled.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Diffstat (limited to 'drivers/cdrom/viocd.c')
-rw-r--r-- | drivers/cdrom/viocd.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c index be73a9b493a6..4e874c5fa605 100644 --- a/drivers/cdrom/viocd.c +++ b/drivers/cdrom/viocd.c | |||
@@ -186,10 +186,11 @@ static int viocd_blk_ioctl(struct block_device *bdev, fmode_t mode, | |||
186 | return ret; | 186 | return ret; |
187 | } | 187 | } |
188 | 188 | ||
189 | static int viocd_blk_media_changed(struct gendisk *disk) | 189 | static unsigned int viocd_blk_check_events(struct gendisk *disk, |
190 | unsigned int clearing) | ||
190 | { | 191 | { |
191 | struct disk_info *di = disk->private_data; | 192 | struct disk_info *di = disk->private_data; |
192 | return cdrom_media_changed(&di->viocd_info); | 193 | return cdrom_check_events(&di->viocd_info, clearing); |
193 | } | 194 | } |
194 | 195 | ||
195 | static const struct block_device_operations viocd_fops = { | 196 | static const struct block_device_operations viocd_fops = { |
@@ -197,7 +198,7 @@ static const struct block_device_operations viocd_fops = { | |||
197 | .open = viocd_blk_open, | 198 | .open = viocd_blk_open, |
198 | .release = viocd_blk_release, | 199 | .release = viocd_blk_release, |
199 | .ioctl = viocd_blk_ioctl, | 200 | .ioctl = viocd_blk_ioctl, |
200 | .media_changed = viocd_blk_media_changed, | 201 | .check_events = viocd_blk_check_events, |
201 | }; | 202 | }; |
202 | 203 | ||
203 | static int viocd_open(struct cdrom_device_info *cdi, int purpose) | 204 | static int viocd_open(struct cdrom_device_info *cdi, int purpose) |
@@ -320,7 +321,8 @@ static void do_viocd_request(struct request_queue *q) | |||
320 | } | 321 | } |
321 | } | 322 | } |
322 | 323 | ||
323 | static int viocd_media_changed(struct cdrom_device_info *cdi, int disc_nr) | 324 | static unsigned int viocd_check_events(struct cdrom_device_info *cdi, |
325 | unsigned int clearing, int disc_nr) | ||
324 | { | 326 | { |
325 | struct viocd_waitevent we; | 327 | struct viocd_waitevent we; |
326 | HvLpEvent_Rc hvrc; | 328 | HvLpEvent_Rc hvrc; |
@@ -340,7 +342,7 @@ static int viocd_media_changed(struct cdrom_device_info *cdi, int disc_nr) | |||
340 | if (hvrc != 0) { | 342 | if (hvrc != 0) { |
341 | pr_warning("bad rc on HvCallEvent_signalLpEventFast %d\n", | 343 | pr_warning("bad rc on HvCallEvent_signalLpEventFast %d\n", |
342 | (int)hvrc); | 344 | (int)hvrc); |
343 | return -EIO; | 345 | return 0; |
344 | } | 346 | } |
345 | 347 | ||
346 | wait_for_completion(&we.com); | 348 | wait_for_completion(&we.com); |
@@ -354,7 +356,7 @@ static int viocd_media_changed(struct cdrom_device_info *cdi, int disc_nr) | |||
354 | return 0; | 356 | return 0; |
355 | } | 357 | } |
356 | 358 | ||
357 | return we.changed; | 359 | return we.changed ? DISK_EVENT_MEDIA_CHANGE : 0; |
358 | } | 360 | } |
359 | 361 | ||
360 | static int viocd_lock_door(struct cdrom_device_info *cdi, int locking) | 362 | static int viocd_lock_door(struct cdrom_device_info *cdi, int locking) |
@@ -550,7 +552,7 @@ static int viocd_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, | |||
550 | static struct cdrom_device_ops viocd_dops = { | 552 | static struct cdrom_device_ops viocd_dops = { |
551 | .open = viocd_open, | 553 | .open = viocd_open, |
552 | .release = viocd_release, | 554 | .release = viocd_release, |
553 | .media_changed = viocd_media_changed, | 555 | .check_events = viocd_check_events, |
554 | .lock_door = viocd_lock_door, | 556 | .lock_door = viocd_lock_door, |
555 | .generic_packet = viocd_packet, | 557 | .generic_packet = viocd_packet, |
556 | .audio_ioctl = viocd_audio_ioctl, | 558 | .audio_ioctl = viocd_audio_ioctl, |
@@ -624,6 +626,7 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
624 | gendisk->queue = q; | 626 | gendisk->queue = q; |
625 | gendisk->fops = &viocd_fops; | 627 | gendisk->fops = &viocd_fops; |
626 | gendisk->flags = GENHD_FL_CD|GENHD_FL_REMOVABLE; | 628 | gendisk->flags = GENHD_FL_CD|GENHD_FL_REMOVABLE; |
629 | gendisk->events = DISK_EVENT_MEDIA_CHANGE; | ||
627 | set_capacity(gendisk, 0); | 630 | set_capacity(gendisk, 0); |
628 | gendisk->private_data = d; | 631 | gendisk->private_data = d; |
629 | d->viocd_disk = gendisk; | 632 | d->viocd_disk = gendisk; |