aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cdrom
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cdrom')
-rw-r--r--drivers/cdrom/gdrom.c16
-rw-r--r--drivers/cdrom/viocd.c17
2 files changed, 20 insertions, 13 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)
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
189static int viocd_blk_media_changed(struct gendisk *disk) 189static 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
195static const struct block_device_operations viocd_fops = { 196static 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
203static int viocd_open(struct cdrom_device_info *cdi, int purpose) 204static 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
323static int viocd_media_changed(struct cdrom_device_info *cdi, int disc_nr) 324static 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
360static int viocd_lock_door(struct cdrom_device_info *cdi, int locking) 362static 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,
550static struct cdrom_device_ops viocd_dops = { 552static 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;