Skip to content

Commit

Permalink
pktcdvd: Convert to bdops->check_events()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tejun Heo committed Mar 9, 2011
1 parent 6fac80e commit 3c0d206
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions drivers/block/pktcdvd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -2806,17 +2807,17 @@ 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 = {
.owner = THIS_MODULE,
.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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3c0d206

Please sign in to comment.