[PATCH 10/14] nand.h: Cleanup linux/mtd/rawnand.h usage

Tom Rini
2021-09-22T18:53:04Z

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
arch/arm/include/asm/ti-common/davinci_nand.h | 1 -
arch/arm/mach-imx/cmd_nandbcb.c | 1 +
board/cssi/MCR3000/nand.c | 1 +
board/freescale/m5329evb/nand.c | 1 +
board/freescale/m5373evb/nand.c | 1 +
board/socrates/nand.c | 1 +
board/xes/common/actl_nand.c | 1 +
cmd/nand.c | 1 +
drivers/mtd/nand/raw/am335x_spl_bch.c | 1 +
drivers/mtd/nand/raw/atmel_nand.c | 1 +
drivers/mtd/nand/raw/brcmnand/brcmnand.c | 1 +
drivers/mtd/nand/raw/cortina_nand.c | 1 +
drivers/mtd/nand/raw/davinci_nand.c | 1 +
drivers/mtd/nand/raw/fsl_elbc_spl.c | 1 +
drivers/mtd/nand/raw/fsl_upm.c | 1 +
drivers/mtd/nand/raw/fsmc_nand.c | 1 +
drivers/mtd/nand/raw/kb9202_nand.c | 1 +
drivers/mtd/nand/raw/kirkwood_nand.c | 1 +
drivers/mtd/nand/raw/kmeter1_nand.c | 1 +
drivers/mtd/nand/raw/lpc32xx_nand_mlc.c | 1 +
drivers/mtd/nand/raw/lpc32xx_nand_slc.c | 1 +
drivers/mtd/nand/raw/mxc_nand.c | 1 +
drivers/mtd/nand/raw/mxc_nand_spl.c | 1 +
drivers/mtd/nand/raw/mxs_nand_spl.c | 1 +
drivers/mtd/nand/raw/nand.c | 1 +
drivers/mtd/nand/raw/nand_plat.c | 1 +
drivers/mtd/nand/raw/nand_spl_simple.c | 1 +
drivers/mtd/nand/raw/nand_util.c | 1 +
drivers/mtd/nand/raw/octeontx_nand.c | 1 +
drivers/mtd/nand/raw/omap_gpmc.c | 1 +
drivers/mtd/nand/raw/rockchip_nfc.c | 1 +
drivers/mtd/nand/raw/stm32_fmc2_nand.c | 1 +
drivers/mtd/nand/raw/sunxi_nand_spl.c | 1 +
drivers/mtd/nand/raw/tegra_nand.c | 1 +
fs/yaffs2/yaffs_uboot_glue.c | 1 +
include/mxs_nand.h | 1 +
include/nand.h | 3 ++-
37 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/ti-common/davinci_nand.h b/arch/arm/include/asm/ti-common/davinci_nand.h
index 28842c3b1552..222dd705cd10 100644
--- a/arch/arm/include/asm/ti-common/davinci_nand.h
+++ b/arch/arm/include/asm/ti-common/davinci_nand.h
@@ -9,7 +9,6 @@
#ifndef _DAVINCI_NAND_H_
#define _DAVINCI_NAND_H_

-#include <linux/mtd/rawnand.h>
#include <asm/arch/hardware.h>

#define NAND_READ_START 0x00
diff --git a/arch/arm/mach-imx/cmd_nandbcb.c b/arch/arm/mach-imx/cmd_nandbcb.c
index cd5134459787..09622c13c980 100644
--- a/arch/arm/mach-imx/cmd_nandbcb.c
+++ b/arch/arm/mach-imx/cmd_nandbcb.c
@@ -23,6 +23,7 @@
#include <jffs2/jffs2.h>
#include <linux/bch.h>
#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>

#include <asm/arch/sys_proto.h>
#include <asm/mach-imx/imx-nandbcb.h>
diff --git a/board/cssi/MCR3000/nand.c b/board/cssi/MCR3000/nand.c
index 15a10bffadc1..11aca4ff7363 100644
--- a/board/cssi/MCR3000/nand.c
+++ b/board/cssi/MCR3000/nand.c
@@ -8,6 +8,7 @@
#include <config.h>
#include <common.h>
#include <nand.h>
+#include <linux/mtd/rawnand.h>
#include <asm/io.h>

#define BIT_CLE ((unsigned short)0x0800)
diff --git a/board/freescale/m5329evb/nand.c b/board/freescale/m5329evb/nand.c
index 58b8ee51d378..a10c365ec378 100644
--- a/board/freescale/m5329evb/nand.c
+++ b/board/freescale/m5329evb/nand.c
@@ -15,6 +15,7 @@
#if defined(CONFIG_CMD_NAND)
#include <nand.h>
#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>

#define SET_CLE 0x10
#define SET_ALE 0x08
diff --git a/board/freescale/m5373evb/nand.c b/board/freescale/m5373evb/nand.c
index 4c30d5100181..fdf3e0ac1b1b 100644
--- a/board/freescale/m5373evb/nand.c
+++ b/board/freescale/m5373evb/nand.c
@@ -15,6 +15,7 @@
#if defined(CONFIG_CMD_NAND)
#include <nand.h>
#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>

#define SET_CLE 0x10
#define SET_ALE 0x08
diff --git a/board/socrates/nand.c b/board/socrates/nand.c
index 07c493679bf0..9b7ffee83a41 100644
--- a/board/socrates/nand.c
+++ b/board/socrates/nand.c
@@ -9,6 +9,7 @@
#if defined(CONFIG_SYS_NAND_BASE)
#include <nand.h>
#include <linux/errno.h>
+#include <linux/mtd/rawnand.h>
#include <asm/io.h>

static int state;
diff --git a/board/xes/common/actl_nand.c b/board/xes/common/actl_nand.c
index 4e52838c9095..2d8a57576a6c 100644
--- a/board/xes/common/actl_nand.c
+++ b/board/xes/common/actl_nand.c
@@ -8,6 +8,7 @@

#include <common.h>
#include <nand.h>
+#include <linux/mtd/rawnand.h>
#include <asm/io.h>

/*
diff --git a/cmd/nand.c b/cmd/nand.c
index d381053c6ac6..df5a4b1db1a0 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -24,6 +24,7 @@
#include <image.h>
#include <asm/cache.h>
#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>
#include <command.h>
#include <console.h>
#include <env.h>
diff --git a/drivers/mtd/nand/raw/am335x_spl_bch.c b/drivers/mtd/nand/raw/am335x_spl_bch.c
index b6fc5f29c7a8..83590a63ccaf 100644
--- a/drivers/mtd/nand/raw/am335x_spl_bch.c
+++ b/drivers/mtd/nand/raw/am335x_spl_bch.c
@@ -14,6 +14,7 @@
#include <asm/io.h>
#include <linux/delay.h>
#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/rawnand.h>

static int nand_ecc_pos[] = CONFIG_SYS_NAND_ECCPOS;
static struct mtd_info *mtd;
diff --git a/drivers/mtd/nand/raw/atmel_nand.c b/drivers/mtd/nand/raw/atmel_nand.c
index 6541c3bea851..06bf5ac18ffc 100644
--- a/drivers/mtd/nand/raw/atmel_nand.c
+++ b/drivers/mtd/nand/raw/atmel_nand.c
@@ -24,6 +24,7 @@
#include <nand.h>
#include <watchdog.h>
#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/rawnand.h>

#ifdef CONFIG_ATMEL_NAND_HWECC

diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index 99a1c2e6e2e8..f8434ca88db0 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -26,6 +26,7 @@
#include <linux/completion.h>
#include <linux/errno.h>
#include <linux/log2.h>
+#include <linux/mtd/rawnand.h>
#include <asm/processor.h>
#include <dm.h>

diff --git a/drivers/mtd/nand/raw/cortina_nand.c b/drivers/mtd/nand/raw/cortina_nand.c
index 81fa8788a498..c5e97da5e05f 100644
--- a/drivers/mtd/nand/raw/cortina_nand.c
+++ b/drivers/mtd/nand/raw/cortina_nand.c
@@ -16,6 +16,7 @@
#include <linux/delay.h>
#include <linux/iopoll.h>
#include <linux/errno.h>
+#include <linux/mtd/rawnand.h>
#include <asm/gpio.h>
#include <fdtdec.h>
#include <bouncebuf.h>
diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
index 9ad3a57690e5..0e0b0583db35 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -30,6 +30,7 @@

#include <common.h>
#include <log.h>
+#include <linux/mtd/rawnand.h>
#include <asm/io.h>
#include <nand.h>
#include <dm/uclass.h>
diff --git a/drivers/mtd/nand/raw/fsl_elbc_spl.c b/drivers/mtd/nand/raw/fsl_elbc_spl.c
index a62ab69ee1e0..e55b40f8f13c 100644
--- a/drivers/mtd/nand/raw/fsl_elbc_spl.c
+++ b/drivers/mtd/nand/raw/fsl_elbc_spl.c
@@ -11,6 +11,7 @@

#include <common.h>
#include <cpu_func.h>
+#include <linux/mtd/rawnand.h>
#include <asm/io.h>
#include <asm/fsl_lbc.h>
#include <nand.h>
diff --git a/drivers/mtd/nand/raw/fsl_upm.c b/drivers/mtd/nand/raw/fsl_upm.c
index 6c86a7e76712..91cc13395372 100644
--- a/drivers/mtd/nand/raw/fsl_upm.c
+++ b/drivers/mtd/nand/raw/fsl_upm.c
@@ -13,6 +13,7 @@
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>
#include <linux/mtd/fsl_upm.h>
#include <nand.h>

diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c
index 1c24710b2db6..5d197ce0c51c 100644
--- a/drivers/mtd/nand/raw/fsmc_nand.c
+++ b/drivers/mtd/nand/raw/fsmc_nand.c
@@ -13,6 +13,7 @@
#include <linux/bitops.h>
#include <linux/err.h>
#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/rawnand.h>
#include <linux/mtd/fsmc_nand.h>
#include <asm/arch/hardware.h>

diff --git a/drivers/mtd/nand/raw/kb9202_nand.c b/drivers/mtd/nand/raw/kb9202_nand.c
index 0f68f1cd867c..9d26532c7807 100644
--- a/drivers/mtd/nand/raw/kb9202_nand.c
+++ b/drivers/mtd/nand/raw/kb9202_nand.c
@@ -8,6 +8,7 @@
*/

#include <common.h>
+#include <linux/mtd/rawnand.h>
#include <asm/io.h>
#include <asm/arch/AT91RM9200.h>
#include <asm/arch/hardware.h>
diff --git a/drivers/mtd/nand/raw/kirkwood_nand.c b/drivers/mtd/nand/raw/kirkwood_nand.c
index 0757fa840b88..621d2d232c88 100644
--- a/drivers/mtd/nand/raw/kirkwood_nand.c
+++ b/drivers/mtd/nand/raw/kirkwood_nand.c
@@ -6,6 +6,7 @@
*/

#include <common.h>
+#include <linux/mtd/rawnand.h>
#include <asm/io.h>
#include <asm/arch/soc.h>
#include <asm/arch/mpp.h>
diff --git a/drivers/mtd/nand/raw/kmeter1_nand.c b/drivers/mtd/nand/raw/kmeter1_nand.c
index cf33f2863e1b..b838164bf2e4 100644
--- a/drivers/mtd/nand/raw/kmeter1_nand.c
+++ b/drivers/mtd/nand/raw/kmeter1_nand.c
@@ -8,6 +8,7 @@
#include <nand.h>
#include <asm/io.h>
#include <linux/delay.h>
+#include <linux/mtd/rawnand.h>

#define CONFIG_NAND_MODE_REG (void *)(CONFIG_SYS_NAND_BASE + 0x20000)
#define CONFIG_NAND_DATA_REG (void *)(CONFIG_SYS_NAND_BASE + 0x30000)
diff --git a/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c b/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c
index b3232ed59d53..5bc5301d6349 100644
--- a/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c
+++ b/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c
@@ -23,6 +23,7 @@
#include <nand.h>
#include <linux/delay.h>
#include <linux/errno.h>
+#include <linux/mtd/rawnand.h>
#include <asm/io.h>
#include <nand.h>
#include <asm/arch/clk.h>
diff --git a/drivers/mtd/nand/raw/lpc32xx_nand_slc.c b/drivers/mtd/nand/raw/lpc32xx_nand_slc.c
index 9cca3c55cc09..3d6cb1dc6350 100644
--- a/drivers/mtd/nand/raw/lpc32xx_nand_slc.c
+++ b/drivers/mtd/nand/raw/lpc32xx_nand_slc.c
@@ -15,6 +15,7 @@
#include <nand.h>
#include <linux/bug.h>
#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/rawnand.h>
#include <linux/errno.h>
#include <asm/io.h>
#include <asm/arch/config.h>
diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c
index 59cef205754b..6640dc67bd8c 100644
--- a/drivers/mtd/nand/raw/mxc_nand.c
+++ b/drivers/mtd/nand/raw/mxc_nand.c
@@ -10,6 +10,7 @@
#include <nand.h>
#include <linux/delay.h>
#include <linux/err.h>
+#include <linux/mtd/rawnand.h>
#include <asm/io.h>
#if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX35) || \
defined(CONFIG_MX51) || defined(CONFIG_MX53)
diff --git a/drivers/mtd/nand/raw/mxc_nand_spl.c b/drivers/mtd/nand/raw/mxc_nand_spl.c
index 2f054b60ed72..0fea307ea461 100644
--- a/drivers/mtd/nand/raw/mxc_nand_spl.c
+++ b/drivers/mtd/nand/raw/mxc_nand_spl.c
@@ -13,6 +13,7 @@
#include <common.h>
#include <hang.h>
#include <nand.h>
+#include <linux/mtd/rawnand.h>
#include <asm/arch/imx-regs.h>
#include <asm/io.h>
#include "mxc_nand.h"
diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
index 17f46ae5e919..b85cb9f4d30f 100644
--- a/drivers/mtd/nand/raw/mxs_nand_spl.c
+++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
@@ -13,6 +13,7 @@
#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/err.h>
+#include <linux/mtd/rawnand.h>

static struct mtd_info *mtd;
static struct nand_chip nand_chip;
diff --git a/drivers/mtd/nand/raw/nand.c b/drivers/mtd/nand/raw/nand.c
index 026419e4e646..59ad1392b0e6 100644
--- a/drivers/mtd/nand/raw/nand.c
+++ b/drivers/mtd/nand/raw/nand.c
@@ -9,6 +9,7 @@
#include <nand.h>
#include <errno.h>
#include <linux/mtd/concat.h>
+#include <linux/mtd/rawnand.h>

#ifndef CONFIG_SYS_NAND_BASE_LIST
#define CONFIG_SYS_NAND_BASE_LIST { CONFIG_SYS_NAND_BASE }
diff --git a/drivers/mtd/nand/raw/nand_plat.c b/drivers/mtd/nand/raw/nand_plat.c
index 335c3e34714c..81e7aa218d54 100644
--- a/drivers/mtd/nand/raw/nand_plat.c
+++ b/drivers/mtd/nand/raw/nand_plat.c
@@ -15,6 +15,7 @@
*/

#include <common.h>
+#include <linux/mtd/rawnand.h>
#include <asm/io.h>
#ifdef NAND_PLAT_GPIO_DEV_READY
# include <asm/gpio.h>
diff --git a/drivers/mtd/nand/raw/nand_spl_simple.c b/drivers/mtd/nand/raw/nand_spl_simple.c
index ede7dbf15b90..727861c8f7ee 100644
--- a/drivers/mtd/nand/raw/nand_spl_simple.c
+++ b/drivers/mtd/nand/raw/nand_spl_simple.c
@@ -8,6 +8,7 @@
#include <nand.h>
#include <asm/io.h>
#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/rawnand.h>

static int nand_ecc_pos[] = CONFIG_SYS_NAND_ECCPOS;
static struct mtd_info *mtd;
diff --git a/drivers/mtd/nand/raw/nand_util.c b/drivers/mtd/nand/raw/nand_util.c
index 00c3c6c41226..ea246c486d3e 100644
--- a/drivers/mtd/nand/raw/nand_util.c
+++ b/drivers/mtd/nand/raw/nand_util.c
@@ -30,6 +30,7 @@

#include <linux/errno.h>
#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>
#include <nand.h>
#include <jffs2/jffs2.h>

diff --git a/drivers/mtd/nand/raw/octeontx_nand.c b/drivers/mtd/nand/raw/octeontx_nand.c
index e0ccc7b0d90d..75476c098fe9 100644
--- a/drivers/mtd/nand/raw/octeontx_nand.c
+++ b/drivers/mtd/nand/raw/octeontx_nand.c
@@ -23,6 +23,7 @@
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand_bch.h>
#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/rawnand.h>
#include <asm/global_data.h>
#include <asm/io.h>
#include <asm/types.h>
diff --git a/drivers/mtd/nand/raw/omap_gpmc.c b/drivers/mtd/nand/raw/omap_gpmc.c
index 97fd5690f518..530574898ce6 100644
--- a/drivers/mtd/nand/raw/omap_gpmc.c
+++ b/drivers/mtd/nand/raw/omap_gpmc.c
@@ -11,6 +11,7 @@
#include <asm/arch/mem.h>
#include <linux/mtd/omap_gpmc.h>
#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/rawnand.h>
#include <linux/bch.h>
#include <linux/compiler.h>
#include <nand.h>
diff --git a/drivers/mtd/nand/raw/rockchip_nfc.c b/drivers/mtd/nand/raw/rockchip_nfc.c
index 21776f3b14ce..d016d2557531 100644
--- a/drivers/mtd/nand/raw/rockchip_nfc.c
+++ b/drivers/mtd/nand/raw/rockchip_nfc.c
@@ -21,6 +21,7 @@
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
+#include <linux/mtd/rawnand.h>
#include <memalign.h>
#include <nand.h>

diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
index fd81a9500b8b..0e59c9ef5644 100644
--- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c
+++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
@@ -19,6 +19,7 @@
#include <linux/err.h>
#include <linux/iopoll.h>
#include <linux/ioport.h>
+#include <linux/mtd/rawnand.h>

/* Bad block marker length */
#define FMC2_BBM_LEN 2
diff --git a/drivers/mtd/nand/raw/sunxi_nand_spl.c b/drivers/mtd/nand/raw/sunxi_nand_spl.c
index 85d8013b1a6b..a29a76c58d3a 100644
--- a/drivers/mtd/nand/raw/sunxi_nand_spl.c
+++ b/drivers/mtd/nand/raw/sunxi_nand_spl.c
@@ -12,6 +12,7 @@
#include <linux/bitops.h>
#include <linux/ctype.h>
#include <linux/delay.h>
+#include <linux/mtd/rawnand.h>

/* registers */
#define NFC_CTL 0x00000000
diff --git a/drivers/mtd/nand/raw/tegra_nand.c b/drivers/mtd/nand/raw/tegra_nand.c
index 6310253efa6a..8e70c8e73b63 100644
--- a/drivers/mtd/nand/raw/tegra_nand.c
+++ b/drivers/mtd/nand/raw/tegra_nand.c
@@ -19,6 +19,7 @@
#include <linux/bug.h>
#include <linux/delay.h>
#include <linux/errno.h>
+#include <linux/mtd/rawnand.h>
#include <asm/gpio.h>
#include <fdtdec.h>
#include <bouncebuf.h>
diff --git a/fs/yaffs2/yaffs_uboot_glue.c b/fs/yaffs2/yaffs_uboot_glue.c
index 7a15a02974d0..ec8d028316a0 100644
--- a/fs/yaffs2/yaffs_uboot_glue.c
+++ b/fs/yaffs2/yaffs_uboot_glue.c
@@ -35,6 +35,7 @@
#else
#include "malloc.h"
#endif
+#include <linux/mtd/rawnand.h>

unsigned yaffs_trace_mask = 0x0; /* Disable logging */
static int yaffs_errno;
diff --git a/include/mxs_nand.h b/include/mxs_nand.h
index c0cefaca90b6..66c909318d1f 100644
--- a/include/mxs_nand.h
+++ b/include/mxs_nand.h
@@ -8,6 +8,7 @@
*/

#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>
#include <asm/cache.h>
#include <nand.h>
#include <asm/mach-imx/dma.h>
diff --git a/include/nand.h b/include/nand.h
index 80dd6469bc05..75c605193ab1 100644
--- a/include/nand.h
+++ b/include/nand.h
@@ -31,7 +31,6 @@ unsigned long nand_size(void);

#include <linux/compat.h>
#include <linux/mtd/mtd.h>
-#include <linux/mtd/rawnand.h>

int nand_mtd_to_devnum(struct mtd_info *mtd);

@@ -39,6 +38,8 @@ int nand_mtd_to_devnum(struct mtd_info *mtd);
void board_nand_init(void);
int nand_register(int devnum, struct mtd_info *mtd);
#else
+struct nand_chip;
+
extern int board_nand_init(struct nand_chip *nand);
#endif

--
2.17.1