aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/mtd/nand.h
diff options
context:
space:
mode:
authorBoris Brezillon <bbrezillon@kernel.org>2018-10-29 10:29:48 +0100
committerMiquel Raynal <miquel.raynal@bootlin.com>2019-04-08 10:21:09 +0200
commit7c4ecca103b3d70c50adc693c9f5d39d292e13e0 (patch)
treec2a12299a0ffd89fbf3ab1150c2525da8378d083 /include/linux/mtd/nand.h
parentmtd: nand: Add max_bad_eraseblocks_per_lun info to memorg (diff)
downloadwireguard-linux-7c4ecca103b3d70c50adc693c9f5d39d292e13e0.tar.xz
wireguard-linux-7c4ecca103b3d70c50adc693c9f5d39d292e13e0.zip
mtd: nand: Add a helper returning the number of eraseblocks per target
Some drivers in the raw NAND framework seems to need this helper, so let's just add it instead of open-coding the logic. Signed-off-by: Boris Brezillon <bbrezillon@kernel.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Diffstat (limited to 'include/linux/mtd/nand.h')
-rw-r--r--include/linux/mtd/nand.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index d32bb623d532..12d75402472a 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -295,6 +295,18 @@ nanddev_eraseblocks_per_lun(const struct nand_device *nand)
}
/**
+ * nanddev_eraseblocks_per_target() - Get the number of eraseblocks per target
+ * @nand: NAND device
+ *
+ * Return: the number of eraseblocks per target.
+ */
+static inline unsigned int
+nanddev_eraseblocks_per_target(const struct nand_device *nand)
+{
+ return nand->memorg.eraseblocks_per_lun * nand->memorg.luns_per_target;
+}
+
+/**
* nanddev_target_size() - Get the total size provided by a single target/die
* @nand: NAND device
*