Commit 77f93bfd authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

xsysace: simplify media change handling

Pass a struct ace_device to ace_revalidate_disk, move the media changed
check into the one caller that needs it, and give the routine a better
name.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent f094225b
...@@ -888,14 +888,10 @@ static unsigned int ace_check_events(struct gendisk *gd, unsigned int clearing) ...@@ -888,14 +888,10 @@ static unsigned int ace_check_events(struct gendisk *gd, unsigned int clearing)
return ace->media_change ? DISK_EVENT_MEDIA_CHANGE : 0; return ace->media_change ? DISK_EVENT_MEDIA_CHANGE : 0;
} }
static int ace_revalidate_disk(struct gendisk *gd) static void ace_media_changed(struct ace_device *ace)
{ {
struct ace_device *ace = gd->private_data;
unsigned long flags; unsigned long flags;
dev_dbg(ace->dev, "ace_revalidate_disk()\n");
if (ace->media_change) {
dev_dbg(ace->dev, "requesting cf id and scheduling tasklet\n"); dev_dbg(ace->dev, "requesting cf id and scheduling tasklet\n");
spin_lock_irqsave(&ace->lock, flags); spin_lock_irqsave(&ace->lock, flags);
...@@ -904,10 +900,8 @@ static int ace_revalidate_disk(struct gendisk *gd) ...@@ -904,10 +900,8 @@ static int ace_revalidate_disk(struct gendisk *gd)
tasklet_schedule(&ace->fsm_tasklet); tasklet_schedule(&ace->fsm_tasklet);
wait_for_completion(&ace->id_completion); wait_for_completion(&ace->id_completion);
}
dev_dbg(ace->dev, "revalidate complete\n"); dev_dbg(ace->dev, "revalidate complete\n");
return ace->id_result;
} }
static int ace_open(struct block_device *bdev, fmode_t mode) static int ace_open(struct block_device *bdev, fmode_t mode)
...@@ -922,8 +916,8 @@ static int ace_open(struct block_device *bdev, fmode_t mode) ...@@ -922,8 +916,8 @@ static int ace_open(struct block_device *bdev, fmode_t mode)
ace->users++; ace->users++;
spin_unlock_irqrestore(&ace->lock, flags); spin_unlock_irqrestore(&ace->lock, flags);
if (bdev_check_media_change(bdev)) if (bdev_check_media_change(bdev) && ace->media_change)
ace_revalidate_disk(bdev->bd_disk); ace_media_changed(ace);
mutex_unlock(&xsysace_mutex); mutex_unlock(&xsysace_mutex);
return 0; return 0;
...@@ -1080,7 +1074,7 @@ static int ace_setup(struct ace_device *ace) ...@@ -1080,7 +1074,7 @@ static int ace_setup(struct ace_device *ace)
(unsigned long long) ace->physaddr, ace->baseaddr, ace->irq); (unsigned long long) ace->physaddr, ace->baseaddr, ace->irq);
ace->media_change = 1; ace->media_change = 1;
ace_revalidate_disk(ace->gd); ace_media_changed(ace);
/* Make the sysace device 'live' */ /* Make the sysace device 'live' */
add_disk(ace->gd); add_disk(ace->gd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment