[PATCH 7/8] mtd_blkdevs: simplify blktrans_getgeo
Christoph Hellwig
hch at lst.de
Mon Aug 23 00:33:58 PDT 2021
No need to grab a mtd_blktrans_dev given that ->open already holds one
and ->getgeo can only be called on an open disk.
Signed-off-by: Christoph Hellwig <hch at lst.de>
---
drivers/mtd/mtd_blkdevs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 6f226b7cbb5c..012c0966010a 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -257,7 +257,7 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode)
static int blktrans_getgeo(struct block_device *bdev, struct hd_geometry *geo)
{
- struct mtd_blktrans_dev *dev = blktrans_dev_get(bdev->bd_disk);
+ struct mtd_blktrans_dev *dev = bdev->bd_disk->private_data;
int ret = -ENXIO;
mutex_lock(&dev->lock);
@@ -268,7 +268,6 @@ static int blktrans_getgeo(struct block_device *bdev, struct hd_geometry *geo)
ret = dev->tr->getgeo ? dev->tr->getgeo(dev, geo) : -ENOTTY;
unlock:
mutex_unlock(&dev->lock);
- blktrans_dev_put(dev);
return ret;
}
--
2.30.2
More information about the linux-mtd
mailing list