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>
This commit is contained in:
Tom Rini
2022-07-23 13:05:03 -04:00
parent 1d3ecdac7e
commit 17ead040d4
36 changed files with 24 additions and 45 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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>

View File

@@ -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

View File

@@ -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;

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>