diff mbox series

[02/15] mtd: nand: Add an helper returning the number of eraseblocks per target

Message ID 20190221091527.20497-3-miquel.raynal@bootlin.com (mailing list archive)
State New, archived
Headers show
Series mtd: rawnand: 5th batch of cleanups | expand

Commit Message

Miquel Raynal Feb. 21, 2019, 9:15 a.m. UTC
From: Boris Brezillon <bbrezillon@kernel.org>

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>
---
 include/linux/mtd/nand.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Frieder Schrempf Feb. 23, 2019, 1:04 p.m. UTC | #1
On 21.02.19 10:15, Miquel Raynal wrote:
> From: Boris Brezillon <bbrezillon@kernel.org>
> 
> 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>

> ---
>   include/linux/mtd/nand.h | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> 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
> @@ -294,6 +294,18 @@ nanddev_eraseblocks_per_lun(const struct nand_device *nand)
>   	return nand->memorg.eraseblocks_per_lun;
>   }
>   
> +/**
> + * 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
>
diff mbox series

Patch

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
@@ -294,6 +294,18 @@  nanddev_eraseblocks_per_lun(const struct nand_device *nand)
 	return nand->memorg.eraseblocks_per_lun;
 }
 
+/**
+ * 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