treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 1283f9e..752b5b2 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -227,7 +227,7 @@
 	/* Nothing to do! */
 }
 
-__weak struct image_header *spl_get_load_buffer(ssize_t offset, size_t size)
+__weak struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size)
 {
 	return map_sysmem(CONFIG_SYS_TEXT_BASE + offset, 0);
 }
@@ -258,7 +258,7 @@
 #if CONFIG_IS_ENABLED(LOAD_FIT_FULL)
 /* Parse and load full fitImage in SPL */
 static int spl_load_fit_image(struct spl_image_info *spl_image,
-			      const struct image_header *header)
+			      const struct legacy_img_hdr *header)
 {
 	struct bootm_headers images;
 	const char *fit_uname_config = NULL;
@@ -359,7 +359,7 @@
 }
 
 __weak int spl_parse_legacy_header(struct spl_image_info *spl_image,
-				   const struct image_header *header)
+				   const struct legacy_img_hdr *header)
 {
 	/* LEGACY image not supported */
 	debug("Legacy boot image support not enabled, proceeding to other boot methods\n");
@@ -368,7 +368,7 @@
 
 int spl_parse_image_header(struct spl_image_info *spl_image,
 			   const struct spl_boot_device *bootdev,
-			   const struct image_header *header)
+			   const struct legacy_img_hdr *header)
 {
 #if CONFIG_IS_ENABLED(LOAD_FIT_FULL)
 	int ret = spl_load_fit_image(spl_image, header);
diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c
index ebd914c..f117c63 100644
--- a/common/spl/spl_ext.c
+++ b/common/spl/spl_ext.c
@@ -15,7 +15,7 @@
 		       const char *filename)
 {
 	s32 err;
-	struct image_header *header;
+	struct legacy_img_hdr *header;
 	loff_t filelen, actlen;
 	struct disk_partition part_info = {};
 
@@ -41,7 +41,7 @@
 		puts("spl: ext4fs_open failed\n");
 		goto end;
 	}
-	err = ext4fs_read((char *)header, 0, sizeof(struct image_header), &actlen);
+	err = ext4fs_read((char *)header, 0, sizeof(struct legacy_img_hdr), &actlen);
 	if (err < 0) {
 		puts("spl: ext4fs_read failed\n");
 		goto end;
diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
index 5b27054..f8a5b80 100644
--- a/common/spl/spl_fat.c
+++ b/common/spl/spl_fat.c
@@ -60,7 +60,7 @@
 		       const char *filename)
 {
 	int err;
-	struct image_header *header;
+	struct legacy_img_hdr *header;
 
 	err = spl_register_fat_device(block_dev, partition);
 	if (err)
@@ -68,7 +68,7 @@
 
 	header = spl_get_load_buffer(-sizeof(*header), sizeof(*header));
 
-	err = file_fat_read(filename, header, sizeof(struct image_header));
+	err = file_fat_read(filename, header, sizeof(struct legacy_img_hdr));
 	if (err <= 0)
 		goto end;
 
@@ -78,7 +78,7 @@
 		if (err <= 0)
 			goto end;
 		err = spl_parse_image_header(spl_image, bootdev,
-				(struct image_header *)CONFIG_SYS_LOAD_ADDR);
+				(struct legacy_img_hdr *)CONFIG_SYS_LOAD_ADDR);
 		if (err == -EAGAIN)
 			return err;
 		if (err == 0)
diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c
index ae8731c..b3624df 100644
--- a/common/spl/spl_legacy.c
+++ b/common/spl/spl_legacy.c
@@ -16,9 +16,9 @@
 #define LZMA_LEN	(1 << 20)
 
 int spl_parse_legacy_header(struct spl_image_info *spl_image,
-			    const struct image_header *header)
+			    const struct legacy_img_hdr *header)
 {
-	u32 header_size = sizeof(struct image_header);
+	u32 header_size = sizeof(struct legacy_img_hdr);
 
 	/* check uImage header CRC */
 	if (IS_ENABLED(CONFIG_SPL_LEGACY_IMAGE_CRC_CHECK) &&
@@ -67,7 +67,7 @@
  * following switch/case statement in spl_load_legacy_img() away due to
  * Dead Code Elimination.
  */
-static inline int spl_image_get_comp(const struct image_header *hdr)
+static inline int spl_image_get_comp(const struct legacy_img_hdr *hdr)
 {
 	if (IS_ENABLED(CONFIG_SPL_LZMA))
 		return image_get_comp(hdr);
@@ -81,7 +81,7 @@
 {
 	__maybe_unused SizeT lzma_len;
 	__maybe_unused void *src;
-	struct image_header hdr;
+	struct legacy_img_hdr hdr;
 	ulong dataptr;
 	int ret;
 
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 23a395e..e4135b2 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -20,7 +20,7 @@
 static int mmc_load_legacy(struct spl_image_info *spl_image,
 			   struct spl_boot_device *bootdev,
 			   struct mmc *mmc,
-			   ulong sector, struct image_header *header)
+			   ulong sector, struct legacy_img_hdr *header)
 {
 	u32 image_offset_sectors;
 	u32 image_size_sectors;
@@ -83,7 +83,7 @@
 			      struct mmc *mmc, unsigned long sector)
 {
 	unsigned long count;
-	struct image_header *header;
+	struct legacy_img_hdr *header;
 	struct blk_desc *bd = mmc_get_blk_desc(mmc);
 	int ret = 0;
 
diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index 7b7579a..a167388 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -78,7 +78,7 @@
 
 static int spl_nand_load_element(struct spl_image_info *spl_image,
 				 struct spl_boot_device *bootdev,
-				 int offset, struct image_header *header)
+				 int offset, struct legacy_img_hdr *header)
 {
 	struct mtd_info *mtd = nand_get_mtd();
 	int bl_len = mtd ? mtd->writesize : 1;
@@ -133,7 +133,7 @@
 			       struct spl_boot_device *bootdev)
 {
 	int err;
-	struct image_header *header;
+	struct legacy_img_hdr *header;
 	int *src __attribute__((unused));
 	int *dst __attribute__((unused));
 
diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c
index a853e6a..b2c901b 100644
--- a/common/spl/spl_net.c
+++ b/common/spl/spl_net.c
@@ -28,7 +28,7 @@
 static int spl_net_load_image(struct spl_image_info *spl_image,
 			      struct spl_boot_device *bootdev)
 {
-	struct image_header *header = (struct image_header *)image_load_addr;
+	struct legacy_img_hdr *header = (struct legacy_img_hdr *)image_load_addr;
 	int rv;
 
 	env_init();
diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
index 7986e93..281c613 100644
--- a/common/spl/spl_nor.c
+++ b/common/spl/spl_nor.c
@@ -26,7 +26,7 @@
 static int spl_nor_load_image(struct spl_image_info *spl_image,
 			      struct spl_boot_device *bootdev)
 {
-	__maybe_unused const struct image_header *header;
+	__maybe_unused const struct legacy_img_hdr *header;
 	__maybe_unused struct spl_load_info load;
 
 	/*
@@ -41,7 +41,7 @@
 		 * Load Linux from its location in NOR flash to its defined
 		 * location in SDRAM
 		 */
-		header = (const struct image_header *)CONFIG_SYS_OS_BASE;
+		header = (const struct legacy_img_hdr *)CONFIG_SYS_OS_BASE;
 #ifdef CONFIG_SPL_LOAD_FIT
 		if (image_get_magic(header) == FDT_MAGIC) {
 			int ret;
@@ -72,7 +72,7 @@
 
 			memcpy((void *)spl_image->load_addr,
 			       (void *)(CONFIG_SYS_OS_BASE +
-					sizeof(struct image_header)),
+					sizeof(struct legacy_img_hdr)),
 			       spl_image->size);
 #ifdef CONFIG_SYS_SPL_ARGS_ADDR
 			spl_image->arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
@@ -92,7 +92,7 @@
 	 * defined location in SDRAM
 	 */
 #ifdef CONFIG_SPL_LOAD_FIT
-	header = (const struct image_header *)spl_nor_get_uboot_base();
+	header = (const struct legacy_img_hdr *)spl_nor_get_uboot_base();
 	if (image_get_magic(header) == FDT_MAGIC) {
 		debug("Found FIT format U-Boot\n");
 		load.bl_len = 1;
diff --git a/common/spl/spl_onenand.c b/common/spl/spl_onenand.c
index f80769a..53a8c6d 100644
--- a/common/spl/spl_onenand.c
+++ b/common/spl/spl_onenand.c
@@ -18,7 +18,7 @@
 static int spl_onenand_load_image(struct spl_image_info *spl_image,
 				  struct spl_boot_device *bootdev)
 {
-	struct image_header *header;
+	struct legacy_img_hdr *header;
 	int ret;
 
 	debug("spl: onenand\n");
diff --git a/common/spl/spl_ram.c b/common/spl/spl_ram.c
index d647108..2b1ac19 100644
--- a/common/spl/spl_ram.c
+++ b/common/spl/spl_ram.c
@@ -41,9 +41,9 @@
 static int spl_ram_load_image(struct spl_image_info *spl_image,
 			      struct spl_boot_device *bootdev)
 {
-	struct image_header *header;
+	struct legacy_img_hdr *header;
 
-	header = (struct image_header *)CONFIG_SPL_LOAD_FIT_ADDRESS;
+	header = (struct legacy_img_hdr *)CONFIG_SPL_LOAD_FIT_ADDRESS;
 
 	if (CONFIG_IS_ENABLED(IMAGE_PRE_LOAD)) {
 		unsigned long addr = (unsigned long)header;
@@ -53,7 +53,7 @@
 			return ret;
 
 		addr += image_load_offset;
-		header = (struct image_header *)addr;
+		header = (struct legacy_img_hdr *)addr;
 	}
 
 #if CONFIG_IS_ENABLED(DFU)
@@ -87,7 +87,7 @@
 			u_boot_pos = (ulong)spl_get_load_buffer(-sizeof(*header),
 								sizeof(*header));
 		}
-		header = (struct image_header *)map_sysmem(u_boot_pos, 0);
+		header = (struct legacy_img_hdr *)map_sysmem(u_boot_pos, 0);
 
 		spl_parse_image_header(spl_image, bootdev, header);
 	}
diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c
index 6c36f2c..9ae0273 100644
--- a/common/spl/spl_sata.c
+++ b/common/spl/spl_sata.c
@@ -30,7 +30,7 @@
 		struct spl_boot_device *bootdev,
 		struct blk_desc *stor_dev, unsigned long sector)
 {
-	struct image_header *header;
+	struct legacy_img_hdr *header;
 	unsigned long count;
 	u32 image_size_sectors;
 	u32 image_offset_sectors;
diff --git a/common/spl/spl_semihosting.c b/common/spl/spl_semihosting.c
index df6aeb2..5b5e842 100644
--- a/common/spl/spl_semihosting.c
+++ b/common/spl/spl_semihosting.c
@@ -27,7 +27,7 @@
 	const char *filename = CONFIG_SPL_FS_LOAD_PAYLOAD_NAME;
 	int ret;
 	long fd, len;
-	struct image_header *header =
+	struct legacy_img_hdr *header =
 		spl_get_load_buffer(-sizeof(*header), sizeof(*header));
 
 	fd = smh_open(filename, MODE_READ | MODE_BINARY);
@@ -43,7 +43,7 @@
 	}
 	len = ret;
 
-	ret = smh_read_full(fd, header, sizeof(struct image_header));
+	ret = smh_read_full(fd, header, sizeof(struct legacy_img_hdr));
 	if (ret) {
 		log_debug("could not read image header: %d\n", ret);
 		goto out;
diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
index d959ad1..da67424 100644
--- a/common/spl/spl_spi.c
+++ b/common/spl/spl_spi.c
@@ -26,7 +26,7 @@
 static int spi_load_image_os(struct spl_image_info *spl_image,
 			     struct spl_boot_device *bootdev,
 			     struct spi_flash *flash,
-			     struct image_header *header)
+			     struct legacy_img_hdr *header)
 {
 	int err;
 
@@ -92,7 +92,7 @@
 	int err = 0;
 	unsigned int payload_offs;
 	struct spi_flash *flash;
-	struct image_header *header;
+	struct legacy_img_hdr *header;
 	unsigned int sf_bus = spl_spi_boot_bus();
 	unsigned int sf_cs = spl_spi_boot_cs();
 
@@ -139,7 +139,7 @@
 			if (err)
 				return err;
 			err = spl_parse_image_header(spl_image, bootdev,
-					(struct image_header *)CONFIG_SYS_LOAD_ADDR);
+					(struct legacy_img_hdr *)CONFIG_SYS_LOAD_ADDR);
 		} else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
 			   image_get_magic(header) == FDT_MAGIC) {
 			struct spl_load_info load;
diff --git a/common/spl/spl_ubi.c b/common/spl/spl_ubi.c
index bdf5cc4..fb804f0 100644
--- a/common/spl/spl_ubi.c
+++ b/common/spl/spl_ubi.c
@@ -15,7 +15,7 @@
 int spl_ubi_load_image(struct spl_image_info *spl_image,
 		       struct spl_boot_device *bootdev)
 {
-	struct image_header *header;
+	struct legacy_img_hdr *header;
 	struct ubispl_info info;
 	struct ubispl_load volumes[2];
 	int ret = 1;
@@ -54,7 +54,7 @@
 
 		ret = ubispl_load_volumes(&info, volumes, 2);
 		if (!ret) {
-			header = (struct image_header *)volumes[0].load_addr;
+			header = (struct legacy_img_hdr *)volumes[0].load_addr;
 			spl_parse_image_header(spl_image, bootdev, header);
 			puts("Linux loaded.\n");
 			goto out;
diff --git a/common/spl/spl_xip.c b/common/spl/spl_xip.c
index e9a40b0..1258d85 100644
--- a/common/spl/spl_xip.c
+++ b/common/spl/spl_xip.c
@@ -25,6 +25,6 @@
 	}
 #endif
 	return(spl_parse_image_header(spl_image, bootdev,
-	       (const struct image_header *)CONFIG_SYS_UBOOT_BASE));
+	       (const struct legacy_img_hdr *)CONFIG_SYS_UBOOT_BASE));
 }
 SPL_LOAD_IMAGE_METHOD("XIP", 0, BOOT_DEVICE_XIP, spl_xip);
diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c
index fdd5261..038b443 100644
--- a/common/spl/spl_ymodem.c
+++ b/common/spl/spl_ymodem.c
@@ -96,7 +96,7 @@
 	int ret;
 	connection_info_t info;
 	char buf[BUF_SIZE];
-	struct image_header *ih = NULL;
+	struct legacy_img_hdr *ih = NULL;
 	ulong addr = 0;
 
 	info.mode = xyzModem_ymodem;
@@ -111,9 +111,9 @@
 		goto end_stream;
 
 	if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) &&
-	    image_get_magic((struct image_header *)buf) == FDT_MAGIC) {
+	    image_get_magic((struct legacy_img_hdr *)buf) == FDT_MAGIC) {
 		addr = CONFIG_SYS_LOAD_ADDR;
-		ih = (struct image_header *)addr;
+		ih = (struct legacy_img_hdr *)addr;
 
 		memcpy((void *)addr, buf, res);
 		size += res;
@@ -129,7 +129,7 @@
 		if (ret)
 			return ret;
 	} else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
-	    image_get_magic((struct image_header *)buf) == FDT_MAGIC) {
+	    image_get_magic((struct legacy_img_hdr *)buf) == FDT_MAGIC) {
 		struct spl_load_info load;
 		struct ymodem_fit_info info;
 
@@ -147,7 +147,7 @@
 		while ((res = xyzModem_stream_read(buf, BUF_SIZE, &err)) > 0)
 			size += res;
 	} else {
-		ih = (struct image_header *)buf;
+		ih = (struct legacy_img_hdr *)buf;
 		ret = spl_parse_image_header(spl_image, bootdev, ih);
 		if (ret)
 			goto end_stream;
@@ -158,7 +158,7 @@
 #endif
 			addr = spl_image->load_addr;
 		memcpy((void *)addr, buf, res);
-		ih = (struct image_header *)addr;
+		ih = (struct legacy_img_hdr *)addr;
 		size += res;
 		addr += res;
 
@@ -177,7 +177,7 @@
 
 #ifdef CONFIG_SPL_GZIP
 	if (!(IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
-	      image_get_magic((struct image_header *)buf) == FDT_MAGIC) &&
+	      image_get_magic((struct legacy_img_hdr *)buf) == FDT_MAGIC) &&
 	    (ih->ih_comp == IH_COMP_GZIP)) {
 		if (gunzip((void *)(spl_image->load_addr + sizeof(*ih)),
 			   CONFIG_SYS_BOOTM_LEN,
diff --git a/common/splash_source.c b/common/splash_source.c
index 2c03cbd..87e55a5 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -327,17 +327,17 @@
 	int external_splash_addr;
 	int external_splash_size;
 	bool is_splash_external = false;
-	struct image_header *img_header;
+	struct legacy_img_hdr *img_header;
 	const u32 *fit_header;
 	u32 fit_size;
-	const size_t header_size = sizeof(struct image_header);
+	const size_t header_size = sizeof(struct legacy_img_hdr);
 
 	/* Read in image header */
 	res = splash_storage_read_raw(location, bmp_load_addr, header_size);
 	if (res < 0)
 		return res;
 
-	img_header = (struct image_header *)bmp_load_addr;
+	img_header = (struct legacy_img_hdr *)bmp_load_addr;
 	if (image_get_magic(img_header) != FDT_MAGIC) {
 		printf("Could not find FDT magic\n");
 		return -EINVAL;