Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cafb0bfc authored by Tejun Heo's avatar Tejun Heo
Browse files

staging: Convert to bdops->check_events()



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: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Kay Sievers <kay.sievers@vrfy.org>
parent 3c0d2060
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -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;
	blkdev->gd->driverfs_dev = &(blkdev->device_ctx->device);
	sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum);
@@ -1352,10 +1354,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)
+7 −4
Original line number Diff line number Diff line
@@ -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