summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-07-23 13:05:03 -0400
committerTom Rini <trini@konsulko.com>2022-08-04 16:18:47 -0400
commit17ead040d402c6e1fe26ac5acc4773146c8a0918 (patch)
tree9bfa97577dc86a0947a2d07b455dbd6b0638ed21 /cmd
parent1d3ecdac7ecd5d9b237067b0c96aa1e618c8621d (diff)
downloadu-boot-17ead040d402c6e1fe26ac5acc4773146c8a0918.tar.gz
u-boot-17ead040d402c6e1fe26ac5acc4773146c8a0918.tar.bz2
u-boot-17ead040d402c6e1fe26ac5acc4773146c8a0918.zip
Audit <flash.h> inclusion
A large number of files include <flash.h> as it used to be how various SPI flash related functions were found, or for other reasons entirely. In order to migrate some further CONFIG symbols to Kconfig we need to not include flash.h in cases where we don't have a NOR flash of some sort enabled. Furthermore, in cases where we are in common code and it doesn't make sense to try and further refactor the code itself in to new files we need to guard this inclusion. Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/bootm.c1
-rw-r--r--cmd/cramfs.c2
-rw-r--r--cmd/cros_ec.c1
-rw-r--r--cmd/flash.c1
-rw-r--r--cmd/jffs2.c5
-rw-r--r--cmd/load.c2
-rw-r--r--cmd/mem.c2
-rw-r--r--cmd/mvebu/bubt.c1
-rw-r--r--cmd/sf.c1
9 files changed, 7 insertions, 9 deletions
diff --git a/cmd/bootm.c b/cmd/bootm.c
index 1f70ee9e91..9fe8ce4a27 100644
--- a/cmd/bootm.c
+++ b/cmd/bootm.c
@@ -31,7 +31,6 @@ static int image_info(unsigned long addr);
#if defined(CONFIG_CMD_IMLS)
#include <flash.h>
#include <mtd/cfi_flash.h>
-extern flash_info_t flash_info[]; /* info for FLASH chips */
#endif
#if defined(CONFIG_CMD_IMLS) || defined(CONFIG_CMD_IMLS_NAND)
diff --git a/cmd/cramfs.c b/cmd/cramfs.c
index 2aad50c672..57e2afa247 100644
--- a/cmd/cramfs.c
+++ b/cmd/cramfs.c
@@ -33,11 +33,11 @@
# define DEBUGF(fmt, args...)
#endif
-#include <flash.h>
#ifndef CONFIG_MTD_NOR_FLASH
# define OFFSET_ADJUSTMENT 0
#else
+#include <flash.h>
# define OFFSET_ADJUSTMENT (flash_info[id.num].start[0])
#endif
diff --git a/cmd/cros_ec.c b/cmd/cros_ec.c
index ad49905d67..90921cecf6 100644
--- a/cmd/cros_ec.c
+++ b/cmd/cros_ec.c
@@ -10,7 +10,6 @@
#include <command.h>
#include <cros_ec.h>
#include <dm.h>
-#include <flash.h>
#include <log.h>
#include <dm/device-internal.h>
#include <dm/uclass-internal.h>
diff --git a/cmd/flash.c b/cmd/flash.c
index db4bb2529c..f4f85ecc7a 100644
--- a/cmd/flash.c
+++ b/cmd/flash.c
@@ -25,7 +25,6 @@ int find_dev_and_part(const char *id, struct mtd_device **dev,
#ifdef CONFIG_MTD_NOR_FLASH
#include <flash.h>
#include <mtd/cfi_flash.h>
-extern flash_info_t flash_info[]; /* info for FLASH chips */
/*
* The user interface starts numbering for Flash banks with 1
diff --git a/cmd/jffs2.c b/cmd/jffs2.c
index 914a7beeed..e00fcc2022 100644
--- a/cmd/jffs2.c
+++ b/cmd/jffs2.c
@@ -73,7 +73,9 @@
#include <common.h>
#include <command.h>
#include <env.h>
+#if defined(CONFIG_CMD_FLASH)
#include <flash.h>
+#endif
#include <image.h>
#include <malloc.h>
#include <jffs2/jffs2.h>
@@ -156,7 +158,6 @@ static int mtd_device_validate(u8 type, u8 num, u32 *size)
if (type == MTD_DEV_TYPE_NOR) {
#if defined(CONFIG_CMD_FLASH)
if (num < CONFIG_SYS_MAX_FLASH_BANKS) {
- extern flash_info_t flash_info[];
*size = flash_info[num].size;
return 0;
@@ -260,8 +261,6 @@ static inline u32 get_part_sector_size_nand(struct mtdids *id)
static inline u32 get_part_sector_size_nor(struct mtdids *id, struct part_info *part)
{
#if defined(CONFIG_CMD_FLASH)
- extern flash_info_t flash_info[];
-
u32 end_phys, start_phys, sector_size = 0, size = 0;
int i;
flash_info_t *flash;
diff --git a/cmd/load.c b/cmd/load.c
index 1224a7f85b..e44ae0d56b 100644
--- a/cmd/load.c
+++ b/cmd/load.c
@@ -14,7 +14,9 @@
#include <efi_loader.h>
#include <env.h>
#include <exports.h>
+#ifdef CONFIG_MTD_NOR_FLASH
#include <flash.h>
+#endif
#include <image.h>
#include <lmb.h>
#include <mapmem.h>
diff --git a/cmd/mem.c b/cmd/mem.c
index b7511382d3..1f4e3fcded 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -16,7 +16,9 @@
#include <cli.h>
#include <command.h>
#include <console.h>
+#ifdef CONFIG_MTD_NOR_FLASH
#include <flash.h>
+#endif
#include <hash.h>
#include <log.h>
#include <mapmem.h>
diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index ffa05bc201..2136af6416 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -8,7 +8,6 @@
#include <common.h>
#include <command.h>
#include <env.h>
-#include <flash.h>
#include <image.h>
#include <net.h>
#include <vsprintf.h>
diff --git a/cmd/sf.c b/cmd/sf.c
index cd50b38081..058635cb2f 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -9,7 +9,6 @@
#include <command.h>
#include <div64.h>
#include <dm.h>
-#include <flash.h>
#include <log.h>
#include <malloc.h>
#include <mapmem.h>