lkml.org 
[lkml]   [2010]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 16/16] staging: convert to bdops->check_events()
    Date
    Convert two staging drivers - blkvsc_drv and cyasblkdev_block - from
    ->media_changed() to ->check_events(). The former always indicated
    media changed while the latter always indicated media not changed.
    Not sure what the drivers are trying to achieve but keep the original
    behavior.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Kay Sievers <kay.sievers@vrfy.org>
    Cc: Greg Kroah-Hartman <gregkh@suse.de>
    ---
    drivers/staging/hv/blkvsc_drv.c | 11 +++++++----
    .../westbridge/astoria/block/cyasblkdev_block.c | 11 +++++++----
    2 files changed, 14 insertions(+), 8 deletions(-)

    diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
    index 3f81ca5..9944385 100644
    --- a/drivers/staging/hv/blkvsc_drv.c
    +++ b/drivers/staging/hv/blkvsc_drv.c
    @@ -131,7 +131,8 @@ static void blkvsc_shutdown(struct device *device);

    static int blkvsc_open(struct block_device *bdev, fmode_t mode);
    static int blkvsc_release(struct gendisk *disk, fmode_t mode);
    -static int blkvsc_media_changed(struct gendisk *gd);
    +static unsigned int blkvsc_check_events(struct gendisk *gd,
    + unsigned int clearing);
    static int blkvsc_revalidate_disk(struct gendisk *gd);
    static int blkvsc_getgeo(struct block_device *bd, struct hd_geometry *hg);
    static int blkvsc_ioctl(struct block_device *bd, fmode_t mode,
    @@ -162,7 +163,7 @@ static const struct block_device_operations block_ops = {
    .owner = THIS_MODULE,
    .open = blkvsc_open,
    .release = blkvsc_release,
    - .media_changed = blkvsc_media_changed,
    + .check_events = blkvsc_check_events,
    .revalidate_disk = blkvsc_revalidate_disk,
    .getgeo = blkvsc_getgeo,
    .ioctl = blkvsc_ioctl,
    @@ -367,6 +368,7 @@ static int blkvsc_probe(struct device *device)
    else
    blkdev->gd->first_minor = 0;
    blkdev->gd->fops = &block_ops;
    + blkdev->gd->events = DISK_EVENT_MEDIA_CHANGE;
    blkdev->gd->private_data = blkdev;
    sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum);

    @@ -1346,10 +1348,11 @@ static int blkvsc_release(struct gendisk *disk, fmode_t mode)
    return 0;
    }

    -static int blkvsc_media_changed(struct gendisk *gd)
    +static unsigned int blkvsc_check_events(struct gendisk *gd,
    + unsigned int clearing)
    {
    DPRINT_DBG(BLKVSC_DRV, "- enter\n");
    - return 1;
    + return DISK_EVENT_MEDIA_CHANGE;
    }

    static int blkvsc_revalidate_disk(struct gendisk *gd)
    diff --git a/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c b/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c
    index e1851f0..842cd92 100644
    --- a/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c
    +++ b/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c
    @@ -381,10 +381,10 @@ static int cyasblkdev_blk_ioctl(
    return -ENOTTY;
    }

    -/* Media_changed block_device opp
    +/* check_events block_device opp
    * this one is called by kernel to confirm if the media really changed
    * as we indicated by issuing check_disk_change() call */
    -int cyasblkdev_media_changed(struct gendisk *gd)
    +unsigned int cyasblkdev_check_events(struct gendisk *gd, unsigned int clearing)
    {
    struct cyasblkdev_blk_data *bd;

    @@ -402,7 +402,7 @@ int cyasblkdev_media_changed(struct gendisk *gd)
    #endif
    }

    - /* return media change state "1" yes, 0 no */
    + /* return media change state - DISK_EVENT_MEDIA_CHANGE yes, 0 no */
    return 0;
    }

    @@ -432,7 +432,7 @@ static struct block_device_operations cyasblkdev_bdops = {
    .ioctl = cyasblkdev_blk_ioctl,
    /* .getgeo = cyasblkdev_blk_getgeo, */
    /* added to support media removal( real and simulated) media */
    - .media_changed = cyasblkdev_media_changed,
    + .check_events = cyasblkdev_check_events,
    /* added to support media removal( real and simulated) media */
    .revalidate_disk = cyasblkdev_revalidate_disk,
    .owner = THIS_MODULE,
    @@ -1090,6 +1090,7 @@ static int cyasblkdev_add_disks(int bus_num,
    bd->user_disk_0->first_minor = devidx << CYASBLKDEV_SHIFT;
    bd->user_disk_0->minors = 8;
    bd->user_disk_0->fops = &cyasblkdev_bdops;
    + bd->user_disk_0->events = DISK_EVENT_MEDIA_CHANGE;
    bd->user_disk_0->private_data = bd;
    bd->user_disk_0->queue = bd->queue.queue;
    bd->dbgprn_flags = DBGPRN_RD_RQ;
    @@ -1190,6 +1191,7 @@ static int cyasblkdev_add_disks(int bus_num,
    bd->user_disk_1->first_minor = (devidx + 1) << CYASBLKDEV_SHIFT;
    bd->user_disk_1->minors = 8;
    bd->user_disk_1->fops = &cyasblkdev_bdops;
    + bd->user_disk_0->events = DISK_EVENT_MEDIA_CHANGE;
    bd->user_disk_1->private_data = bd;
    bd->user_disk_1->queue = bd->queue.queue;
    bd->dbgprn_flags = DBGPRN_RD_RQ;
    @@ -1278,6 +1280,7 @@ static int cyasblkdev_add_disks(int bus_num,
    (devidx + 2) << CYASBLKDEV_SHIFT;
    bd->system_disk->minors = 8;
    bd->system_disk->fops = &cyasblkdev_bdops;
    + bd->system_disk->events = DISK_EVENT_MEDIA_CHANGE;
    bd->system_disk->private_data = bd;
    bd->system_disk->queue = bd->queue.queue;
    /* don't search for vfat
    --
    1.7.1


    \
     
     \ /
      Last update: 2010-12-28 18:33    [W:0.035 / U:0.332 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site