From 87d93a1ba2ae23550e1370adb7a3b00af0831165 Mon Sep 17 00:00:00 2001
From: Wolfgang Wegner <w.wegner@astro-kom.de>
Date: Wed, 9 Dec 2009 15:16:47 +0100
Subject: [PATCH] move prototypes for gunzip() and zunzip() to common.h

Prototype for gunzip/zunzip was only in lib_generic/gunzip.c and thus
repeated in every file using it. This patch moves the prototypes to
common.h and removes all prototypes distributed anywhere else.

Signed-off-by: Wolfgang Wegner <w.wegner@astro-kom.de>
---
 board/bf527-ezkit/video.c                  | 2 --
 board/bf533-stamp/video.c                  | 2 --
 board/bf548-ezkit/video.c                  | 2 --
 board/cm-bf548/video.c                     | 2 --
 board/dave/PPChameleonEVB/PPChameleonEVB.c | 3 ---
 board/esd/apc405/apc405.c                  | 3 ---
 board/esd/ash405/ash405.c                  | 4 ----
 board/esd/cpci405/cpci405.c                | 1 -
 board/esd/hh405/hh405.c                    | 4 ----
 board/esd/pci405/pci405.c                  | 1 -
 board/esd/plu405/plu405.c                  | 3 ---
 board/esd/tasreg/tasreg.c                  | 1 -
 board/esd/voh405/voh405.c                  | 4 ----
 board/esd/wuh405/wuh405.c                  | 4 ----
 board/mpl/common/common_util.c             | 1 -
 board/prodrive/pdnb3/pdnb3.c               | 1 -
 common/cmd_bmp.c                           | 2 --
 common/cmd_bootm.c                         | 1 -
 common/cmd_license.c                       | 1 -
 common/cmd_mem.c                           | 2 --
 drivers/video/cfb_console.c                | 2 --
 fs/ubifs/ubifs.h                           | 3 ---
 include/common.h                           | 5 +++++
 lib_generic/gunzip.c                       | 3 ---
 24 files changed, 5 insertions(+), 52 deletions(-)

diff --git a/board/bf527-ezkit/video.c b/board/bf527-ezkit/video.c
index 0b6b7b2e76..57652be293 100644
--- a/board/bf527-ezkit/video.c
+++ b/board/bf527-ezkit/video.c
@@ -16,8 +16,6 @@
 #include <linux/types.h>
 #include <stdio_dev.h>
 
-int gunzip(void *, int, unsigned char *, unsigned long *);
-
 #define DMA_SIZE16	2
 
 #include <asm/mach-common/bits/ppi.h>
diff --git a/board/bf533-stamp/video.c b/board/bf533-stamp/video.c
index 28ffa618fc..939bd35a03 100644
--- a/board/bf533-stamp/video.c
+++ b/board/bf533-stamp/video.c
@@ -20,8 +20,6 @@
 #include <linux/types.h>
 #include <stdio_dev.h>
 
-int gunzip(void *, int, unsigned char *, unsigned long *);
-
 #define DMA_SIZE16	2
 
 #include <asm/mach-common/bits/ppi.h>
diff --git a/board/bf548-ezkit/video.c b/board/bf548-ezkit/video.c
index f4f1becae2..10b08e2bf0 100644
--- a/board/bf548-ezkit/video.c
+++ b/board/bf548-ezkit/video.c
@@ -16,8 +16,6 @@
 #include <linux/types.h>
 #include <stdio_dev.h>
 
-int gunzip(void *, int, unsigned char *, unsigned long *);
-
 #define DMA_SIZE16	2
 
 #include <asm/mach-common/bits/eppi.h>
diff --git a/board/cm-bf548/video.c b/board/cm-bf548/video.c
index 078734269d..4097f09e11 100644
--- a/board/cm-bf548/video.c
+++ b/board/cm-bf548/video.c
@@ -16,8 +16,6 @@
 #include <linux/types.h>
 #include <stdio_dev.h>
 
-int gunzip(void *, int, unsigned char *, unsigned long *);
-
 #ifdef CONFIG_VIDEO
 
 #define DMA_SIZE16	2
diff --git a/board/dave/PPChameleonEVB/PPChameleonEVB.c b/board/dave/PPChameleonEVB/PPChameleonEVB.c
index 06de6e0b1d..6bc70ef9a4 100644
--- a/board/dave/PPChameleonEVB/PPChameleonEVB.c
+++ b/board/dave/PPChameleonEVB/PPChameleonEVB.c
@@ -33,9 +33,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 /* ------------------------------------------------------------------------- */
 
-/* Prototypes */
-int gunzip(void *, int, unsigned char *, unsigned long *);
-
 int board_early_init_f (void)
 {
 	out32(GPIO0_OR, CONFIG_SYS_NAND0_CE);                 /* set initial outputs     */
diff --git a/board/esd/apc405/apc405.c b/board/esd/apc405/apc405.c
index 409a0540bf..72c0907e01 100644
--- a/board/esd/apc405/apc405.c
+++ b/board/esd/apc405/apc405.c
@@ -54,9 +54,6 @@ const unsigned char fpgadata[] =
  */
 #include "../common/fpga.c"
 
-/* Prototypes */
-int gunzip(void *, int, unsigned char *, unsigned long *);
-
 #ifdef CONFIG_LCD_USED
 /* logo bitmap data - gzip compressed and generated by bin2c */
 unsigned char logo_bmp[] =
diff --git a/board/esd/ash405/ash405.c b/board/esd/ash405/ash405.c
index 5f0e67cbb4..0615959316 100644
--- a/board/esd/ash405/ash405.c
+++ b/board/esd/ash405/ash405.c
@@ -48,10 +48,6 @@ const unsigned char fpgadata[] =
 #include "../common/fpga.c"
 
 
-/* Prototypes */
-int gunzip(void *, int, unsigned char *, unsigned long *);
-
-
 int board_early_init_f (void)
 {
 	/*
diff --git a/board/esd/cpci405/cpci405.c b/board/esd/cpci405/cpci405.c
index c29c876d61..24db8830c7 100644
--- a/board/esd/cpci405/cpci405.c
+++ b/board/esd/cpci405/cpci405.c
@@ -89,7 +89,6 @@ int N_AU_IMAGES = (sizeof(au_image) / sizeof(au_image[0]));
 
 /* Prototypes */
 int cpci405_version(void);
-int gunzip(void *, int, unsigned char *, unsigned long *);
 void lxt971_no_sleep(void);
 
 int board_early_init_f(void)
diff --git a/board/esd/hh405/hh405.c b/board/esd/hh405/hh405.c
index 132531b39c..4251d51b2e 100644
--- a/board/esd/hh405/hh405.c
+++ b/board/esd/hh405/hh405.c
@@ -251,10 +251,6 @@ const unsigned char fpgadata[] =
 #include "../common/fpga.c"
 
 
-/* Prototypes */
-int gunzip(void *, int, unsigned char *, unsigned long *);
-
-
 /* logo bitmap data - gzip compressed and generated by bin2c */
 unsigned char logo_bmp_320[] =
 {
diff --git a/board/esd/pci405/pci405.c b/board/esd/pci405/pci405.c
index 34a1632401..536485727d 100644
--- a/board/esd/pci405/pci405.c
+++ b/board/esd/pci405/pci405.c
@@ -34,7 +34,6 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 /* Prototypes */
-int gunzip(void *, int, unsigned char *, unsigned long *);
 int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 unsigned long fpga_done_state(void);
 unsigned long fpga_init_state(void);
diff --git a/board/esd/plu405/plu405.c b/board/esd/plu405/plu405.c
index fcffdf67c0..e385a78a2e 100644
--- a/board/esd/plu405/plu405.c
+++ b/board/esd/plu405/plu405.c
@@ -46,9 +46,6 @@ const unsigned char fpgadata[] =
  */
 #include "../common/fpga.c"
 
-/* Prototypes */
-int gunzip(void *, int, unsigned char *, unsigned long *);
-
 int board_early_init_f(void)
 {
 	/*
diff --git a/board/esd/tasreg/tasreg.c b/board/esd/tasreg/tasreg.c
index 18444427fe..bd9fb2fc2b 100644
--- a/board/esd/tasreg/tasreg.c
+++ b/board/esd/tasreg/tasreg.c
@@ -29,7 +29,6 @@
 
 
 /* Prototypes */
-int gunzip(void *, int, unsigned char *, unsigned long *);
 int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len);
 int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len);
diff --git a/board/esd/voh405/voh405.c b/board/esd/voh405/voh405.c
index 3f81665eb2..a5600de6fc 100644
--- a/board/esd/voh405/voh405.c
+++ b/board/esd/voh405/voh405.c
@@ -48,10 +48,6 @@ const unsigned char fpgadata[] =
 #include "../common/fpga.c"
 
 
-/* Prototypes */
-int gunzip(void *, int, unsigned char *, unsigned long *);
-
-
 /* logo bitmap data - gzip compressed and generated by bin2c */
 unsigned char logo_bmp_320[] =
 {
diff --git a/board/esd/wuh405/wuh405.c b/board/esd/wuh405/wuh405.c
index f2591d57f4..01966eec26 100644
--- a/board/esd/wuh405/wuh405.c
+++ b/board/esd/wuh405/wuh405.c
@@ -46,10 +46,6 @@ const unsigned char fpgadata[] =
 #include "../common/fpga.c"
 
 
-/* Prototypes */
-int gunzip(void *, int, unsigned char *, unsigned long *);
-
-
 int board_early_init_f (void)
 {
 	/*
diff --git a/board/mpl/common/common_util.c b/board/mpl/common/common_util.c
index 61af4aea1a..32bf244935 100644
--- a/board/mpl/common/common_util.c
+++ b/board/mpl/common/common_util.c
@@ -48,7 +48,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define FIRM_START 0xFFF00000
 #endif
 
-extern int gunzip(void *, int, uchar *, unsigned long *);
 extern int mem_test(ulong start, ulong ramsize, int quiet);
 
 #define I2C_BACKUP_ADDR 0x7C00		/* 0x200 bytes for backup */
diff --git a/board/prodrive/pdnb3/pdnb3.c b/board/prodrive/pdnb3/pdnb3.c
index c323456d60..69f8f9bbca 100644
--- a/board/prodrive/pdnb3/pdnb3.c
+++ b/board/prodrive/pdnb3/pdnb3.c
@@ -29,7 +29,6 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 /* Prototypes */
-int gunzip(void *, int, unsigned char *, unsigned long *);
 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 
 /* predefine these here for FPGA programming (before including fpga.c) */
diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c
index faa10a4145..74ab24ca94 100644
--- a/common/cmd_bmp.c
+++ b/common/cmd_bmp.c
@@ -35,8 +35,6 @@
 static int bmp_info (ulong addr);
 static int bmp_display (ulong addr, int x, int y);
 
-int gunzip(void *, int, unsigned char *, unsigned long *);
-
 /*
  * Allocate and decompress a BMP image using gunzip().
  *
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index efd6aec0cf..94ddac37cf 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -63,7 +63,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-extern int gunzip (void *dst, int dstlen, unsigned char *src, unsigned long *lenp);
 #ifndef CONFIG_SYS_BOOTM_LEN
 #define CONFIG_SYS_BOOTM_LEN	0x800000	/* use 8MByte as default max gunzip size */
 #endif
diff --git a/common/cmd_license.c b/common/cmd_license.c
index c6f272ad34..85a4871de0 100644
--- a/common/cmd_license.c
+++ b/common/cmd_license.c
@@ -29,7 +29,6 @@
 #include <command.h>
 #include <malloc.h>
 #include <license.h>
-int gunzip(void *, int, unsigned char *, unsigned long *);
 
 int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index a34b342f09..1839330760 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -1225,8 +1225,6 @@ int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 #endif
 
 #ifdef CONFIG_CMD_UNZIP
-int  gunzip (void *, int, unsigned char *, unsigned long *);
-
 int do_unzip ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	unsigned long src, dst;
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 16d6689f22..c07a26e3c0 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -403,8 +403,6 @@ static const int video_font_draw_table32[16][4] = {
 	    { 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff } };
 
 
-int gunzip(void *, int, unsigned char *, unsigned long *);
-
 /******************************************************************************/
 
 static void video_drawchars (int xx, int yy, unsigned char *s, int count)
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 06772af36f..0af471afb9 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -2140,7 +2140,4 @@ int ubifs_decompress(const void *buf, int len, void *out, int *out_len,
 /* todo: Move these to a common U-Boot header */
 int lzo1x_decompress_safe(const unsigned char *in, size_t in_len,
 			  unsigned char *out, size_t *out_len);
-
-int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
-						int stoponerr, int offset);
 #endif /* !__UBIFS_H__ */
diff --git a/include/common.h b/include/common.h
index 00b543408e..07897f682e 100644
--- a/include/common.h
+++ b/include/common.h
@@ -612,6 +612,11 @@ ulong	usec2ticks    (unsigned long usec);
 ulong	ticks2usec    (unsigned long ticks);
 int	init_timebase (void);
 
+/* lib_generic/gunzip.c */
+int gunzip(void *, int, unsigned char *, unsigned long *);
+int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
+						int stoponerr, int offset);
+
 /* lib_generic/time.c */
 void	udelay        (unsigned long);
 
diff --git a/lib_generic/gunzip.c b/lib_generic/gunzip.c
index d59a4482b7..d2b7ad4779 100644
--- a/lib_generic/gunzip.c
+++ b/lib_generic/gunzip.c
@@ -36,11 +36,8 @@
 #define RESERVED		0xe0
 #define DEFLATED		8
 
-int gunzip(void *, int, unsigned char *, unsigned long *);
 void *zalloc(void *, unsigned, unsigned);
 void zfree(void *, void *, unsigned);
-int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
-						int stoponerr, int offset);
 
 void *zalloc(void *x, unsigned items, unsigned size)
 {
-- 
2.39.5