diff mbox

[U-Boot,v2,06/15] cmd: jffs2: use get_nand_dev_by_index()

Message ID 20170131213717.30745-7-grygorii.strashko@ti.com
State Deferred
Delegated to: Tom Rini
Headers show

Commit Message

Grygorii Strashko Jan. 31, 2017, 9:37 p.m. UTC
As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 cmd/jffs2.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Tom Rini Feb. 6, 2017, 1:57 a.m. UTC | #1
On Tue, Jan 31, 2017 at 03:37:08PM -0600, Grygorii Strashko wrote:

> As part of preparation for nand DM conversion the new API has been
> introduced to remove direct access to nand_info array. So, use it here
> instead of accessing to nand_info array directly.
> 
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
Simon Glass Feb. 6, 2017, 3:34 p.m. UTC | #2
On 5 February 2017 at 17:57, Tom Rini <trini@konsulko.com> wrote:
> On Tue, Jan 31, 2017 at 03:37:08PM -0600, Grygorii Strashko wrote:
>
>> As part of preparation for nand DM conversion the new API has been
>> introduced to remove direct access to nand_info array. So, use it here
>> instead of accessing to nand_info array directly.
>>
>> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox

Patch

diff --git a/cmd/jffs2.c b/cmd/jffs2.c
index f00d53a..162c8fe 100644
--- a/cmd/jffs2.c
+++ b/cmd/jffs2.c
@@ -166,8 +166,9 @@  static int mtd_device_validate(u8 type, u8 num, u32 *size)
 #endif
 	} else if (type == MTD_DEV_TYPE_NAND) {
 #if defined(CONFIG_JFFS2_NAND) && defined(CONFIG_CMD_NAND)
-		if (num < CONFIG_SYS_MAX_NAND_DEVICE) {
-			*size = nand_info[num]->size;
+		struct mtd_info *mtd = get_nand_dev_by_index(num);
+		if (mtd) {
+			*size = mtd->size;
 			return 0;
 		}
 
@@ -244,7 +245,7 @@  static inline u32 get_part_sector_size_nand(struct mtdids *id)
 #if defined(CONFIG_JFFS2_NAND) && defined(CONFIG_CMD_NAND)
 	struct mtd_info *mtd;
 
-	mtd = nand_info[id->num];
+	mtd = get_nand_dev_by_index(id->num);
 
 	return mtd->erasesize;
 #else