[PATCH v3 2/2] mtd: cfi: change cfi_flash_bank_size() return type
Nuno Sá
nuno.sa at analog.com
Wed Apr 26 16:16:56 CEST 2023
Move return type to phys_size_t instead of plain unsigned long.
Signed-off-by: Nuno Sá <nuno.sa at analog.com>
---
v2:
* new patch.
v3:
* also make sure cfi_flash_bank_size() declaration (in cfi_flash.h)
gets updated to phys_size_t.
drivers/mtd/cfi_flash.c | 10 +++++-----
include/mtd/cfi_flash.h | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 87a3daebdabe..9c030de3afef 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -117,9 +117,9 @@ phys_addr_t cfi_flash_bank_addr(int i)
return flash_info[i].base;
}
-unsigned long cfi_flash_bank_size(int i)
+phys_size_t cfi_flash_bank_size(int i)
{
- return (unsigned long)flash_info[i].addr_size;
+ return flash_info[i].addr_size;
}
#else
__weak phys_addr_t cfi_flash_bank_addr(int i)
@@ -127,10 +127,10 @@ __weak phys_addr_t cfi_flash_bank_addr(int i)
return ((phys_addr_t [])CFG_SYS_FLASH_BANKS_LIST)[i];
}
-__weak unsigned long cfi_flash_bank_size(int i)
+__weak phys_size_t cfi_flash_bank_size(int i)
{
#ifdef CFG_SYS_FLASH_BANKS_SIZES
- return ((unsigned long [])CFG_SYS_FLASH_BANKS_SIZES)[i];
+ return ((phys_size_t [])CFG_SYS_FLASH_BANKS_SIZES)[i];
#else
return 0;
#endif
@@ -2112,7 +2112,7 @@ ulong flash_get_size(phys_addr_t base, int banknum)
int erase_region_size;
int erase_region_count;
struct cfi_qry qry;
- unsigned long max_size;
+ phys_size_t max_size;
memset(&qry, 0, sizeof(qry));
diff --git a/include/mtd/cfi_flash.h b/include/mtd/cfi_flash.h
index 52cd1c4dbc4e..1900a4a2f6e4 100644
--- a/include/mtd/cfi_flash.h
+++ b/include/mtd/cfi_flash.h
@@ -175,7 +175,7 @@ extern int cfi_flash_num_flash_banks;
#endif
phys_addr_t cfi_flash_bank_addr(int i);
-unsigned long cfi_flash_bank_size(int i);
+phys_size_t cfi_flash_bank_size(int i);
#ifdef CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS
void flash_write8(u8 value, void *addr);
--
2.40.0
More information about the U-Boot
mailing list