aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cdrom/gdrom.c
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
commit1c27030bd21e7e2c68ef5be9f28c63778cf4b27f (patch)
tree16308baa3d530d52d517e77e4d9f797647deb2e6 /drivers/cdrom/gdrom.c
parent1a8a74f03fcde1725ff26520220f3d21dbd8faa1 (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/gdrom.c')
-rw-r--r--drivers/cdrom/gdrom.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index 64a21461c408..b2b034fea34e 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -395,10 +395,12 @@ static int gdrom_drivestatus(struct cdrom_device_info *cd_info, int ignore)
395 return CDS_NO_INFO; 395 return CDS_NO_INFO;
396} 396}
397 397
398static int gdrom_mediachanged(struct cdrom_device_info *cd_info, int ignore) 398static unsigned int gdrom_check_events(struct cdrom_device_info *cd_info,
399 unsigned int clearing, int ignore)
399{ 400{
400 /* check the sense key */ 401 /* check the sense key */
401 return (__raw_readb(GDROM_ERROR_REG) & 0xF0) == 0x60; 402 return (__raw_readb(GDROM_ERROR_REG) & 0xF0) == 0x60 ?
403 DISK_EVENT_MEDIA_CHANGE : 0;
402} 404}
403 405
404/* reset the G1 bus */ 406/* reset the G1 bus */
@@ -483,7 +485,7 @@ static struct cdrom_device_ops gdrom_ops = {
483 .open = gdrom_open, 485 .open = gdrom_open,
484 .release = gdrom_release, 486 .release = gdrom_release,
485 .drive_status = gdrom_drivestatus, 487 .drive_status = gdrom_drivestatus,
486 .media_changed = gdrom_mediachanged, 488 .check_events = gdrom_check_events,
487 .get_last_session = gdrom_get_last_session, 489 .get_last_session = gdrom_get_last_session,
488 .reset = gdrom_hardreset, 490 .reset = gdrom_hardreset,
489 .audio_ioctl = gdrom_audio_ioctl, 491 .audio_ioctl = gdrom_audio_ioctl,
@@ -509,9 +511,10 @@ static int gdrom_bdops_release(struct gendisk *disk, fmode_t mode)
509 return 0; 511 return 0;
510} 512}
511 513
512static int gdrom_bdops_mediachanged(struct gendisk *disk) 514static unsigned int gdrom_bdops_check_events(struct gendisk *disk,
515 unsigned int clearing)
513{ 516{
514 return cdrom_media_changed(gd.cd_info); 517 return cdrom_check_events(gd.cd_info, clearing);
515} 518}
516 519
517static int gdrom_bdops_ioctl(struct block_device *bdev, fmode_t mode, 520static int gdrom_bdops_ioctl(struct block_device *bdev, fmode_t mode,
@@ -530,7 +533,7 @@ static const struct block_device_operations gdrom_bdops = {
530 .owner = THIS_MODULE, 533 .owner = THIS_MODULE,
531 .open = gdrom_bdops_open, 534 .open = gdrom_bdops_open,
532 .release = gdrom_bdops_release, 535 .release = gdrom_bdops_release,
533 .media_changed = gdrom_bdops_mediachanged, 536 .check_events = gdrom_bdops_check_events,
534 .ioctl = gdrom_bdops_ioctl, 537 .ioctl = gdrom_bdops_ioctl,
535}; 538};
536 539
@@ -800,6 +803,7 @@ static int __devinit probe_gdrom(struct platform_device *devptr)
800 goto probe_fail_cdrom_register; 803 goto probe_fail_cdrom_register;
801 } 804 }
802 gd.disk->fops = &gdrom_bdops; 805 gd.disk->fops = &gdrom_bdops;
806 gd.disk->events = DISK_EVENT_MEDIA_CHANGE;
803 /* latch on to the interrupt */ 807 /* latch on to the interrupt */
804 err = gdrom_set_interrupt_handlers(); 808 err = gdrom_set_interrupt_handlers();
805 if (err) 809 if (err)