[03/15] mtd: nand: Add an helper to retrieve the number of pages per target
diff mbox series

Message ID 20190221091527.20497-4-miquel.raynal@bootlin.com
State New
Headers show
Series
  • mtd: rawnand: 5th batch of cleanups
Related show

Commit Message

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

Will be used by the raw NAND framework.

Signed-off-by: Boris Brezillon <bbrezillon@kernel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 include/linux/mtd/nand.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Schrempf Frieder Feb. 23, 2019, 1:04 p.m. UTC | #1
On 21.02.19 10:15, Miquel Raynal wrote:
> From: Boris Brezillon <bbrezillon@kernel.org>
> 
> Will be used by the raw NAND framework.
> 
> 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 | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
> index 12d75402472a..cebc38b6d6f5 100644
> --- a/include/linux/mtd/nand.h
> +++ b/include/linux/mtd/nand.h
> @@ -271,6 +271,20 @@ nanddev_pages_per_eraseblock(const struct nand_device *nand)
>   	return nand->memorg.pages_per_eraseblock;
>   }
>   
> +/**
> + * nanddev_pages_per_target() - Get the number of pages per target
> + * @nand: NAND device
> + *
> + * Return: the number of pages per target.
> + */
> +static inline unsigned int
> +nanddev_pages_per_target(const struct nand_device *nand)
> +{
> +	return nand->memorg.pages_per_eraseblock *
> +	       nand->memorg.eraseblocks_per_lun *
> +	       nand->memorg.luns_per_target;
> +}
> +
>   /**
>    * nanddev_per_page_oobsize() - Get NAND erase block size
>    * @nand: NAND device
>

Patch
diff mbox series

diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 12d75402472a..cebc38b6d6f5 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -271,6 +271,20 @@  nanddev_pages_per_eraseblock(const struct nand_device *nand)
 	return nand->memorg.pages_per_eraseblock;
 }
 
+/**
+ * nanddev_pages_per_target() - Get the number of pages per target
+ * @nand: NAND device
+ *
+ * Return: the number of pages per target.
+ */
+static inline unsigned int
+nanddev_pages_per_target(const struct nand_device *nand)
+{
+	return nand->memorg.pages_per_eraseblock *
+	       nand->memorg.eraseblocks_per_lun *
+	       nand->memorg.luns_per_target;
+}
+
 /**
  * nanddev_per_page_oobsize() - Get NAND erase block size
  * @nand: NAND device