diff options
-rw-r--r-- | drivers/block/pktcdvd.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 77d70eebb6b2..a077db27b7c9 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -2796,7 +2796,8 @@ static int pkt_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, | |||
2796 | return ret; | 2796 | return ret; |
2797 | } | 2797 | } |
2798 | 2798 | ||
2799 | static int pkt_media_changed(struct gendisk *disk) | 2799 | static unsigned int pkt_check_events(struct gendisk *disk, |
2800 | unsigned int clearing) | ||
2800 | { | 2801 | { |
2801 | struct pktcdvd_device *pd = disk->private_data; | 2802 | struct pktcdvd_device *pd = disk->private_data; |
2802 | struct gendisk *attached_disk; | 2803 | struct gendisk *attached_disk; |
@@ -2806,9 +2807,9 @@ static int pkt_media_changed(struct gendisk *disk) | |||
2806 | if (!pd->bdev) | 2807 | if (!pd->bdev) |
2807 | return 0; | 2808 | return 0; |
2808 | attached_disk = pd->bdev->bd_disk; | 2809 | attached_disk = pd->bdev->bd_disk; |
2809 | if (!attached_disk) | 2810 | if (!attached_disk || !attached_disk->fops->check_events) |
2810 | return 0; | 2811 | return 0; |
2811 | return attached_disk->fops->media_changed(attached_disk); | 2812 | return attached_disk->fops->check_events(attached_disk, clearing); |
2812 | } | 2813 | } |
2813 | 2814 | ||
2814 | static const struct block_device_operations pktcdvd_ops = { | 2815 | static const struct block_device_operations pktcdvd_ops = { |
@@ -2816,7 +2817,7 @@ static const struct block_device_operations pktcdvd_ops = { | |||
2816 | .open = pkt_open, | 2817 | .open = pkt_open, |
2817 | .release = pkt_close, | 2818 | .release = pkt_close, |
2818 | .ioctl = pkt_ioctl, | 2819 | .ioctl = pkt_ioctl, |
2819 | .media_changed = pkt_media_changed, | 2820 | .check_events = pkt_check_events, |
2820 | }; | 2821 | }; |
2821 | 2822 | ||
2822 | static char *pktcdvd_devnode(struct gendisk *gd, mode_t *mode) | 2823 | 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) | |||
2889 | if (ret) | 2890 | if (ret) |
2890 | goto out_new_dev; | 2891 | goto out_new_dev; |
2891 | 2892 | ||
2893 | /* inherit events of the host device */ | ||
2894 | disk->events = pd->bdev->bd_disk->events; | ||
2895 | disk->async_events = pd->bdev->bd_disk->async_events; | ||
2896 | |||
2892 | add_disk(disk); | 2897 | add_disk(disk); |
2893 | 2898 | ||
2894 | pkt_sysfs_dev_new(pd); | 2899 | pkt_sysfs_dev_new(pd); |