From: Tejun Heo <tj@kernel.org>
To: axboe@kernel.dk, linux-kernel@vger.kernel.org,
kay.sievers@vrfy.org, hch@infradead.org
Cc: Tejun Heo <tj@kernel.org>, Peter Osterlund <petero2@telia.com>
Subject: [PATCH 15/16] pktcdvd: Convert to bdops->check_events()
Date: Wed, 9 Mar 2011 10:13:35 +0100 [thread overview]
Message-ID: <1299662016-7721-16-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1299662016-7721-1-git-send-email-tj@kernel.org>
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 | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 77d70ee..a077db2 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,
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);
--
1.7.1
next prev parent reply other threads:[~2011-03-09 9:17 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-09 9:13 [PATCHSET] block: Convert block drivers to ->check_events(), take#2 Tejun Heo
2011-03-09 9:13 ` [PATCH 01/16] block: Don't implicitly trigger event check on disk_unblock_events() Tejun Heo
2011-03-09 9:13 ` [PATCH 02/16] block: Don't check events on close unless it was blocked Tejun Heo
2011-03-09 9:13 ` [PATCH 03/16] block: Don't check events while open is in progress Tejun Heo
2011-03-09 9:13 ` [PATCH 04/16] ide: Convert to bdops->check_events() Tejun Heo
2011-03-09 22:17 ` David Miller
2011-03-09 9:13 ` [PATCH 05/16] floppy,{ami|ata}flop: " Tejun Heo
2011-03-09 9:13 ` [PATCH 06/16] gdrom,viocd: " Tejun Heo
2011-03-09 9:13 ` [PATCH 07/16] paride: " Tejun Heo
2011-03-09 9:13 ` [PATCH 08/16] dac960: " Tejun Heo
2011-03-09 9:13 ` [PATCH 09/16] swim[3]: " Tejun Heo
2011-03-10 0:10 ` Benjamin Herrenschmidt
2011-03-09 9:13 ` [PATCH 10/16] ub: " Tejun Heo
2011-03-09 16:46 ` Pete Zaitcev
2011-03-09 16:58 ` Tejun Heo
2011-03-09 9:13 ` [PATCH 11/16] xsysace: " Tejun Heo
2011-03-09 9:13 ` [PATCH 12/16] i2o_block: " Tejun Heo
2011-03-09 9:13 ` [PATCH 13/16] s390/tape_block: " Tejun Heo
2011-03-09 9:13 ` [PATCH 14/16] umem: Drop dummy ->media_changed() Tejun Heo
2011-03-09 9:13 ` Tejun Heo [this message]
2011-03-09 9:13 ` [PATCH 16/16] staging: Convert to bdops->check_events() Tejun Heo
2011-03-09 9:20 ` [PATCHSET] block: Convert block drivers to ->check_events(), take#2 Jens Axboe
2011-03-09 14:49 ` Jens Axboe
2011-03-09 15:38 ` block: Fix oops caused by __blkdev_get() calling disk_unblock_events() with invalid @disk Tejun Heo
2011-03-09 18:26 ` Jens Axboe
2011-03-09 18:59 ` Tejun Heo
2011-03-09 19:16 ` Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2010-12-28 17:28 [PATCHSET] block: convert block drivers to ->check_events() Tejun Heo
2010-12-28 17:29 ` [PATCH 15/16] pktcdvd: convert to bdops->check_events() Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1299662016-7721-16-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=petero2@telia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.