Merge branch 'master' of git://git.denx.de/u-boot-i2c
diff --git a/board/raspberrypi/rpi_b/rpi_b.c b/board/raspberrypi/rpi_b/rpi_b.c
index f33fae9..220bb90 100644
--- a/board/raspberrypi/rpi_b/rpi_b.c
+++ b/board/raspberrypi/rpi_b/rpi_b.c
@@ -16,7 +16,9 @@
 
 #include <common.h>
 #include <config.h>
+#include <fdt_support.h>
 #include <lcd.h>
+#include <mmc.h>
 #include <asm/arch/mbox.h>
 #include <asm/arch/sdhci.h>
 #include <asm/global_data.h>
@@ -91,7 +93,7 @@
 	return power_on_module(BCM2835_MBOX_POWER_DEVID_USB_HCD);
 }
 
-int board_mmc_init(void)
+int board_mmc_init(bd_t *bis)
 {
 	ALLOC_ALIGN_BUFFER(struct msg_get_clock_rate, msg_clk, 1, 16);
 	int ret;
diff --git a/common/autoboot.c b/common/autoboot.c
index 30102a4..c27cc2c 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <autoboot.h>
 #include <bootretry.h>
 #include <cli.h>
 #include <fdtdec.h>
diff --git a/common/board_f.c b/common/board_f.c
index 4ea4cb2..bdab38e 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -37,6 +37,7 @@
 #include <os.h>
 #include <post.h>
 #include <spi.h>
+#include <status_led.h>
 #include <trace.h>
 #include <watchdog.h>
 #include <asm/errno.h>
@@ -78,25 +79,15 @@
  ************************************************************************
  * May be supplied by boards if desired
  */
-inline void __coloured_LED_init(void) {}
-void coloured_LED_init(void)
-	__attribute__((weak, alias("__coloured_LED_init")));
-inline void __red_led_on(void) {}
-void red_led_on(void) __attribute__((weak, alias("__red_led_on")));
-inline void __red_led_off(void) {}
-void red_led_off(void) __attribute__((weak, alias("__red_led_off")));
-inline void __green_led_on(void) {}
-void green_led_on(void) __attribute__((weak, alias("__green_led_on")));
-inline void __green_led_off(void) {}
-void green_led_off(void) __attribute__((weak, alias("__green_led_off")));
-inline void __yellow_led_on(void) {}
-void yellow_led_on(void) __attribute__((weak, alias("__yellow_led_on")));
-inline void __yellow_led_off(void) {}
-void yellow_led_off(void) __attribute__((weak, alias("__yellow_led_off")));
-inline void __blue_led_on(void) {}
-void blue_led_on(void) __attribute__((weak, alias("__blue_led_on")));
-inline void __blue_led_off(void) {}
-void blue_led_off(void) __attribute__((weak, alias("__blue_led_off")));
+__weak void coloured_LED_init(void) {}
+__weak void red_led_on(void) {}
+__weak void red_led_off(void) {}
+__weak void green_led_on(void) {}
+__weak void green_led_off(void) {}
+__weak void yellow_led_on(void) {}
+__weak void yellow_led_off(void) {}
+__weak void blue_led_on(void) {}
+__weak void blue_led_off(void) {}
 
 /*
  * Why is gd allocated a register? Prior to reloc it might be better to
diff --git a/common/bootm_os.c b/common/bootm_os.c
index f7769ac..5be4467 100644
--- a/common/bootm_os.c
+++ b/common/bootm_os.c
@@ -437,11 +437,10 @@
 };
 
 /* Allow for arch specific config before we boot */
-static void __arch_preboot_os(void)
+__weak void arch_preboot_os(void)
 {
 	/* please define platform specific arch_preboot_os() */
 }
-void arch_preboot_os(void) __attribute__((weak, alias("__arch_preboot_os")));
 
 int boot_selected_os(int argc, char * const argv[], int state,
 		     bootm_headers_t *images, boot_os_fn *boot_fn)
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index f283a16..3d37a86 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -351,7 +351,8 @@
 
 #elif defined(CONFIG_ARM)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
+			char * const argv[])
 {
 	int i;
 	bd_t *bd = gd->bd;
diff --git a/common/cmd_cache.c b/common/cmd_cache.c
index 602feca..37ab345 100644
--- a/common/cmd_cache.c
+++ b/common/cmd_cache.c
@@ -20,7 +20,7 @@
 	puts("No arch specific invalidate_icache_all available!\n");
 }
 
-int do_icache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_icache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	switch (argc) {
 	case 2:			/* on / off	*/
@@ -52,7 +52,7 @@
 	/* please define arch specific flush_dcache_all */
 }
 
-int do_dcache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_dcache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	switch (argc) {
 	case 2:			/* on / off */
diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c
index fad462f..a02f0cb 100644
--- a/common/cmd_eeprom.c
+++ b/common/cmd_eeprom.c
@@ -43,7 +43,7 @@
 /* ------------------------------------------------------------------------- */
 
 #if defined(CONFIG_CMD_EEPROM)
-int do_eeprom ( cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	const char *const fmt =
 		"\nEEPROM @0x%lX %s: addr %08lx  off %04lx  count %ld ... ";
@@ -413,7 +413,7 @@
 	"read  devaddr addr off cnt\n"
 	"eeprom write devaddr addr off cnt\n"
 	"       - read/write `cnt' bytes from `devaddr` EEPROM at offset `off'"
-);
+)
 #else /* One EEPROM */
 U_BOOT_CMD(
 	eeprom,	5,	1,	do_eeprom,
@@ -421,7 +421,7 @@
 	"read  addr off cnt\n"
 	"eeprom write addr off cnt\n"
 	"       - read/write `cnt' bytes at EEPROM offset `off'"
-);
+)
 #endif /* CONFIG_SYS_I2C_MULTI_EEPROMS */
 
 #endif
diff --git a/common/cmd_ext2.c b/common/cmd_ext2.c
index 5a4bcc1..9e82f49 100644
--- a/common/cmd_ext2.c
+++ b/common/cmd_ext2.c
@@ -22,7 +22,7 @@
  */
 #include <fs.h>
 
-int do_ext2ls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ext2ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	return do_ls(cmdtp, flag, argc, argv, FS_TYPE_EXT);
 }
@@ -30,7 +30,7 @@
 /******************************************************************************
  * Ext2fs boot command intepreter. Derived from diskboot
  */
-int do_ext2load (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ext2load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	return do_load(cmdtp, flag, argc, argv, FS_TYPE_EXT);
 }
@@ -40,7 +40,7 @@
 	"list files in a directory (default /)",
 	"<interface> <dev[:part]> [directory]\n"
 	"    - list files from 'dev' on 'interface' in a 'directory'"
-);
+)
 
 U_BOOT_CMD(
 	ext2load,	6,	0,	do_ext2load,
@@ -48,4 +48,4 @@
 	"<interface> <dev[:part]> [addr] [filename] [bytes]\n"
 	"    - load binary file 'filename' from 'dev' on 'interface'\n"
 	"      to address 'addr' from ext2 filesystem."
-);
+)
diff --git a/common/cmd_fs.c b/common/cmd_fs.c
index 91a205a..78590d2 100644
--- a/common/cmd_fs.c
+++ b/common/cmd_fs.c
@@ -20,7 +20,8 @@
 #include <command.h>
 #include <fs.h>
 
-int do_load_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_load_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
+				char * const argv[])
 {
 	return do_load(cmdtp, flag, argc, argv, FS_TYPE_ANY);
 }
@@ -35,9 +36,10 @@
 	"      If 'bytes' is 0 or omitted, the file is read until the end.\n"
 	"      'pos' gives the file byte position to start reading from.\n"
 	"      If 'pos' is 0 or omitted, the file is read from the start."
-);
+)
 
-int do_ls_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ls_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
+				char * const argv[])
 {
 	return do_ls(cmdtp, flag, argc, argv, FS_TYPE_ANY);
 }
@@ -48,4 +50,4 @@
 	"<interface> [<dev[:part]> [directory]]\n"
 	"    - List files in directory 'directory' of partition 'part' on\n"
 	"      device type 'interface' instance 'dev'."
-);
+)
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index d714658..3a75f94 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -1366,7 +1366,8 @@
  * Returns zero always.
  */
 #if defined(CONFIG_SYS_I2C)
-int do_i2c_show_bus(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_show_bus(cmd_tbl_t *cmdtp, int flag, int argc,
+				char * const argv[])
 {
 	int	i;
 #ifndef CONFIG_SYS_I2C_DIRECT_BUS
@@ -1425,7 +1426,8 @@
  * on error.
  */
 #if defined(CONFIG_SYS_I2C) || defined(CONFIG_I2C_MULTI_BUS)
-int do_i2c_bus_num(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_bus_num(cmd_tbl_t *cmdtp, int flag, int argc,
+				char * const argv[])
 {
 	int		ret = 0;
 	unsigned int	bus_no;
diff --git a/common/cmd_mii.c b/common/cmd_mii.c
index b82a7ce..7c4a57a 100644
--- a/common/cmd_mii.c
+++ b/common/cmd_mii.c
@@ -160,10 +160,10 @@
 
 		mask_in_place = pdesc->mask << pdesc->lo;
 
-		printf("  (%04hx:%04hx) %u.",
-			mask_in_place,
-			regval & mask_in_place,
-			prd->regno);
+		printf("  (%04hx:%04x) %u.",
+		       mask_in_place,
+		       regval & mask_in_place,
+		       prd->regno);
 
 		if (special_field(prd->regno, pdesc, regval)) {
 		}
diff --git a/common/cmd_part.c b/common/cmd_part.c
index c84bc27..39e8666 100644
--- a/common/cmd_part.c
+++ b/common/cmd_part.c
@@ -26,7 +26,7 @@
 #error CONFIG_PARTITION_UUIDS must be enabled for CONFIG_CMD_PART to be enabled
 #endif
 
-int do_part_uuid(int argc, char * const argv[])
+static int do_part_uuid(int argc, char * const argv[])
 {
 	int part;
 	block_dev_desc_t *dev_desc;
@@ -49,7 +49,7 @@
 	return 0;
 }
 
-int do_part_list(int argc, char * const argv[])
+static int do_part_list(int argc, char * const argv[])
 {
 	int ret;
 	block_dev_desc_t *desc;
@@ -66,7 +66,7 @@
 	return 0;
 }
 
-int do_part(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_part(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 3483328..ba48692 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -1562,7 +1562,7 @@
 	U_BOOT_CMD_MKENT(boot, 2, 1, do_pxe_boot, "", "")
 };
 
-int do_pxe(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_pxe(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	cmd_tbl_t *cp;
 
@@ -1596,7 +1596,7 @@
  *
  * Returns 0 on success, 1 on error.
  */
-int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	unsigned long pxefile_addr_r;
 	struct pxe_menu *cfg;
diff --git a/common/cmd_source.c b/common/cmd_source.c
index f3e9e60..6881bc9 100644
--- a/common/cmd_source.c
+++ b/common/cmd_source.c
@@ -142,8 +142,7 @@
 
 /**************************************************/
 #if defined(CONFIG_CMD_SOURCE)
-int
-do_source (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_source(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	ulong addr;
 	int rcode;
diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c
index 7c4d950..3c37c93 100644
--- a/common/cmd_ubi.c
+++ b/common/cmd_ubi.c
@@ -287,7 +287,7 @@
 	return err;
 }
 
-int ubi_volume_continue_write(char *volume, void *buf, size_t size)
+static int ubi_volume_continue_write(char *volume, void *buf, size_t size)
 {
 	int err = 1;
 	struct ubi_volume *vol;
diff --git a/common/cmd_ubifs.c b/common/cmd_ubifs.c
index fdc8bfe..19c8a43 100644
--- a/common/cmd_ubifs.c
+++ b/common/cmd_ubifs.c
@@ -21,7 +21,8 @@
 static int ubifs_initialized;
 static int ubifs_mounted;
 
-int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc,
+				char * const argv[])
 {
 	char *vol_name;
 	int ret;
@@ -65,7 +66,8 @@
 	ubifs_initialized = 0;
 }
 
-int do_ubifs_umount(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ubifs_umount(cmd_tbl_t *cmdtp, int flag, int argc,
+				char * const argv[])
 {
 	if (argc != 1)
 		return CMD_RET_USAGE;
@@ -80,7 +82,8 @@
 	return 0;
 }
 
-int do_ubifs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ubifs_ls(cmd_tbl_t *cmdtp, int flag, int argc,
+			char * const argv[])
 {
 	char *filename = "/";
 	int ret;
@@ -103,7 +106,8 @@
 	return ret;
 }
 
-int do_ubifs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ubifs_load(cmd_tbl_t *cmdtp, int flag, int argc,
+				char * const argv[])
 {
 	char *filename;
 	char *endp;
diff --git a/common/env_common.c b/common/env_common.c
index cd7b4cd..3b979bc 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -27,12 +27,10 @@
 	.change_ok = env_flags_validate,
 };
 
-static uchar __env_get_char_spec(int index)
+__weak uchar env_get_char_spec(int index)
 {
 	return *((uchar *)(gd->env_addr + index));
 }
-uchar env_get_char_spec(int)
-	__attribute__((weak, alias("__env_get_char_spec")));
 
 static uchar env_get_char_init(int index)
 {
diff --git a/common/main.c b/common/main.c
index 32618f1..2979fbe 100644
--- a/common/main.c
+++ b/common/main.c
@@ -17,8 +17,7 @@
 /*
  * Board-specific Platform code can reimplement show_boot_progress () if needed
  */
-void inline __show_boot_progress (int val) {}
-void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress")));
+__weak void show_boot_progress(int val) {}
 
 static void modem_init(void)
 {
diff --git a/common/splash.c b/common/splash.c
index 18885f1..144fb10 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -23,15 +23,11 @@
 #include <common.h>
 #include <splash.h>
 
-int __splash_screen_prepare(void)
+__weak int splash_screen_prepare(void)
 {
 	return 0;
 }
 
-int splash_screen_prepare(void)
-	__attribute__ ((weak, alias("__splash_screen_prepare")));
-
-
 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
 void splash_get_pos(int *x, int *y)
 {
diff --git a/drivers/core/lists.c b/drivers/core/lists.c
index afb59d1..87164a5 100644
--- a/drivers/core/lists.c
+++ b/drivers/core/lists.c
@@ -11,6 +11,7 @@
 #include <errno.h>
 #include <dm/device.h>
 #include <dm/device-internal.h>
+#include <dm/lists.h>
 #include <dm/platdata.h>
 #include <dm/uclass.h>
 #include <dm/util.h>
diff --git a/drivers/core/root.c b/drivers/core/root.c
index 1cbb096..11e0879 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -15,6 +15,7 @@
 #include <dm/device-internal.h>
 #include <dm/lists.h>
 #include <dm/platdata.h>
+#include <dm/root.h>
 #include <dm/uclass.h>
 #include <dm/util.h>
 #include <linux/list.h>
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index b5477b1..a26f3ce 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -21,7 +21,7 @@
 static struct list_head mmc_devices;
 static int cur_dev_num = -1;
 
-int __weak board_mmc_getwp(struct mmc *mmc)
+__weak int board_mmc_getwp(struct mmc *mmc)
 {
 	return -1;
 }
@@ -42,13 +42,11 @@
 	return wp;
 }
 
-int __board_mmc_getcd(struct mmc *mmc) {
+__weak int board_mmc_getcd(struct mmc *mmc)
+{
 	return -1;
 }
 
-int board_mmc_getcd(struct mmc *mmc)__attribute__((weak,
-	alias("__board_mmc_getcd")));
-
 int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 {
 	int ret;
@@ -377,7 +375,7 @@
 	return 0;
 }
 
-int mmc_send_op_cond(struct mmc *mmc)
+static int mmc_send_op_cond(struct mmc *mmc)
 {
 	struct mmc_cmd cmd;
 	int err, i;
@@ -399,7 +397,7 @@
 	return IN_PROGRESS;
 }
 
-int mmc_complete_op_cond(struct mmc *mmc)
+static int mmc_complete_op_cond(struct mmc *mmc)
 {
 	struct mmc_cmd cmd;
 	int timeout = 1000;
@@ -1371,17 +1369,17 @@
 	return 0;
 }
 
-/*
- * CPU and board-specific MMC initializations.  Aliased function
- * signals caller to move on
- */
-static int __def_mmc_init(bd_t *bis)
+/* CPU-specific MMC initializations */
+__weak int cpu_mmc_init(bd_t *bis)
 {
 	return -1;
 }
 
-int cpu_mmc_init(bd_t *bis) __attribute__((weak, alias("__def_mmc_init")));
-int board_mmc_init(bd_t *bis) __attribute__((weak, alias("__def_mmc_init")));
+/* board-specific MMC initializations. */
+__weak int board_mmc_init(bd_t *bis)
+{
+	return -1;
+}
 
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
 
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index 17cbb09..5b0c302 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -120,7 +120,7 @@
 }
 #endif
 
-unsigned char mmc_board_init(struct mmc *mmc)
+static unsigned char mmc_board_init(struct mmc *mmc)
 {
 #if defined(CONFIG_OMAP34XX)
 	t2_t *t2_base = (t2_t *)T2_BASE;
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index a389cd1..c4b5bc1 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -2360,7 +2360,7 @@
 #endif /* CONFIG_SYS_FLASH_QUIET_TEST */
 		}
 #ifdef CONFIG_SYS_FLASH_PROTECTION
-		else if ((s != NULL) && (strcmp(s, "yes") == 0)) {
+		else if (strcmp(s, "yes") == 0) {
 			/*
 			 * Only the U-Boot image and it's environment
 			 * is protected, all other sectors are
diff --git a/fs/yaffs2/yaffs_guts.c b/fs/yaffs2/yaffs_guts.c
index 21441fd..32e6ff2 100644
--- a/fs/yaffs2/yaffs_guts.c
+++ b/fs/yaffs2/yaffs_guts.c
@@ -219,18 +219,11 @@
 				     const u8 *data,
 				     const struct yaffs_ext_tags *tags)
 {
-	dev = dev;
-	nand_chunk = nand_chunk;
-	data = data;
-	tags = tags;
 }
 
 static void yaffs_handle_chunk_update(struct yaffs_dev *dev, int nand_chunk,
 				      const struct yaffs_ext_tags *tags)
 {
-	dev = dev;
-	nand_chunk = nand_chunk;
-	tags = tags;
 }
 
 void yaffs_handle_chunk_error(struct yaffs_dev *dev,
@@ -814,8 +807,6 @@
 	int required_depth;
 	int level = file_struct->top_level;
 
-	dev = dev;
-
 	/* Check sane level and chunk Id */
 	if (level < 0 || level > YAFFS_TNODES_MAX_LEVEL)
 		return NULL;
@@ -3212,20 +3203,18 @@
 		} else {
 			yaffs_strncpy(name, oh_name + 1, buff_size - 1);
 		}
-	} else {
-#else
-	dev = dev;
-	{
-#endif
-		yaffs_strncpy(name, oh_name, buff_size - 1);
+
+		return;
 	}
+#endif
+
+	yaffs_strncpy(name, oh_name, buff_size - 1);
 }
 
 static void yaffs_load_oh_from_name(struct yaffs_dev *dev, YCHAR *oh_name,
 				    const YCHAR *name)
 {
 #ifdef CONFIG_YAFFS_AUTO_UNICODE
-
 	int is_ascii;
 	YCHAR *w;
 
@@ -3256,13 +3245,12 @@
 			*oh_name = 0;
 			yaffs_strncpy(oh_name + 1, name, YAFFS_MAX_NAME_LENGTH - 2);
 		}
-	} else {
-#else
-	dev = dev;
-	{
-#endif
-		yaffs_strncpy(oh_name, name, YAFFS_MAX_NAME_LENGTH - 1);
+
+		return;
 	}
+#endif
+
+	yaffs_strncpy(oh_name, name, YAFFS_MAX_NAME_LENGTH - 1);
 }
 
 /* UpdateObjectHeader updates the header on NAND for an object.
diff --git a/fs/yaffs2/yaffs_verify.c b/fs/yaffs2/yaffs_verify.c
index 97734a9..3fef28b 100644
--- a/fs/yaffs2/yaffs_verify.c
+++ b/fs/yaffs2/yaffs_verify.c
@@ -19,20 +19,17 @@
 
 int yaffs_skip_verification(struct yaffs_dev *dev)
 {
-	dev = dev;
 	return !(yaffs_trace_mask &
 		 (YAFFS_TRACE_VERIFY | YAFFS_TRACE_VERIFY_FULL));
 }
 
 static int yaffs_skip_full_verification(struct yaffs_dev *dev)
 {
-	dev = dev;
 	return !(yaffs_trace_mask & (YAFFS_TRACE_VERIFY_FULL));
 }
 
 static int yaffs_skip_nand_verification(struct yaffs_dev *dev)
 {
-	dev = dev;
 	return !(yaffs_trace_mask & (YAFFS_TRACE_VERIFY_NAND));
 }
 
@@ -521,6 +518,5 @@
 
 int yaffs_verify_file_sane(struct yaffs_obj *in)
 {
-	in = in;
 	return YAFFS_OK;
 }
diff --git a/fs/yaffs2/yaffsfs.c b/fs/yaffs2/yaffsfs.c
index 334598e..41e5f01 100644
--- a/fs/yaffs2/yaffsfs.c
+++ b/fs/yaffs2/yaffsfs.c
@@ -3136,10 +3136,6 @@
 
 int yaffs_mknod(const YCHAR *pathname, mode_t mode, dev_t dev)
 {
-	pathname = pathname;
-	mode = mode;
-	dev = dev;
-
 	yaffsfs_SetError(-EINVAL);
 	return -1;
 }
@@ -3187,9 +3183,7 @@
 
 int yaffs_dump_dev(const YCHAR *path)
 {
-#if 1
-	path = path;
-#else
+#if 0
 	YCHAR *rest;
 
 	struct yaffs_obj *obj = yaffsfs_FindRoot(path, &rest);
diff --git a/include/env_callback.h b/include/env_callback.h
index f90a7fa..ab4e115 100644
--- a/include/env_callback.h
+++ b/include/env_callback.h
@@ -60,7 +60,7 @@
  */
 #ifdef CONFIG_SPL_BUILD
 #define U_BOOT_ENV_CALLBACK(name, callback) \
-	static inline void _u_boot_env_noop_##name(void) \
+	static inline __maybe_unused void _u_boot_env_noop_##name(void) \
 	{ \
 		(void)callback; \
 	}
diff --git a/include/mmc.h b/include/mmc.h
index f46572e..7f5f9bc 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -327,10 +327,11 @@
 int mmc_set_dev(int dev_num);
 void print_mmc_devices(char separator);
 int get_mmc_num(void);
-int board_mmc_getcd(struct mmc *mmc);
 int mmc_switch_part(int dev_num, unsigned int part_num);
 int mmc_getcd(struct mmc *mmc);
+int board_mmc_getcd(struct mmc *mmc);
 int mmc_getwp(struct mmc *mmc);
+int board_mmc_getwp(struct mmc *mmc);
 int mmc_set_dsr(struct mmc *mmc, u16 val);
 /* Function to change the size of boot partition and rpmb partitions */
 int mmc_boot_partition_size_change(struct mmc *mmc, unsigned long bootsize,
@@ -385,6 +386,7 @@
 #endif
 
 int board_mmc_init(bd_t *bis);
+int cpu_mmc_init(bd_t *bis);
 
 /* Set block count limit because of 16 bit register limit on some hardware*/
 #ifndef CONFIG_SYS_MMC_MAX_BLK_COUNT
diff --git a/include/status_led.h b/include/status_led.h
index 0eb91b8..b8aaaf7 100644
--- a/include/status_led.h
+++ b/include/status_led.h
@@ -272,19 +272,21 @@
 # include <asm/status_led.h>
 #endif
 
+#endif	/* CONFIG_STATUS_LED	*/
+
 /*
  * Coloured LEDs API
  */
 #ifndef	__ASSEMBLY__
-extern void	coloured_LED_init (void);
-extern void	red_led_on(void);
-extern void	red_led_off(void);
-extern void	green_led_on(void);
-extern void	green_led_off(void);
-extern void	yellow_led_on(void);
-extern void	yellow_led_off(void);
-extern void	blue_led_on(void);
-extern void	blue_led_off(void);
+void coloured_LED_init(void);
+void red_led_on(void);
+void red_led_off(void);
+void green_led_on(void);
+void green_led_off(void);
+void yellow_led_on(void);
+void yellow_led_off(void);
+void blue_led_on(void);
+void blue_led_off(void);
 #else
 	.extern LED_init
 	.extern red_led_on
@@ -297,6 +299,4 @@
 	.extern blue_led_off
 #endif
 
-#endif	/* CONFIG_STATUS_LED	*/
-
 #endif	/* _STATUS_LED_H_	*/
diff --git a/lib/div64.c b/lib/div64.c
index e688a91..795ef0e 100644
--- a/lib/div64.c
+++ b/lib/div64.c
@@ -16,6 +16,7 @@
  * assembly versions such as arch/powerpc/lib/div64.S and arch/sh/lib/div64.S.
  */
 
+#include <div64.h>
 #include <linux/types.h>
 
 uint32_t __div64_32(uint64_t *n, uint32_t base)
diff --git a/lib/lmb.c b/lib/lmb.c
index 081e418..49a3c9e 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -332,14 +332,12 @@
 	return 0;
 }
 
-void __board_lmb_reserve(struct lmb *lmb)
+__weak void board_lmb_reserve(struct lmb *lmb)
 {
 	/* please define platform specific board_lmb_reserve() */
 }
-void board_lmb_reserve(struct lmb *lmb) __attribute__((weak, alias("__board_lmb_reserve")));
 
-void __arch_lmb_reserve(struct lmb *lmb)
+__weak void arch_lmb_reserve(struct lmb *lmb)
 {
 	/* please define platform specific arch_lmb_reserve() */
 }
-void arch_lmb_reserve(struct lmb *lmb) __attribute__((weak, alias("__arch_lmb_reserve")));
diff --git a/lib/sha1.c b/lib/sha1.c
index 0a5f688..05b17a2 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -389,8 +389,6 @@
 	memset (&ctx, 0, sizeof (sha1_context));
 }
 
-static const char _sha1_src[] = "_sha1_src";
-
 #ifdef SELF_TEST
 /*
  * FIPS-180-1 test vectors
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 60874da..7ec758e 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -28,17 +28,6 @@
 /* some reluctance to put this into a new limits.h, so it is here */
 #define INT_MAX		((int)(~0U>>1))
 
-static const char hex_asc[] = "0123456789abcdef";
-#define hex_asc_lo(x)   hex_asc[((x) & 0x0f)]
-#define hex_asc_hi(x)   hex_asc[((x) & 0xf0) >> 4]
-
-static inline char *pack_hex_byte(char *buf, u8 byte)
-{
-	*buf++ = hex_asc_hi(byte);
-	*buf++ = hex_asc_lo(byte);
-	return buf;
-}
-
 unsigned long simple_strtoul(const char *cp, char **endp,
 				unsigned int base)
 {
@@ -434,6 +423,17 @@
 }
 
 #ifdef CONFIG_CMD_NET
+static const char hex_asc[] = "0123456789abcdef";
+#define hex_asc_lo(x)	hex_asc[((x) & 0x0f)]
+#define hex_asc_hi(x)	hex_asc[((x) & 0xf0) >> 4]
+
+static inline char *pack_hex_byte(char *buf, u8 byte)
+{
+	*buf++ = hex_asc_hi(byte);
+	*buf++ = hex_asc_lo(byte);
+	return buf;
+}
+
 static char *mac_address_string(char *buf, char *end, u8 *addr, int field_width,
 				int precision, int flags)
 {