[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200323163431.7678-7-digetx@gmail.com>
Date: Mon, 23 Mar 2020 19:34:27 +0300
From: Dmitry Osipenko <digetx@...il.com>
To: Jens Axboe <axboe@...nel.dk>,
Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>,
Michał Mirosław <mirq-linux@...e.qmqm.pl>,
David Heidelberg <david@...t.cz>,
Peter Geis <pgwipeout@...il.com>,
Stephen Warren <swarren@...dotorg.org>,
Nicolas Chauvet <kwizart@...il.com>,
Ulf Hansson <ulf.hansson@...aro.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Billy Laws <blaws05@...il.com>
Cc: linux-tegra@...r.kernel.org, linux-block@...r.kernel.org,
Andrey Danin <danindrey@...l.ru>,
Gilles Grandou <gilles@...ndou.net>,
Ryan Grachek <ryan@...ted.us>, linux-mmc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v3 06/10] mmc: block: Add mmc_bdev_to_area_type() helper
NVIDIA Tegra Partition Table parser needs to know eMMC partition type
in order to validate and parse partition table properly. This patch adds
new mmc_bdev_to_area_type() helper which takes block device for the input
and returns a corresponding MMC card partition type.
This allows tegra-partition parser to distinguish boot eMMC partition from
the main eMMC partition.
Signed-off-by: Dmitry Osipenko <digetx@...il.com>
---
drivers/mmc/core/block.c | 16 ++++++++++++++++
include/linux/mmc/blkdev.h | 1 +
2 files changed, 17 insertions(+)
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 2cee57c7388d..ec69b613ee92 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -337,6 +337,22 @@ int mmc_bdev_to_part_type(struct block_device *bdev)
return md->part_type;
}
+int mmc_bdev_to_area_type(struct block_device *bdev)
+{
+ struct mmc_blk_data *md;
+ struct mmc_card *card;
+
+ card = mmc_bdev_to_card(bdev);
+ if (!card)
+ return -EINVAL;
+
+ md = mmc_blk_get(bdev->bd_disk);
+ if (!md)
+ return -EINVAL;
+
+ return md->area_type;
+}
+
static int mmc_blk_open(struct block_device *bdev, fmode_t mode)
{
struct mmc_blk_data *md = mmc_blk_get(bdev->bd_disk);
diff --git a/include/linux/mmc/blkdev.h b/include/linux/mmc/blkdev.h
index 24e73ac02b4b..5fa5ef35ac25 100644
--- a/include/linux/mmc/blkdev.h
+++ b/include/linux/mmc/blkdev.h
@@ -10,5 +10,6 @@ struct mmc_card;
struct mmc_card *mmc_bdev_to_card(struct block_device *bdev);
int mmc_bdev_to_part_type(struct block_device *bdev);
+int mmc_bdev_to_area_type(struct block_device *bdev);
#endif /* LINUX_MMC_BLOCK_DEVICE_H */
--
2.25.1
Powered by blists - more mailing lists