pktcdvd: Convert to bdops->check_events()
authorTejun Heo <tj@kernel.org>
Wed, 9 Mar 2011 18:54:28 +0000 (19:54 +0100)
committerTejun Heo <tj@kernel.org>
Wed, 9 Mar 2011 18:54:28 +0000 (19:54 +0100)
Convert from ->media_changed() to ->check_events().

pktcdvd needs to forward all event related operations to the
underlying device.  Forward ->check_events() instead of
->media_changed() and inherit disk->[async_]events.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Peter Osterlund <petero2@telia.com>
drivers/block/pktcdvd.c

index 77d70ee..a077db2 100644 (file)
@@ -2796,7 +2796,8 @@ static int pkt_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
        return ret;
 }
 
-static int pkt_media_changed(struct gendisk *disk)
+static unsigned int pkt_check_events(struct gendisk *disk,
+                                    unsigned int clearing)
 {
        struct pktcdvd_device *pd = disk->private_data;
        struct gendisk *attached_disk;
@@ -2806,9 +2807,9 @@ static int pkt_media_changed(struct gendisk *disk)
        if (!pd->bdev)
                return 0;
        attached_disk = pd->bdev->bd_disk;
-       if (!attached_disk)
+       if (!attached_disk || !attached_disk->fops->check_events)
                return 0;
-       return attached_disk->fops->media_changed(attached_disk);
+       return attached_disk->fops->check_events(attached_disk, clearing);
 }
 
 static const struct block_device_operations pktcdvd_ops = {
@@ -2816,7 +2817,7 @@ static const struct block_device_operations pktcdvd_ops = {
        .open =                 pkt_open,
        .release =              pkt_close,
        .ioctl =                pkt_ioctl,
-       .media_changed =        pkt_media_changed,
+       .check_events =         pkt_check_events,
 };
 
 static char *pktcdvd_devnode(struct gendisk *gd, mode_t *mode)
@@ -2889,6 +2890,10 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev)
        if (ret)
                goto out_new_dev;
 
+       /* inherit events of the host device */
+       disk->events = pd->bdev->bd_disk->events;
+       disk->async_events = pd->bdev->bd_disk->async_events;
+
        add_disk(disk);
 
        pkt_sysfs_dev_new(pd);