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 <sjg@chromium.org>
diff --git a/cmd/load.c b/cmd/load.c
index 3bfc1b4..68ff301 100644
--- a/cmd/load.c
+++ b/cmd/load.c
@@ -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 @@
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 4ec450b..4de5ab0 100644
--- 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 @@
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 efe8f53..5f155ae 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -179,7 +179,7 @@
/*-----------------------------------------------------------------------
*/
-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 b487e67..e05f7ef 100644
--- a/env/flash.c
+++ b/env/flash.c
@@ -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>
diff --git a/include/common.h b/include/common.h
index c35af99..c3dcf6d 100644
--- a/include/common.h
+++ b/include/common.h
@@ -78,9 +78,6 @@
*/
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 807800b..2655c72 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -117,6 +117,13 @@
#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 97e62f1..f4101eb 100644
--- 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>