diff options
author | Christoph Hellwig <hch@lst.de> | 2023-06-08 13:02:36 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-06-12 08:04:04 -0600 |
commit | d32e2bf83791727a84ad5d3e3d713e82f9adbe30 (patch) | |
tree | 6aaaf62734fcc70cbb04543bc161c56ab9e2f2b5 /drivers/block/zram | |
parent | 444aa2c58cb3b6cfe3b7cc7db6c294d73393a894 (diff) | |
download | linux-stable-d32e2bf83791727a84ad5d3e3d713e82f9adbe30.tar.gz linux-stable-d32e2bf83791727a84ad5d3e3d713e82f9adbe30.tar.bz2 linux-stable-d32e2bf83791727a84ad5d3e3d713e82f9adbe30.zip |
block: pass a gendisk to ->open
->open is only called on the whole device. Make that explicit by
passing a gendisk instead of the block_device.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Acked-by: Christian Brauner <brauner@kernel.org>
Acked-by: Jack Wang <jinpu.wang@ionos.com> [rnbd]
Link: https://lore.kernel.org/r/20230608110258.189493-9-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/zram')
-rw-r--r-- | drivers/block/zram/zram_drv.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 0bc779446c6f..f5644c606040 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -2097,19 +2097,16 @@ static ssize_t reset_store(struct device *dev, return len; } -static int zram_open(struct block_device *bdev, fmode_t mode) +static int zram_open(struct gendisk *disk, fmode_t mode) { - int ret = 0; - struct zram *zram; + struct zram *zram = disk->private_data; - WARN_ON(!mutex_is_locked(&bdev->bd_disk->open_mutex)); + WARN_ON(!mutex_is_locked(&disk->open_mutex)); - zram = bdev->bd_disk->private_data; /* zram was claimed to reset so open request fails */ if (zram->claim) - ret = -EBUSY; - - return ret; + return -EBUSY; + return 0; } static const struct block_device_operations zram_devops = { |