Thread (21 messages) 21 messages, 4 authors, 2021-08-20

Re: [PATCH v5 2/5] mmc: block: Support alternative_gpt_sector() operation

From: Dmitry Osipenko <digetx@gmail.com>
Date: 2021-08-18 05:40:22
Also in: linux-efi, linux-tegra

18.08.2021 08:28, Christoph Hellwig пишет:
On Wed, Aug 18, 2021 at 03:55:44AM +0300, Dmitry Osipenko wrote:
quoted
+static int mmc_blk_alternative_gpt_sector(struct block_device *bdev,
+					  sector_t *sector)
+{
+	struct mmc_card *card = mmc_bdev_to_card(bdev);
+
+	if (!card)
+		return -ENODEV;
+
+	if (!card->host->ops->alternative_gpt_sector)
+		return -EOPNOTSUPP;
+
+	return card->host->ops->alternative_gpt_sector(card, sector);
+}
+
quoted
+static struct mmc_card *mmc_bdev_to_card(struct block_device *bdev)
+{
+	struct mmc_blk_data *md;
+
+	if (bdev->bd_disk->fops != &mmc_bdops)
+		return NULL;
No need for this check bow that it is only called through mmc_bdops.
Alright
quoted
+
+	md = mmc_blk_get(bdev->bd_disk);
+	if (!md)
+		return NULL;
+
+	return md->queue.card;
+}
This reference seems to never be dropped anywhere.
Indeed, I missed that it bumps the refcnt.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help