From 0ee48252b456f310225fa8dd0f3a9921cfcf3399 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 28 Dec 2019 10:44:40 -0700 Subject: [PATCH] common: Move flash_perror() to flash.h This function belongs more in flash.h than common.h so move it. Also remove the space before the bracket in some calls. Signed-off-by: Simon Glass --- cmd/load.c | 3 ++- cmd/mem.c | 3 ++- common/flash.c | 2 +- env/flash.c | 1 + include/common.h | 3 --- include/flash.h | 7 +++++++ net/nfs.c | 1 + 7 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cmd/load.c b/cmd/load.c index 3bfc1b41ec..68ff3010b4 100644 --- a/cmd/load.c +++ b/cmd/load.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -980,7 +981,7 @@ static ulong load_serial_ymodem(ulong offset, int mode) rc = flash_write((char *) ymodemBuf, store_addr, res); if (rc != 0) { - flash_perror (rc); + flash_perror(rc); return (~0); } } else diff --git a/cmd/mem.c b/cmd/mem.c index 4ec450b050..4de5ab01fd 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -339,7 +340,7 @@ static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) rc = flash_write((char *)src, (ulong)dst, count * size); if (rc != 0) { - flash_perror (rc); + flash_perror(rc); unmap_sysmem(src); unmap_sysmem(dst); return (1); diff --git a/common/flash.c b/common/flash.c index efe8f53de6..5f155aefd1 100644 --- a/common/flash.c +++ b/common/flash.c @@ -179,7 +179,7 @@ flash_write (char *src, ulong addr, ulong cnt) /*----------------------------------------------------------------------- */ -void flash_perror (int err) +void flash_perror(int err) { switch (err) { case ERR_OK: diff --git a/env/flash.c b/env/flash.c index b487e6701e..e05f7ef74b 100644 --- a/env/flash.c +++ b/env/flash.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/include/common.h b/include/common.h index c35af99f02..c3dcf6dbcc 100644 --- a/include/common.h +++ b/include/common.h @@ -78,9 +78,6 @@ extern u8 __dtb_dt_spl_begin[]; /* embedded device tree blob for SPL/TPL */ */ int arch_fixup_fdt(void *blob); -/* common/flash.c */ -void flash_perror (int); - /* common/cmd_source.c */ int source (ulong addr, const char *fit_uname); diff --git a/include/flash.h b/include/flash.h index 807800b524..2655c72087 100644 --- a/include/flash.h +++ b/include/flash.h @@ -117,6 +117,13 @@ extern int jedec_flash_match(flash_info_t *info, ulong base); #define CFI_CMDSET_AMD_LEGACY 0xFFF0 #endif +/** + * flash_perror() - Print a flash error + * + * @err: Error number of message to print (ERR_... as below) + */ +void flash_perror(int err); + /*----------------------------------------------------------------------- * return codes from flash_write(): */ diff --git a/net/nfs.c b/net/nfs.c index 97e62f1dce..f4101eb17c 100644 --- a/net/nfs.c +++ b/net/nfs.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include -- 2.25.1