aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cd.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-03-09 13:54:27 -0500
committerTejun Heo <tj@kernel.org>2011-03-09 13:54:27 -0500
commit5b03a1b140e13a28ff6be1526892a9dc538ddef6 (patch)
tree63d6acaaf4d3c7855cbe4a76dca73f66cda72c31 /drivers/ide/ide-cd.c
parent69e02c59a7d962dced8047401b81a8d897e1702e (diff)
ide: Convert to bdops->check_events()
Convert ->media_changed() to the new ->check_events() method. The conversion is mostly mechanical. The only notable change is that cdrom now doesn't generate any event if @slot_nr isn't CDSL_CURRENT. It used to return -EINVAL which would be treated as media changed. As media changer isn't supported anyway, this doesn't make any difference. This makes ide emit the standard disk events and allows kernel event polling. Currently, only MEDIA_CHANGE event is implemented. Adding support for EJECT_REQUEST shouldn't be difficult; however, given that ide driver is already deprecated, it probably is best to leave it alone. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Jens Axboe <axboe@kernel.dk> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: linux-ide@vger.kernel.org
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r--drivers/ide/ide-cd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 0c73fe39a236..a2e29099ee0c 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1177,7 +1177,7 @@ static struct cdrom_device_ops ide_cdrom_dops = {
1177 .open = ide_cdrom_open_real, 1177 .open = ide_cdrom_open_real,
1178 .release = ide_cdrom_release_real, 1178 .release = ide_cdrom_release_real,
1179 .drive_status = ide_cdrom_drive_status, 1179 .drive_status = ide_cdrom_drive_status,
1180 .media_changed = ide_cdrom_check_media_change_real, 1180 .check_events = ide_cdrom_check_events_real,
1181 .tray_move = ide_cdrom_tray_move, 1181 .tray_move = ide_cdrom_tray_move,
1182 .lock_door = ide_cdrom_lock_door, 1182 .lock_door = ide_cdrom_lock_door,
1183 .select_speed = ide_cdrom_select_speed, 1183 .select_speed = ide_cdrom_select_speed,
@@ -1702,10 +1702,11 @@ static int idecd_ioctl(struct block_device *bdev, fmode_t mode,
1702} 1702}
1703 1703
1704 1704
1705static int idecd_media_changed(struct gendisk *disk) 1705static unsigned int idecd_check_events(struct gendisk *disk,
1706 unsigned int clearing)
1706{ 1707{
1707 struct cdrom_info *info = ide_drv_g(disk, cdrom_info); 1708 struct cdrom_info *info = ide_drv_g(disk, cdrom_info);
1708 return cdrom_media_changed(&info->devinfo); 1709 return cdrom_check_events(&info->devinfo, clearing);
1709} 1710}
1710 1711
1711static int idecd_revalidate_disk(struct gendisk *disk) 1712static int idecd_revalidate_disk(struct gendisk *disk)
@@ -1723,7 +1724,7 @@ static const struct block_device_operations idecd_ops = {
1723 .open = idecd_open, 1724 .open = idecd_open,
1724 .release = idecd_release, 1725 .release = idecd_release,
1725 .ioctl = idecd_ioctl, 1726 .ioctl = idecd_ioctl,
1726 .media_changed = idecd_media_changed, 1727 .check_events = idecd_check_events,
1727 .revalidate_disk = idecd_revalidate_disk 1728 .revalidate_disk = idecd_revalidate_disk
1728}; 1729};
1729 1730
@@ -1790,6 +1791,7 @@ static int ide_cd_probe(ide_drive_t *drive)
1790 ide_cd_read_toc(drive, &sense); 1791 ide_cd_read_toc(drive, &sense);
1791 g->fops = &idecd_ops; 1792 g->fops = &idecd_ops;
1792 g->flags |= GENHD_FL_REMOVABLE; 1793 g->flags |= GENHD_FL_REMOVABLE;
1794 g->events = DISK_EVENT_MEDIA_CHANGE;
1793 add_disk(g); 1795 add_disk(g);
1794 return 0; 1796 return 0;
1795 1797