From 98150e7e8c78b851a7710e18b156f279f8485cbe Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Tue, 4 Jan 2022 14:23:58 +0100 Subject: mtd: cfi: introduce CFI_FLASH_BANKS Replace CONFIG_SYS_MAX_FLASH_BANKS by CFI_FLASH_BANKS to prepare Kconfig migration and avoid to redefine CONFIG_SYS_MAX_FLASH_BANKS in cfi_flash.h. After this patch CONFIG_SYS_MAX_FLASH_BANKS should be never used in the cfi code: use CFI_MAX_FLASH_BANKS for struct size or CFI_FLASH_BANKS for number of CFI banks which can be dynamic. This patch modify all the files which include mtd/cfi_flash.h. Signed-off-by: Patrick Delaunay Reviewed-by: Stefan Roese --- common/flash.c | 2 +- common/update.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'common') diff --git a/common/flash.c b/common/flash.c index bb82385c1f..f939c2f9e9 100644 --- a/common/flash.c +++ b/common/flash.c @@ -91,7 +91,7 @@ addr2info(ulong addr) flash_info_t *info; int i; - for (i=0, info = &flash_info[0]; iflash_id != FLASH_UNKNOWN && addr >= info->start[0] && /* WARNING - The '- 1' is needed if the flash diff --git a/common/update.c b/common/update.c index f5c8684f1b..b9ad475d9d 100644 --- a/common/update.c +++ b/common/update.c @@ -112,12 +112,12 @@ static int update_flash_protect(int prot, ulong addr_first, ulong addr_last) if (prot == 0) { saved_prot_info = - calloc(CONFIG_SYS_MAX_FLASH_BANKS * CONFIG_SYS_MAX_FLASH_SECT, 1); + calloc(CFI_FLASH_BANKS * CONFIG_SYS_MAX_FLASH_SECT, 1); if (!saved_prot_info) return 1; } - for (bank = 0; bank < CONFIG_SYS_MAX_FLASH_BANKS; ++bank) { + for (bank = 0; bank < CFI_FLASH_BANKS; ++bank) { cnt = 0; info = &flash_info[bank]; -- cgit v1.2.3