common: Move flash_perror() to flash.h
authorSimon Glass <sjg@chromium.org>
Sat, 28 Dec 2019 17:44:40 +0000 (10:44 -0700)
committerJagan Teki <jagan@amarulasolutions.com>
Fri, 24 Jan 2020 17:36:47 +0000 (23:06 +0530)
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 <sjg@chromium.org>
cmd/load.c
cmd/mem.c
common/flash.c
env/flash.c
include/common.h
include/flash.h
net/nfs.c

index 3bfc1b41ecececf359ec609b57270ad3c819caca..68ff3010b47f2e115a2cbb65970b8eec9c4f6f9c 100644 (file)
@@ -12,6 +12,7 @@
 #include <console.h>
 #include <cpu_func.h>
 #include <env.h>
+#include <flash.h>
 #include <s_record.h>
 #include <net.h>
 #include <exports.h>
@@ -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
index 4ec450b050248d14f6c77bfd08c0c8f818e12359..4de5ab01fdf68ec6014cb9f8cc7fa925f39aa4f2 100644 (file)
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -16,6 +16,7 @@
 #include <cli.h>
 #include <command.h>
 #include <console.h>
+#include <flash.h>
 #include <hash.h>
 #include <mapmem.h>
 #include <watchdog.h>
@@ -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);
index efe8f53de6644ce2735313cd8f9e74ca37ee7ce4..5f155aefd1d36e81cbee1e1bce6932e141cde278 100644 (file)
@@ -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:
index b487e6701ef82632372cbff55f307362112ceb09..e05f7ef74b9ba0de90c9e92f38ab83dd0b7e6bf9 100644 (file)
@@ -13,6 +13,7 @@
 #include <command.h>
 #include <env.h>
 #include <env_internal.h>
+#include <flash.h>
 #include <linux/stddef.h>
 #include <malloc.h>
 #include <search.h>
index c35af99f02acfa820f9adbc52a462490c21d7618..c3dcf6dbcc360ca02f26297293ac66ec6507cd82 100644 (file)
@@ -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);
 
index 807800b524e9abfafabfb132f7523a9a71cd76e3..2655c72087fbea46cf3cf2a8c7ac7ad67c98044c 100644 (file)
@@ -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():
  */
index 97e62f1dcebae1bbde78ab9f0291ce719ce1ec89..f4101eb17c3eee1d3ab660b6cc0ef514a23992c0 100644 (file)
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -28,6 +28,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <flash.h>
 #include <net.h>
 #include <malloc.h>
 #include <mapmem.h>