mtd: nand: Fix nanddev_neraseblocks()
Subsystems (3)
PATCH 1/1 mtd: nand: Fix nanddev_neraseblocks()
nanddev_neraseblocks() currently returns the number pages per LUN instead of the total number of eraseblocks.
Fixes 9c3736a3de21 ("mtd: nand: Add core infrastructure to deal with NAND devices")
Cc <[email protected]>
Signed-off-by Boris Brezillon <[email protected]>
--- include/linux/mtd/nand.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
include/linux/mtd/nand.h +2 -3
@@ -324,9 +324,8 @@ static inline unsigned int nanddev_ntargets(const struct nand_device *nand)*/ static inline unsigned int nanddev_neraseblocks (const struct nand_device *nand) { -return (u64 )nand->memorg.luns_per_target * - nand->memorg.eraseblocks_per_lun * - nand->memorg.pages_per_eraseblock; +return nand->memorg.ntargets * nand->memorg.luns_per_target * + nand->memorg.eraseblocks_per_lun; }/**
Signature · 1 line
2.17.1
Hi Boris,
Boris Brezillon <[email protected]> wrote on Sun, 28 Oct 2018 12:29:55 +0100:
Quoted 16 lines
nanddev_neraseblocks()currently returns the number pages per LUN instead of the total number of eraseblocks.Fixes 9c3736a3de21 ("mtd: nand: Add core infrastructure to deal with NAND devices")Cc <[email protected]>Signed-off-by Boris Brezillon <[email protected]>--- include/linux/mtd/nand.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)include/linux/mtd/nand.h +0
-0@@ -324,9 +324,8 @@ static inline unsigned int nanddev_ntargets(const struct nand_device *nand)*/
include/linux/mtd/nand.h static inline unsigned int nanddev_ntargets(const struct nand_device *nand) · line 331
Quoted 10 lines
include/linux/mtd/nand.h +2
-3static inline unsigned int nanddev_neraseblocks (const struct nand_device *nand) { -return (u64 )nand->memorg.luns_per_target * - nand->memorg.eraseblocks_per_lun * - nand->memorg.pages_per_eraseblock; +return nand->memorg.ntargets * nand->memorg.luns_per_target * + nand->memorg.eraseblocks_per_lun; }/**
Reviewed-by Miquel Raynal <[email protected]>
Thanks,
Miquèl
Boris Brezillon
AppliedQuoted 6 lines · On Sun, 28 Oct 2018 12:29:55 +0100 Boris Brezillon…
nanddev_neraseblocks()currently returns the number pages per LUN instead of the total number of eraseblocks.Fixes 9c3736a3de21 ("mtd: nand: Add core infrastructure to deal with NAND devices")Cc <[email protected]>Signed-off-by Boris Brezillon <[email protected]>
Queued to the fixes branch.
Quoted 20 lines
--- include/linux/mtd/nand.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)include/linux/mtd/nand.h +2
-3@@ -324,9 +324,8 @@ static inline unsigned int nanddev_ntargets(const struct nand_device *nand)*/ static inline unsigned int nanddev_neraseblocks (const struct nand_device *nand) { -return (u64 )nand->memorg.luns_per_target * - nand->memorg.eraseblocks_per_lun * - nand->memorg.pages_per_eraseblock; +return nand->memorg.ntargets * nand->memorg.luns_per_target * + nand->memorg.eraseblocks_per_lun; }/**