From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Tejun Heo <tj@kernel.org>
Cc: axboe@kernel.dk, linux-kernel@vger.kernel.org,
kay.sievers@vrfy.org, hch@infradead.org,
Laurent Vivier <laurent@lvivier.info>
Subject: Re: [PATCH 09/16] swim[3]: Convert to bdops->check_events()
Date: Thu, 10 Mar 2011 11:10:25 +1100 [thread overview]
Message-ID: <1299715825.22236.445.camel@pasglop> (raw)
In-Reply-To: <1299662016-7721-10-git-send-email-tj@kernel.org>
On Wed, 2011-03-09 at 10:13 +0100, Tejun Heo wrote:
> Convert from ->media_changed() to ->check_events().
>
> Both swim and swim3 buffer media changed state and clear it on
> revalidation. They will behave correctly with kernel event polling.
No objection. I don't have HW to test at the moment but it looks obvious
enough provided you compiled tested it :
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
I'll try to dig HW later.
Cheers,
Ben.
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: Kay Sievers <kay.sievers@vrfy.org>
> Cc: Laurent Vivier <laurent@lvivier.info>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> drivers/block/swim.c | 8 +++++---
> drivers/block/swim3.c | 11 +++++++----
> 2 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/block/swim.c b/drivers/block/swim.c
> index 75333d0..24a482f 100644
> --- a/drivers/block/swim.c
> +++ b/drivers/block/swim.c
> @@ -741,11 +741,12 @@ static int floppy_getgeo(struct block_device *bdev, struct hd_geometry *geo)
> return 0;
> }
>
> -static int floppy_check_change(struct gendisk *disk)
> +static unsigned int floppy_check_events(struct gendisk *disk,
> + unsigned int clearing)
> {
> struct floppy_state *fs = disk->private_data;
>
> - return fs->ejected;
> + return fs->ejected ? DISK_EVENT_MEDIA_CHANGE : 0;
> }
>
> static int floppy_revalidate(struct gendisk *disk)
> @@ -772,7 +773,7 @@ static const struct block_device_operations floppy_fops = {
> .release = floppy_release,
> .ioctl = floppy_ioctl,
> .getgeo = floppy_getgeo,
> - .media_changed = floppy_check_change,
> + .check_events = floppy_check_events,
> .revalidate_disk = floppy_revalidate,
> };
>
> @@ -857,6 +858,7 @@ static int __devinit swim_floppy_init(struct swim_priv *swd)
> swd->unit[drive].disk->first_minor = drive;
> sprintf(swd->unit[drive].disk->disk_name, "fd%d", drive);
> swd->unit[drive].disk->fops = &floppy_fops;
> + swd->unit[drive].disk->events = DISK_EVENT_MEDIA_CHANGE;
> swd->unit[drive].disk->private_data = &swd->unit[drive];
> swd->unit[drive].disk->queue = swd->queue;
> set_capacity(swd->unit[drive].disk, 2880);
> diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
> index bf3a5b8..4c10f56 100644
> --- a/drivers/block/swim3.c
> +++ b/drivers/block/swim3.c
> @@ -250,7 +250,8 @@ static int floppy_ioctl(struct block_device *bdev, fmode_t mode,
> unsigned int cmd, unsigned long param);
> static int floppy_open(struct block_device *bdev, fmode_t mode);
> static int floppy_release(struct gendisk *disk, fmode_t mode);
> -static int floppy_check_change(struct gendisk *disk);
> +static unsigned int floppy_check_events(struct gendisk *disk,
> + unsigned int clearing);
> static int floppy_revalidate(struct gendisk *disk);
>
> static bool swim3_end_request(int err, unsigned int nr_bytes)
> @@ -975,10 +976,11 @@ static int floppy_release(struct gendisk *disk, fmode_t mode)
> return 0;
> }
>
> -static int floppy_check_change(struct gendisk *disk)
> +static unsigned int floppy_check_events(struct gendisk *disk,
> + unsigned int clearing)
> {
> struct floppy_state *fs = disk->private_data;
> - return fs->ejected;
> + return fs->ejected ? DISK_EVENT_MEDIA_CHANGE : 0;
> }
>
> static int floppy_revalidate(struct gendisk *disk)
> @@ -1025,7 +1027,7 @@ static const struct block_device_operations floppy_fops = {
> .open = floppy_unlocked_open,
> .release = floppy_release,
> .ioctl = floppy_ioctl,
> - .media_changed = floppy_check_change,
> + .check_events = floppy_check_events,
> .revalidate_disk= floppy_revalidate,
> };
>
> @@ -1161,6 +1163,7 @@ static int __devinit swim3_attach(struct macio_dev *mdev, const struct of_device
> disk->major = FLOPPY_MAJOR;
> disk->first_minor = i;
> disk->fops = &floppy_fops;
> + disk->events = DISK_EVENT_MEDIA_CHANGE;
> disk->private_data = &floppy_states[i];
> disk->queue = swim3_queue;
> disk->flags |= GENHD_FL_REMOVABLE;
next prev parent reply other threads:[~2011-03-10 0:15 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 [this message]
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 ` [PATCH 15/16] pktcdvd: Convert to bdops->check_events() Tejun Heo
2011-03-09 9:13 ` [PATCH 16/16] staging: " 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 09/16] swim[3]: 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=1299715825.22236.445.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=kay.sievers@vrfy.org \
--cc=laurent@lvivier.info \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox