powerpc, 8xx: Handle checkpatch errors and some of the warnings/checks

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Heiko Schocher <hs@denx.de>
diff --git a/arch/powerpc/cpu/mpc8xx/cpu.c b/arch/powerpc/cpu/mpc8xx/cpu.c
index 28cc182..5cfc8c1 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu.c
@@ -37,7 +37,7 @@
 static char *cpu_warning = "\n         " \
 	"*** Warning: CPU Core has Silicon Bugs -- Check the Errata ***";
 
-static int check_CPU (long clock, uint pvr, uint immr)
+static int check_CPU(long clock, uint pvr, uint immr)
 {
 	char *id_str =
 	NULL;
@@ -73,22 +73,25 @@
 			id_str =
 		"PC866x"; /* Unknown chip from MPC866 family */
 		break;
-	case 0x09000000: pre = 'M'; mid = suf = ""; m = 1;
+	case 0x09000000:
+		pre = 'M'; mid = suf = ""; m = 1;
 		if (id_str == NULL)
 			id_str = "PC885"; /* 870/875/880/885 */
 		break;
 
-	default: suf = NULL; break;
+	default:
+		suf = NULL;
+		break;
 	}
 
 	if (id_str == NULL)
 		id_str = "PC86x";	/* Unknown 86x chip */
 	if (suf)
-		printf ("%c%s%sZPnn%s", pre, id_str, mid, suf);
+		printf("%c%s%sZPnn%s", pre, id_str, mid, suf);
 	else
-		printf ("unknown M%s (0x%08x)", id_str, k);
+		printf("unknown M%s (0x%08x)", id_str, k);
 
-	printf (" at %s MHz: ", strmhz (buf, clock));
+	printf(" at %s MHz: ", strmhz(buf, clock));
 
 	print_size(checkicache(), " I-Cache ");
 	print_size(checkdcache(), " D-Cache");
@@ -97,64 +100,63 @@
 
 	out_be32(&immap->im_cpm.cp_fec.fec_addr_low, 0x12345678);
 	if (in_be32(&immap->im_cpm.cp_fec.fec_addr_low) == 0x12345678)
-		printf (" FEC present");
+		printf(" FEC present");
 
-	if (!m) {
-		puts (cpu_warning);
-	}
+	if (!m)
+		puts(cpu_warning);
 
-	putc ('\n');
+	putc('\n');
 
 	return 0;
 }
 
 /* ------------------------------------------------------------------------- */
 
-int checkcpu (void)
+int checkcpu(void)
 {
 	ulong clock = gd->cpu_clk;
-	uint immr = get_immr (0);	/* Return full IMMR contents */
-	uint pvr = get_pvr ();
+	uint immr = get_immr(0);	/* Return full IMMR contents */
+	uint pvr = get_pvr();
 
-	puts ("CPU:   ");
+	puts("CPU:   ");
 
-	return check_CPU (clock, pvr, immr);
+	return check_CPU(clock, pvr, immr);
 }
 
 /* ------------------------------------------------------------------------- */
 /* L1 i-cache                                                                */
 
-int checkicache (void)
+int checkicache(void)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	memctl8xx_t __iomem *memctl = &immap->im_memctl;
-	u32 cacheon = rd_ic_cst () & IDC_ENABLED;
+	u32 cacheon = rd_ic_cst() & IDC_ENABLED;
 	/* probe in flash memoryarea */
 	u32 k = in_be32(&memctl->memc_br0) & ~0x00007fff;
 	u32 m;
 	u32 lines = -1;
 
-	wr_ic_cst (IDC_UNALL);
-	wr_ic_cst (IDC_INVALL);
-	wr_ic_cst (IDC_DISABLE);
+	wr_ic_cst(IDC_UNALL);
+	wr_ic_cst(IDC_INVALL);
+	wr_ic_cst(IDC_DISABLE);
 	__asm__ volatile ("isync");
 
-	while (!((m = rd_ic_cst ()) & IDC_CERR2)) {
-		wr_ic_adr (k);
-		wr_ic_cst (IDC_LDLCK);
+	while (!((m = rd_ic_cst()) & IDC_CERR2)) {
+		wr_ic_adr(k);
+		wr_ic_cst(IDC_LDLCK);
 		__asm__ volatile ("isync");
 
 		lines++;
-		k += 0x10;				/* the number of bytes in a cacheline */
+		k += 0x10;	/* the number of bytes in a cacheline */
 	}
 
-	wr_ic_cst (IDC_UNALL);
-	wr_ic_cst (IDC_INVALL);
+	wr_ic_cst(IDC_UNALL);
+	wr_ic_cst(IDC_INVALL);
 
 	if (cacheon)
-		wr_ic_cst (IDC_ENABLE);
+		wr_ic_cst(IDC_ENABLE);
 	else
-		wr_ic_cst (IDC_DISABLE);
+		wr_ic_cst(IDC_DISABLE);
 
 	__asm__ volatile ("isync");
 
@@ -165,41 +167,41 @@
 /* L1 d-cache                                                                */
 /* call with cache disabled                                                  */
 
-int checkdcache (void)
+int checkdcache(void)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	memctl8xx_t __iomem *memctl = &immap->im_memctl;
-	u32 cacheon = rd_dc_cst () & IDC_ENABLED;
+	u32 cacheon = rd_dc_cst() & IDC_ENABLED;
 	/* probe in flash memoryarea */
 	u32 k = in_be32(&memctl->memc_br0) & ~0x00007fff;
 	u32 m;
 	u32 lines = -1;
 
-	wr_dc_cst (IDC_UNALL);
-	wr_dc_cst (IDC_INVALL);
-	wr_dc_cst (IDC_DISABLE);
+	wr_dc_cst(IDC_UNALL);
+	wr_dc_cst(IDC_INVALL);
+	wr_dc_cst(IDC_DISABLE);
 
-	while (!((m = rd_dc_cst ()) & IDC_CERR2)) {
-		wr_dc_adr (k);
-		wr_dc_cst (IDC_LDLCK);
+	while (!((m = rd_dc_cst()) & IDC_CERR2)) {
+		wr_dc_adr(k);
+		wr_dc_cst(IDC_LDLCK);
 		lines++;
 		k += 0x10;	/* the number of bytes in a cacheline */
 	}
 
-	wr_dc_cst (IDC_UNALL);
-	wr_dc_cst (IDC_INVALL);
+	wr_dc_cst(IDC_UNALL);
+	wr_dc_cst(IDC_INVALL);
 
 	if (cacheon)
-		wr_dc_cst (IDC_ENABLE);
+		wr_dc_cst(IDC_ENABLE);
 	else
-		wr_dc_cst (IDC_DISABLE);
+		wr_dc_cst(IDC_DISABLE);
 
 	return lines << 4;
 };
 
 /* ------------------------------------------------------------------------- */
 
-void upmconfig (uint upm, uint * table, uint size)
+void upmconfig(uint upm, uint *table, uint size)
 {
 	uint i;
 	uint addr = 0;
@@ -215,7 +217,7 @@
 
 /* ------------------------------------------------------------------------- */
 
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	ulong msr, addr;
 
@@ -226,10 +228,10 @@
 
 	/* Interrupts and MMU off */
 	__asm__ volatile ("mtspr    81, 0");
-	__asm__ volatile ("mfmsr    %0":"=r" (msr));
+	__asm__ volatile ("mfmsr    %0" : "=r" (msr));
 
 	msr &= ~0x1030;
-	__asm__ volatile ("mtmsr    %0"::"r" (msr));
+	__asm__ volatile ("mtmsr    %0" : : "r" (msr));
 
 	/*
 	 * Trying to execute the next instruction at a non-existing address
@@ -239,14 +241,15 @@
 	addr = CONFIG_SYS_RESET_ADDRESS;
 #else
 	/*
-	 * note: when CONFIG_SYS_MONITOR_BASE points to a RAM address, CONFIG_SYS_MONITOR_BASE
-	 * - sizeof (ulong) is usually a valid address. Better pick an address
-	 * known to be invalid on your system and assign it to CONFIG_SYS_RESET_ADDRESS.
+	 * note: when CONFIG_SYS_MONITOR_BASE points to a RAM address,
+	 * CONFIG_SYS_MONITOR_BASE - sizeof (ulong) is usually a valid address.
+	 * Better pick an address known to be invalid on your system and assign
+	 * it to CONFIG_SYS_RESET_ADDRESS.
 	 * "(ulong)-1" used to be a good choice for many systems...
 	 */
-	addr = CONFIG_SYS_MONITOR_BASE - sizeof (ulong);
+	addr = CONFIG_SYS_MONITOR_BASE - sizeof(ulong);
 #endif
-	((void (*)(void)) addr) ();
+	((void (*)(void)) addr)();
 	return 1;
 }
 
@@ -257,14 +260,14 @@
  *
  * See sections 14.2 and 14.6 of the User's Manual
  */
-unsigned long get_tbclk (void)
+unsigned long get_tbclk(void)
 {
-	uint immr = get_immr (0);	/* Return full IMMR contents */
+	uint immr = get_immr(0);	/* Return full IMMR contents */
 	immap_t __iomem *immap = (immap_t __iomem *)(immr & 0xFFFF0000);
 	ulong oscclk, factor, pll;
 
 	if (in_be32(&immap->im_clkrst.car_sccr) & SCCR_TBS)
-		return (gd->cpu_clk / 16);
+		return gd->cpu_clk / 16;
 
 	pll = in_be32(&immap->im_clkrst.car_plprcr);
 
@@ -281,28 +284,28 @@
 	 *	     (PDF + 1) * 2^S
 	 *
 	 */
-		factor = (PLPRCR_val(MFI) + PLPRCR_val(MFN)/(PLPRCR_val(MFD)+1))/
-			(PLPRCR_val(PDF)+1) / (1<<PLPRCR_val(S));
+	factor = (PLPRCR_val(MFI) + PLPRCR_val(MFN) / (PLPRCR_val(MFD) + 1)) /
+		 (PLPRCR_val(PDF) + 1) / (1 << PLPRCR_val(S));
 
 	oscclk = gd->cpu_clk / factor;
 
 	if ((in_be32(&immap->im_clkrst.car_sccr) & SCCR_RTSEL) == 0 ||
 	    factor > 2)
-		return (oscclk / 4);
+		return oscclk / 4;
 
-	return (oscclk / 16);
+	return oscclk / 16;
 }
 
 /* ------------------------------------------------------------------------- */
 
 #if defined(CONFIG_WATCHDOG)
-void watchdog_reset (void)
+void watchdog_reset(void)
 {
-	int re_enable = disable_interrupts ();
+	int re_enable = disable_interrupts();
 
 	reset_8xx_watchdog((immap_t __iomem *)CONFIG_SYS_IMMR);
 	if (re_enable)
-		enable_interrupts ();
+		enable_interrupts();
 }
 #endif /* CONFIG_WATCHDOG */
 
diff --git a/arch/powerpc/cpu/mpc8xx/cpu_init.c b/arch/powerpc/cpu/mpc8xx/cpu_init.c
index a51596a..b419edf 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu_init.c
@@ -29,7 +29,7 @@
 	out_be32(&immr->im_siu_conf.sc_sypcr, CONFIG_SYS_SYPCR);
 
 #if defined(CONFIG_WATCHDOG)
-	reset_8xx_watchdog (immr);
+	reset_8xx_watchdog(immr);
 #endif /* CONFIG_WATCHDOG */
 
 	/* SIUMCR - contains debug pin configuration (11-6) */
@@ -182,7 +182,7 @@
 /*
  * initialize higher level parts of CPU like timers
  */
-int cpu_init_r (void)
+int cpu_init_r(void)
 {
-	return (0);
+	return 0;
 }
diff --git a/arch/powerpc/cpu/mpc8xx/fdt.c b/arch/powerpc/cpu/mpc8xx/fdt.c
index 34d3647..88ee1c5 100644
--- a/arch/powerpc/cpu/mpc8xx/fdt.c
+++ b/arch/powerpc/cpu/mpc8xx/fdt.c
@@ -15,13 +15,13 @@
 void ft_cpu_setup(void *blob, bd_t *bd)
 {
 	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
-		"timebase-frequency", get_tbclk(), 1);
+			     "timebase-frequency", get_tbclk(), 1);
 	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
-		"bus-frequency", bd->bi_busfreq, 1);
+			     "bus-frequency", bd->bi_busfreq, 1);
 	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
-		"clock-frequency", bd->bi_intfreq, 1);
+			     "clock-frequency", bd->bi_intfreq, 1);
 	do_fixup_by_compat_u32(blob, "fsl,cpm-brg", "clock-frequency",
-		gd->arch.brg_clk, 1);
+			       gd->arch.brg_clk, 1);
 
 	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
 }
diff --git a/arch/powerpc/cpu/mpc8xx/fec.c b/arch/powerpc/cpu/mpc8xx/fec.c
index eaaea2d..f2ea0d1 100644
--- a/arch/powerpc/cpu/mpc8xx/fec.c
+++ b/arch/powerpc/cpu/mpc8xx/fec.c
@@ -102,7 +102,7 @@
 #define PKT_MAXBLR_SIZE		1520
 
 #ifdef __GNUC__
-static char txbuf[DBUF_LENGTH] __attribute__ ((aligned(8)));
+static char txbuf[DBUF_LENGTH] __aligned(8);
 #else
 #error txbuf must be aligned.
 #endif
@@ -117,28 +117,27 @@
   */
 
 struct common_buf_desc {
-    cbd_t rxbd[PKTBUFSRX];		/* Rx BD */
-    cbd_t txbd[TX_BUF_CNT];		/* Tx BD */
+	cbd_t rxbd[PKTBUFSRX];		/* Rx BD */
+	cbd_t txbd[TX_BUF_CNT];		/* Tx BD */
 };
 
 static struct common_buf_desc __iomem *rtx;
 
 static int fec_send(struct eth_device *dev, void *packet, int length);
-static int fec_recv(struct eth_device* dev);
-static int fec_init(struct eth_device* dev, bd_t * bd);
-static void fec_halt(struct eth_device* dev);
+static int fec_recv(struct eth_device *dev);
+static int fec_init(struct eth_device *dev, bd_t *bd);
+static void fec_halt(struct eth_device *dev);
 #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
 static void __mii_init(void);
 #endif
 
 int fec_initialize(bd_t *bis)
 {
-	struct eth_device* dev;
+	struct eth_device *dev;
 	struct ether_fcc_info_s *efis;
 	int             i;
 
 	for (i = 0; i < ARRAY_SIZE(ether_fcc_info); i++) {
-
 		dev = malloc(sizeof(*dev));
 		if (dev == NULL)
 			hang();
@@ -147,12 +146,11 @@
 
 		/* for FEC1 make sure that the name of the interface is the same
 		   as the old one for compatibility reasons */
-		if (i == 0) {
+		if (i == 0)
 			strcpy(dev->name, "FEC");
-		} else {
-			sprintf (dev->name, "FEC%d",
+		else
+			sprintf(dev->name, "FEC%d",
 				ether_fcc_info[i].ether_index + 1);
-		}
 
 		efis = &ether_fcc_info[i];
 
@@ -202,9 +200,8 @@
 		udelay(1);
 		j++;
 	}
-	if (j>=TOUT_LOOP) {
+	if (j >= TOUT_LOOP)
 		printf("TX not ready\n");
-	}
 
 	out_be32(&rtx->txbd[txIdx].cbd_bufaddr, (uint)packet);
 	out_be16(&rtx->txbd[txIdx].cbd_datlen, length);
@@ -221,9 +218,9 @@
 		udelay(1);
 		j++;
 	}
-	if (j>=TOUT_LOOP) {
+	if (j >= TOUT_LOOP)
 		printf("TX timeout\n");
-	}
+
 	/* return only status bits */;
 	rc = in_be16(&rtx->txbd[txIdx].cbd_sc) & BD_ENET_TX_STATS;
 
@@ -232,7 +229,7 @@
 	return rc;
 }
 
-static int fec_recv (struct eth_device *dev)
+static int fec_recv(struct eth_device *dev)
 {
 	struct ether_fcc_info_s *efis = dev->priv;
 	fec_t __iomem *fecp =
@@ -436,7 +433,6 @@
 
 #endif	/* CONFIG_ETHER_ON_FEC1 */
 	} else if (fecidx == 1) {
-
 #if defined(CONFIG_ETHER_ON_FEC2)
 
 #if defined(CONFIG_MPC885_FAMILY) /* MPC87x/88x have got 2 FECs and different pinout */
@@ -467,7 +463,6 @@
 #endif /* CONFIG_MPC885_FAMILY */
 
 #endif /* CONFIG_ETHER_ON_FEC2 */
-
 	}
 }
 
@@ -486,7 +481,7 @@
 	out_be32(&fecp->fec_ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_RESET);
 	for (i = 0; (in_be32(&fecp->fec_ecntrl) & FEC_ECNTRL_RESET) &&
 	     (i < FEC_RESET_DELAY); ++i)
-		udelay (1);
+		udelay(1);
 
 	if (i == FEC_RESET_DELAY)
 		return -1;
@@ -494,7 +489,7 @@
 	return 0;
 }
 
-static int fec_init (struct eth_device *dev, bd_t * bd)
+static int fec_init(struct eth_device *dev, bd_t *bd)
 {
 	struct ether_fcc_info_s *efis = dev->priv;
 	immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR;
@@ -512,7 +507,7 @@
 #endif
 
 	if (fec_reset(fecp) < 0)
-		printf ("FEC_RESET_DELAY timeout\n");
+		printf("FEC_RESET_DELAY timeout\n");
 
 	/* We use strictly polling mode only
 	 */
@@ -554,7 +549,7 @@
 	out_be32(&fecp->fec_r_hash, PKT_MAXBUF_SIZE);
 
 	/*
-	 * Setup Buffers and Buffer Desriptors
+	 * Setup Buffers and Buffer Descriptors
 	 */
 	rxIdx = 0;
 	txIdx = 0;
@@ -604,7 +599,7 @@
 	/*
 	 * Setup the pin configuration of the FEC
 	 */
-	fec_pin_init (efis->ether_index);
+	fec_pin_init(efis->ether_index);
 
 	rxIdx = 0;
 	txIdx = 0;
@@ -619,10 +614,10 @@
 		/*
 		 * wait for the PHY to wake up after reset
 		 */
-		efis->actual_phy_addr = mii_discover_phy (dev);
+		efis->actual_phy_addr = mii_discover_phy(dev);
 
 		if (efis->actual_phy_addr == -1) {
-			printf ("Unable to discover phy!\n");
+			printf("Unable to discover phy!\n");
 			return -1;
 		}
 #else
@@ -636,22 +631,20 @@
 	/*
 	 * adapt the RMII speed to the speed of the phy
 	 */
-	if (miiphy_speed (dev->name, efis->actual_phy_addr) == _100BASET) {
-		fec_100Mbps (dev);
-	} else {
-		fec_10Mbps (dev);
-	}
+	if (miiphy_speed(dev->name, efis->actual_phy_addr) == _100BASET)
+		fec_100Mbps(dev);
+	else
+		fec_10Mbps(dev);
 #endif
 
 #if defined(CONFIG_MII)
 	/*
 	 * adapt to the half/full speed settings
 	 */
-	if (miiphy_duplex (dev->name, efis->actual_phy_addr) == FULL) {
-		fec_full_duplex (dev);
-	} else {
-		fec_half_duplex (dev);
-	}
+	if (miiphy_duplex(dev->name, efis->actual_phy_addr) == FULL)
+		fec_full_duplex(dev);
+	else
+		fec_half_duplex(dev);
 #endif
 
 	/* And last, try to fill Rx Buffer Descriptors */
@@ -664,7 +657,7 @@
 }
 
 
-static void fec_halt(struct eth_device* dev)
+static void fec_halt(struct eth_device *dev)
 {
 	struct ether_fcc_info_s *efis = dev->priv;
 	fec_t __iomem *fecp =
@@ -686,10 +679,10 @@
 	out_be32(&fecp->fec_ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_RESET);
 	for (i = 0; (in_be32(&fecp->fec_ecntrl) & FEC_ECNTRL_RESET) &&
 	     (i < FEC_RESET_DELAY); ++i)
-		udelay (1);
+		udelay(1);
 
 	if (i == FEC_RESET_DELAY) {
-		printf ("FEC_RESET_DELAY timeout\n");
+		printf("FEC_RESET_DELAY timeout\n");
 		return;
 	}
 
@@ -744,7 +737,7 @@
 	}
 	mii_reply = in_be32(&ep->fec_mii_data);		/* result from phy */
 	out_be32(&ep->fec_ievent, FEC_ENET_MII);	/* clear MII complete */
-	return (mii_reply & 0xffff);		/* data read from phy */
+	return mii_reply & 0xffff;		/* data read from phy */
 }
 #endif
 
@@ -776,9 +769,9 @@
 			}
 		}
 	}
-	if (phyaddr < 0) {
+	if (phyaddr < 0)
 		printf("No PHY device found.\n");
-	}
+
 	return phyaddr;
 }
 #endif	/* CONFIG_SYS_DISCOVER_PHY */
@@ -796,7 +789,7 @@
 	fec_t __iomem *fecp = &immr->im_cpm.cp_fec;
 
 	if (fec_reset(fecp) < 0)
-		printf ("FEC_RESET_DELAY timeout\n");
+		printf("FEC_RESET_DELAY timeout\n");
 
 	/* We use strictly polling mode only
 	 */
@@ -811,7 +804,7 @@
 	out_be32(&fecp->fec_ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN);
 }
 
-void mii_init (void)
+void mii_init(void)
 {
 	int i;
 
diff --git a/arch/powerpc/cpu/mpc8xx/immap.c b/arch/powerpc/cpu/mpc8xx/immap.c
index 63cc664..6da0853 100644
--- a/arch/powerpc/cpu/mpc8xx/immap.c
+++ b/arch/powerpc/cpu/mpc8xx/immap.c
@@ -19,8 +19,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int
-do_siuinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_siuinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	sysconf8xx_t __iomem *sc = &immap->im_siu_conf;
@@ -37,8 +36,7 @@
 	return 0;
 }
 
-int
-do_memcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_memcinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	memctl8xx_t __iomem *memctl = &immap->im_memctl;
@@ -60,8 +58,7 @@
 	return 0;
 }
 
-int
-do_carinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_carinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	car8xx_t __iomem *car = &immap->im_clkrst;
@@ -74,8 +71,7 @@
 
 static int counter;
 
-static void
-header(void)
+static void header(void)
 {
 	char *data = "\
        --------------------------------        --------------------------------\
@@ -93,27 +89,27 @@
 		printf("%.79s\n", data);
 }
 
-static void binary (char *label, uint value, int nbits)
+static void binary(char *label, uint value, int nbits)
 {
 	uint mask = 1 << (nbits - 1);
 	int i, second = (counter++ % 2);
 
 	if (second)
-		putc (' ');
-	puts (label);
+		putc(' ');
+	puts(label);
 	for (i = 32 + 1; i != nbits; i--)
-		putc (' ');
+		putc(' ');
 
 	while (mask != 0) {
 		if (value & mask)
-			putc ('1');
+			putc('1');
 		else
-			putc ('0');
+			putc('0');
 		mask >>= 1;
 	}
 
 	if (second)
-		putc ('\n');
+		putc('\n');
 }
 
 #define PA_NBITS	16
@@ -123,8 +119,7 @@
 #define PC_NBITS	12
 #define PD_NBITS	13
 
-int
-do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_iopinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	iop8xx_t __iomem *iop = &immap->im_ioport;
@@ -132,7 +127,7 @@
 	uint __iomem *R;
 
 	counter = 0;
-	header ();
+	header();
 
 	/*
 	 * Ports A & B
@@ -149,7 +144,7 @@
 	binary("PA_DAT", in_be16(l++), PA_NBITS);
 	binary("PB_DAT", in_be32(R++), PB_NBITS);
 
-	header ();
+	header();
 
 	/*
 	 * Ports C & D
@@ -168,7 +163,7 @@
 	binary("PD_DAT", in_be16(r++), PD_NBITS);
 	binary("PC_INT", in_be16(l++), PC_NBITS);
 
-	header ();
+	header();
 	return 0;
 }
 
@@ -177,14 +172,13 @@
  * this needs a clean up for smaller tighter code
  * use *uint and set the address based on cmd + port
  */
-int
-do_iopset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_iopset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	uint rcode = 0;
 	iopin_t iopin;
-	static uint port = 0;
-	static uint pin = 0;
-	static uint value = 0;
+	static uint port;
+	static uint pin;
+	static uint value;
 	static enum {
 		DIR,
 		PAR,
@@ -195,7 +189,7 @@
 	} cmd = DAT;
 
 	if (argc != 5) {
-		puts ("iopset PORT PIN CMD VALUE\n");
+		puts("iopset PORT PIN CMD VALUE\n");
 		return 1;
 	}
 	port = argv[1][0] - 'A';
@@ -203,7 +197,7 @@
 		port -= 0x20;
 	if (port > 3)
 		rcode = 1;
-	pin = simple_strtol (argv[2], NULL, 10);
+	pin = simple_strtol(argv[2], NULL, 10);
 	if (pin > 31)
 		rcode = 1;
 
@@ -230,7 +224,7 @@
 		cmd = INT;
 		break;
 	default:
-		printf ("iopset: unknown command %s\n", argv[3]);
+		printf("iopset: unknown command %s\n", argv[3]);
 		rcode = 1;
 	}
 	if (argv[4][0] == '1')
@@ -246,47 +240,46 @@
 		switch (cmd) {
 		case DIR:
 			if (value)
-				iopin_set_out (&iopin);
+				iopin_set_out(&iopin);
 			else
-				iopin_set_in (&iopin);
+				iopin_set_in(&iopin);
 			break;
 		case PAR:
 			if (value)
-				iopin_set_ded (&iopin);
+				iopin_set_ded(&iopin);
 			else
-				iopin_set_gen (&iopin);
+				iopin_set_gen(&iopin);
 			break;
 		case SOR:
 			if (value)
-				iopin_set_opt2 (&iopin);
+				iopin_set_opt2(&iopin);
 			else
-				iopin_set_opt1 (&iopin);
+				iopin_set_opt1(&iopin);
 			break;
 		case ODR:
 			if (value)
-				iopin_set_odr (&iopin);
+				iopin_set_odr(&iopin);
 			else
-				iopin_set_act (&iopin);
+				iopin_set_act(&iopin);
 			break;
 		case DAT:
 			if (value)
-				iopin_set_high (&iopin);
+				iopin_set_high(&iopin);
 			else
-				iopin_set_low (&iopin);
+				iopin_set_low(&iopin);
 			break;
 		case INT:
 			if (value)
-				iopin_set_falledge (&iopin);
+				iopin_set_falledge(&iopin);
 			else
-				iopin_set_anyedge (&iopin);
+				iopin_set_anyedge(&iopin);
 			break;
 		}
-
 	}
 	return rcode;
 }
 
-static void prbrg (int n, uint val)
+static void prbrg(int n, uint val)
 {
 	uint extc = (val >> 14) & 3;
 	uint cd = (val & CPM_BRG_CD_MASK) >> 1;
@@ -294,26 +287,26 @@
 
 	ulong clock = gd->cpu_clk;
 
-	printf ("BRG%d:", n);
+	printf("BRG%d:", n);
 
 	if (val & CPM_BRG_RST)
-		puts (" RESET");
+		puts(" RESET");
 	else
-		puts ("      ");
+		puts("      ");
 
 	if (val & CPM_BRG_EN)
-		puts ("  ENABLED");
+		puts("  ENABLED");
 	else
-		puts (" DISABLED");
+		puts(" DISABLED");
 
-	printf (" EXTC=%d", extc);
+	printf(" EXTC=%d", extc);
 
 	if (val & CPM_BRG_ATB)
-		puts (" ATB");
+		puts(" ATB");
 	else
-		puts ("    ");
+		puts("    ");
 
-	printf (" DIVIDER=%4d", cd);
+	printf(" DIVIDER=%4d", cd);
 	if (extc == 0 && cd != 0) {
 		uint baudrate;
 
@@ -322,21 +315,20 @@
 		else
 			baudrate = clock / (cd + 1);
 
-		printf ("=%6d bps", baudrate);
+		printf("=%6d bps", baudrate);
 	} else {
-		puts ("           ");
+		puts("           ");
 	}
 
 	if (val & CPM_BRG_DIV16)
-		puts (" DIV16");
+		puts(" DIV16");
 	else
-		puts ("      ");
+		puts("      ");
 
-	putc ('\n');
+	putc('\n');
 }
 
-int
-do_brginfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_brginfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	cpm8xx_t __iomem *cp = &immap->im_cpm;
diff --git a/arch/powerpc/cpu/mpc8xx/interrupts.c b/arch/powerpc/cpu/mpc8xx/interrupts.c
index db6df74..e8e287a 100644
--- a/arch/powerpc/cpu/mpc8xx/interrupts.c
+++ b/arch/powerpc/cpu/mpc8xx/interrupts.c
@@ -25,24 +25,24 @@
 static struct interrupt_action cpm_vecs[CPMVEC_NR];
 static struct interrupt_action irq_vecs[NR_IRQS];
 
-static void cpm_interrupt_init (void);
-static void cpm_interrupt (void *regs);
+static void cpm_interrupt_init(void);
+static void cpm_interrupt(void *regs);
 
 /************************************************************************/
 
-int interrupt_init_cpu (unsigned *decrementer_count)
+int interrupt_init_cpu(unsigned *decrementer_count)
 {
 	immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
-	*decrementer_count = get_tbclk () / CONFIG_SYS_HZ;
+	*decrementer_count = get_tbclk() / CONFIG_SYS_HZ;
 
 	/* disable all interrupts */
 	out_be32(&immr->im_siu_conf.sc_simask, 0);
 
 	/* Configure CPM interrupts */
-	cpm_interrupt_init ();
+	cpm_interrupt_init();
 
-	return (0);
+	return 0;
 }
 
 /************************************************************************/
@@ -50,7 +50,7 @@
 /*
  * Handle external interrupts
  */
-void external_interrupt (struct pt_regs *regs)
+void external_interrupt(struct pt_regs *regs)
 {
 	immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	int irq;
@@ -88,10 +88,10 @@
 	}
 
 	if (irq_vecs[irq].handler != NULL) {
-		irq_vecs[irq].handler (irq_vecs[irq].arg);
+		irq_vecs[irq].handler(irq_vecs[irq].arg);
 	} else {
-		printf ("\nBogus External Interrupt IRQ %d Vector %ld\n",
-				irq, vec);
+		printf("\nBogus External Interrupt IRQ %d Vector %ld\n",
+		       irq, vec);
 		/* turn off the bogus interrupt to avoid it from now */
 		simask &= ~v_bit;
 	}
@@ -106,7 +106,7 @@
 /*
  * CPM interrupt handler
  */
-static void cpm_interrupt (void *regs)
+static void cpm_interrupt(void *regs)
 {
 	immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	uint vec;
@@ -123,7 +123,7 @@
 		(*cpm_vecs[vec].handler) (cpm_vecs[vec].arg);
 	} else {
 		clrbits_be32(&immr->im_cpic.cpic_cimr, 1 << vec);
-		printf ("Masking bogus CPM interrupt vector 0x%x\n", vec);
+		printf("Masking bogus CPM interrupt vector 0x%x\n", vec);
 	}
 	/*
 	 * After servicing the interrupt,
@@ -138,7 +138,7 @@
  * to do is ACK it and return. This is a no-op function so we don't
  * need any special tests in the interrupt handler.
  */
-static void cpm_error_interrupt (void *dummy)
+static void cpm_error_interrupt(void *dummy)
 {
 }
 
@@ -146,37 +146,31 @@
 /*
  * Install and free an interrupt handler
  */
-void irq_install_handler (int vec, interrupt_handler_t * handler,
-						  void *arg)
+void irq_install_handler(int vec, interrupt_handler_t *handler, void *arg)
 {
 	immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
 	if ((vec & CPMVEC_OFFSET) != 0) {
 		/* CPM interrupt */
 		vec &= 0xffff;
-		if (cpm_vecs[vec].handler != NULL) {
-			printf ("CPM interrupt 0x%x replacing 0x%x\n",
-				(uint) handler,
-				(uint) cpm_vecs[vec].handler);
-		}
+		if (cpm_vecs[vec].handler != NULL)
+			printf("CPM interrupt 0x%x replacing 0x%x\n",
+			       (uint)handler, (uint)cpm_vecs[vec].handler);
 		cpm_vecs[vec].handler = handler;
 		cpm_vecs[vec].arg = arg;
 		setbits_be32(&immr->im_cpic.cpic_cimr, 1 << vec);
 	} else {
 		/* SIU interrupt */
-		if (irq_vecs[vec].handler != NULL) {
-			printf ("SIU interrupt %d 0x%x replacing 0x%x\n",
-				vec,
-				(uint) handler,
-				(uint) cpm_vecs[vec].handler);
-		}
+		if (irq_vecs[vec].handler != NULL)
+			printf("SIU interrupt %d 0x%x replacing 0x%x\n",
+			       vec, (uint)handler, (uint)cpm_vecs[vec].handler);
 		irq_vecs[vec].handler = handler;
 		irq_vecs[vec].arg = arg;
 		setbits_be32(&immr->im_siu_conf.sc_simask, 1 << (31 - vec));
 	}
 }
 
-void irq_free_handler (int vec)
+void irq_free_handler(int vec)
 {
 	immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -196,7 +190,7 @@
 
 /************************************************************************/
 
-static void cpm_interrupt_init (void)
+static void cpm_interrupt_init(void)
 {
 	immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	uint cicr;
@@ -214,14 +208,14 @@
 	/*
 	 * Install the error handler.
 	 */
-	irq_install_handler (CPMVEC_ERROR, cpm_error_interrupt, NULL);
+	irq_install_handler(CPMVEC_ERROR, cpm_error_interrupt, NULL);
 
 	setbits_be32(&immr->im_cpic.cpic_cicr, CICR_IEN);
 
 	/*
 	 * Install the cpm interrupt handler
 	 */
-	irq_install_handler (CPM_INTERRUPT, cpm_interrupt, NULL);
+	irq_install_handler(CPM_INTERRUPT, cpm_interrupt, NULL);
 }
 
 /************************************************************************/
@@ -231,7 +225,7 @@
  * with interrupts disabled.
  * Trivial implementation - no need to be really accurate.
  */
-void timer_interrupt_cpu (struct pt_regs *regs)
+void timer_interrupt_cpu(struct pt_regs *regs)
 {
 	immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
diff --git a/arch/powerpc/cpu/mpc8xx/reginfo.c b/arch/powerpc/cpu/mpc8xx/reginfo.c
index 48615ca..1ba4d22 100644
--- a/arch/powerpc/cpu/mpc8xx/reginfo.c
+++ b/arch/powerpc/cpu/mpc8xx/reginfo.c
@@ -20,7 +20,7 @@
 	 * other useful registers
 	 */
 
-	printf ("\nSystem Configuration registers\n"
+	printf("\nSystem Configuration registers\n"
 		"\tIMMR\t0x%08X\n", get_immr(0));
 
 	printf("\tSIUMCR\t0x%08X", in_be32(&sysconf->sc_siumcr));
diff --git a/arch/powerpc/cpu/mpc8xx/serial.c b/arch/powerpc/cpu/mpc8xx/serial.c
index 598ca2a..114dfe9 100644
--- a/arch/powerpc/cpu/mpc8xx/serial.c
+++ b/arch/powerpc/cpu/mpc8xx/serial.c
@@ -49,11 +49,11 @@
 
 static void serial_setdivisor(cpm8xx_t __iomem *cp)
 {
-	int divisor=(gd->cpu_clk + 8*gd->baudrate)/16/gd->baudrate;
+	int divisor = (gd->cpu_clk + 8 * gd->baudrate) / 16 / gd->baudrate;
 
-	if(divisor/16>0x1000) {
+	if (divisor / 16 > 0x1000) {
 		/* bad divisor, assume 50MHz clock and 9600 baud */
-		divisor=(50*1000*1000 + 8*9600)/16/9600;
+		divisor = (50 * 1000 * 1000 + 8 * 9600) / 16 / 9600;
 	}
 
 #ifdef CONFIG_SYS_BRGCLK_PRESCALE
@@ -72,7 +72,7 @@
  * as serial console interface.
  */
 
-static void smc_setbrg (void)
+static void smc_setbrg(void)
 {
 	immap_t __iomem *im = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	cpm8xx_t __iomem *cp = &(im->im_cpm);
@@ -88,7 +88,7 @@
 	serial_setdivisor(cp);
 }
 
-static int smc_init (void)
+static int smc_init(void)
 {
 	immap_t __iomem *im = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	smc_t __iomem *sp;
@@ -161,7 +161,7 @@
 	out_8(&sp->smc_smce, 0xff);
 
 	/* Set up the baud rate generator */
-	smc_setbrg ();
+	smc_setbrg();
 
 	/* Make the first buffer the only buffer. */
 	setbits_be16(&rtx->txbd.cbd_sc, BD_SC_WRAP);
@@ -185,18 +185,17 @@
 	/* Enable transmitter/receiver.	*/
 	setbits_be16(&sp->smc_smcmr, SMCMR_REN | SMCMR_TEN);
 
-	return (0);
+	return 0;
 }
 
-static void
-smc_putc(const char c)
+static void smc_putc(const char c)
 {
 	immap_t	__iomem *im = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	cpm8xx_t	__iomem *cpmp = &(im->im_cpm);
 	struct serialbuffer	__iomem *rtx;
 
 	if (c == '\n')
-		smc_putc ('\r');
+		smc_putc('\r');
 
 	rtx = (struct serialbuffer __iomem *)&cpmp->cp_dpmem[CPM_SERIAL_BASE];
 
@@ -206,19 +205,16 @@
 	setbits_be16(&rtx->txbd.cbd_sc, BD_SC_READY);
 
 	while (in_be16(&rtx->txbd.cbd_sc) & BD_SC_READY)
-		WATCHDOG_RESET ();
+		WATCHDOG_RESET();
 }
 
-static void
-smc_puts (const char *s)
+static void smc_puts(const char *s)
 {
-	while (*s) {
-		smc_putc (*s++);
-	}
+	while (*s)
+		smc_putc(*s++);
 }
 
-static int
-smc_getc(void)
+static int smc_getc(void)
 {
 	immap_t	__iomem *im = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	cpm8xx_t	__iomem *cpmp = &(im->im_cpm);
@@ -230,7 +226,7 @@
 
 	/* Wait for character to show up. */
 	while (in_be16(&rtx->rxbd.cbd_sc) & BD_SC_EMPTY)
-		WATCHDOG_RESET ();
+		WATCHDOG_RESET();
 
 	/* the characters are read one by one,
 	 * use the rxindex to know the next char to deliver
@@ -245,11 +241,10 @@
 		setbits_be16(&rtx->rxbd.cbd_sc, BD_SC_EMPTY);
 	}
 	out_be32(&rtx->rxindex, rxindex);
-	return(c);
+	return c;
 }
 
-static int
-smc_tstc(void)
+static int smc_tstc(void)
 {
 	immap_t	__iomem *im = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	cpm8xx_t	__iomem *cpmp = &(im->im_cpm);
@@ -260,8 +255,7 @@
 	return !(in_be16(&rtx->rxbd.cbd_sc) & BD_SC_EMPTY);
 }
 
-struct serial_device serial_smc_device =
-{
+struct serial_device serial_smc_device = {
 	.name	= "serial_smc",
 	.start	= smc_init,
 	.stop	= NULL,
diff --git a/arch/powerpc/cpu/mpc8xx/speed.c b/arch/powerpc/cpu/mpc8xx/speed.c
index c91427e..8d43eff 100644
--- a/arch/powerpc/cpu/mpc8xx/speed.c
+++ b/arch/powerpc/cpu/mpc8xx/speed.c
@@ -16,29 +16,29 @@
 {
 	uint divider = 0;
 
-	switch((sccr&SCCR_DFBRG11)>>11){
-		case 0:
-			divider = 1;
-			break;
-		case 1:
-			divider = 4;
-			break;
-		case 2:
-			divider = 16;
-			break;
-		case 3:
-			divider = 64;
-			break;
+	switch ((sccr & SCCR_DFBRG11) >> 11) {
+	case 0:
+		divider = 1;
+		break;
+	case 1:
+		divider = 4;
+		break;
+	case 2:
+		divider = 16;
+		break;
+	case 3:
+		divider = 64;
+		break;
 	}
-	gd->arch.brg_clk = gd->cpu_clk/divider;
+	gd->arch.brg_clk = gd->cpu_clk / divider;
 }
 
 /*
  * get_clocks() fills in gd->cpu_clock depending on CONFIG_8xx_GCLK_FREQ
  */
-int get_clocks (void)
+int get_clocks(void)
 {
-	uint immr = get_immr (0);	/* Return full IMMR contents */
+	uint immr = get_immr(0);	/* Return full IMMR contents */
 	immap_t __iomem *immap = (immap_t __iomem *)(immr & 0xFFFF0000);
 	uint sccr = in_be32(&immap->im_clkrst.car_sccr);
 	/*
@@ -59,5 +59,5 @@
 
 	get_brgclk(sccr);
 
-	return (0);
+	return 0;
 }
diff --git a/arch/powerpc/cpu/mpc8xx/spi.c b/arch/powerpc/cpu/mpc8xx/spi.c
index e7d197f..6e3e86f 100644
--- a/arch/powerpc/cpu/mpc8xx/spi.c
+++ b/arch/powerpc/cpu/mpc8xx/spi.c
@@ -50,11 +50,7 @@
 /* -------------------
  * Function prototypes
  * ------------------- */
-void spi_init (void);
-
-ssize_t spi_read (uchar *, int, uchar *, int);
-ssize_t spi_write (uchar *, int, uchar *, int);
-ssize_t spi_xfer (size_t);
+ssize_t spi_xfer(size_t);
 
 /* -------------------
  * Variables
@@ -66,10 +62,10 @@
  * Initially we place the RX and TX buffers at a fixed location in DPRAM!
  * ---------------------------------------------------------------------- */
 static uchar *rxbuf =
-  (uchar *)&((cpm8xx_t *)&((immap_t *)CONFIG_SYS_IMMR)->im_cpm)->cp_dpmem
+	(uchar *)&((cpm8xx_t *)&((immap_t *)CONFIG_SYS_IMMR)->im_cpm)->cp_dpmem
 			[CONFIG_SYS_SPI_INIT_OFFSET];
 static uchar *txbuf =
-  (uchar *)&((cpm8xx_t *)&((immap_t *)CONFIG_SYS_IMMR)->im_cpm)->cp_dpmem
+	(uchar *)&((cpm8xx_t *)&((immap_t *)CONFIG_SYS_IMMR)->im_cpm)->cp_dpmem
 			[CONFIG_SYS_SPI_INIT_OFFSET+MAX_BUFFER];
 
 /* **************************************************************************
@@ -81,7 +77,7 @@
  *  return:      ---
  *
  * *********************************************************************** */
-void spi_init_f (void)
+void spi_init_f(void)
 {
 	immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	cpm8xx_t __iomem *cp = &immr->im_cpm;
@@ -120,7 +116,7 @@
 	 * PBODR[28] = 1 [0x00000008] -> open drain: SPIMISO
 	 * PBODR[29] = 0 [0x00000004] -> active output SPIMOSI
 	 * PBODR[30] = 0 [0x00000002] -> active output: SPICLK
-	 * PBODR[31] = 0 [0x00000001] -> active output: GPIO OUT: CS for PCUE/CCM
+	 * PBODR[31] = 0 [0x00000001] -> active output GPIO OUT: CS for PCUE/CCM
 	 * ---------------------------------------------- */
 
 	clrsetbits_be16(&cp->cp_pbodr, 0x00000007, 0x00000008);
@@ -209,7 +205,7 @@
  *  return:      ---
  *
  * *********************************************************************** */
-void spi_init_r (void)
+void spi_init_r(void)
 {
 	immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	cpm8xx_t __iomem *cp = &immr->im_cpm;
@@ -224,8 +220,8 @@
 	rbdf = (cbd_t __iomem *)&cp->cp_dpmem[CPM_SPI_BASE_RX];
 
 	/* Allocate memory for RX and TX buffers */
-	rxbuf = (uchar *) malloc (MAX_BUFFER);
-	txbuf = (uchar *) malloc (MAX_BUFFER);
+	rxbuf = (uchar *)malloc(MAX_BUFFER);
+	txbuf = (uchar *)malloc(MAX_BUFFER);
 
 	out_be32(&rbdf->cbd_bufaddr, (ulong)rxbuf);
 	out_be32(&tbdf->cbd_bufaddr, (ulong)txbuf);
@@ -236,7 +232,7 @@
 /****************************************************************************
  *  Function:    spi_write
  **************************************************************************** */
-ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
+ssize_t spi_write(uchar *addr, int alen, uchar *buffer, int len)
 {
 	int i;
 
@@ -253,14 +249,12 @@
 		*txbuf = SPI_EEPROM_RDSR;	/* read status		*/
 		txbuf[1] = 0;
 		spi_xfer(2);
-		if (!(rxbuf[1] & 1)) {
+		if (!(rxbuf[1] & 1))
 			break;
-		}
 		udelay(1000);
 	}
-	if (i >= 1000) {
-		printf ("*** spi_write: Time out while writing!\n");
-	}
+	if (i >= 1000)
+		printf("*** spi_write: Time out while writing!\n");
 
 	return len;
 }
@@ -268,7 +262,7 @@
 /****************************************************************************
  *  Function:    spi_read
  **************************************************************************** */
-ssize_t spi_read (uchar *addr, int alen, uchar *buffer, int len)
+ssize_t spi_read(uchar *addr, int alen, uchar *buffer, int len)
 {
 	memset(rxbuf, 0, MAX_BUFFER);
 	memset(txbuf, 0, MAX_BUFFER);
@@ -290,7 +284,7 @@
 /****************************************************************************
  *  Function:    spi_xfer
  **************************************************************************** */
-ssize_t spi_xfer (size_t count)
+ssize_t spi_xfer(size_t count)
 {
 	immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	cpm8xx_t __iomem *cp = &immr->im_cpm;
@@ -327,16 +321,15 @@
 	 * Wait for SPI transmit to get out
 	 * or time out (1 second = 1000 ms)
 	 * -------------------------------- */
-	for (tm=0; tm<1000; ++tm) {
+	for (tm = 0; tm < 1000; ++tm) {
 		if (in_8(&cp->cp_spie) & SPI_TXB)	/* Tx Buffer Empty */
 			break;
 		if ((in_be16(&tbdf->cbd_sc) & BD_SC_READY) == 0)
 			break;
-		udelay (1000);
+		udelay(1000);
 	}
-	if (tm >= 1000) {
-		printf ("*** spi_xfer: Time out while xferring to/from SPI!\n");
-	}
+	if (tm >= 1000)
+		printf("*** spi_xfer: Time out while xferring to/from SPI!\n");
 
 	/* Clear CS for device */
 	setbits_be32(&cp->cp_pbdat, 0x0001);
diff --git a/arch/powerpc/cpu/mpc8xx/traps.c b/arch/powerpc/cpu/mpc8xx/traps.c
index ec283d8..8b8d617 100644
--- a/arch/powerpc/cpu/mpc8xx/traps.c
+++ b/arch/powerpc/cpu/mpc8xx/traps.c
@@ -45,7 +45,8 @@
 		if (cnt++ % 7 == 0)
 			printf("\n");
 		printf("%08lX ", i);
-		if (cnt > 32) break;
+		if (cnt > 32)
+			break;
 		sp = (unsigned long *)*sp;
 	}
 	printf("\n");
@@ -58,23 +59,19 @@
 	printf("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx DAR: %08lX\n",
 	       regs->nip, regs->xer, regs->link, regs, regs->trap, regs->dar);
 	printf("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
-	       regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
-	       regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
-	       regs->msr&MSR_IR ? 1 : 0,
-	       regs->msr&MSR_DR ? 1 : 0);
+	       regs->msr, regs->msr & MSR_EE ? 1 : 0,
+	       regs->msr & MSR_PR ? 1 : 0, regs->msr & MSR_FP ? 1 : 0,
+	       regs->msr & MSR_ME ? 1 : 0, regs->msr & MSR_IR ? 1 : 0,
+	       regs->msr & MSR_DR ? 1 : 0);
 
 	printf("\n");
 	for (i = 0;  i < 32;  i++) {
 		if ((i % 8) == 0)
-		{
 			printf("GPR%02d: ", i);
-		}
 
 		printf("%08lX ", regs->gpr[i]);
 		if ((i % 8) == 7)
-		{
 			printf("\n");
-		}
 	}
 }
 
@@ -83,37 +80,37 @@
 {
 	show_regs(regs);
 	print_backtrace((unsigned long *)regs->gpr[1]);
-	panic("Exception in kernel pc %lx signal %d",regs->nip,signr);
+	panic("Exception in kernel pc %lx signal %d", regs->nip, signr);
 }
 
 void MachineCheckException(struct pt_regs *regs)
 {
-	unsigned long fixup;
+	unsigned long fixup = search_exception_table(regs->nip);
 
 	/* Probing PCI using config cycles cause this exception
 	 * when a device is not present.  Catch it and return to
 	 * the PCI exception handler.
 	 */
-	if ((fixup = search_exception_table(regs->nip)) != 0) {
+	if (fixup != 0) {
 		regs->nip = fixup;
 		return;
 	}
 
 	printf("Machine check in kernel mode.\n");
 	printf("Caused by (from msr): ");
-	printf("regs %p ",regs);
-	switch( regs->msr & 0x000F0000) {
-	case (0x80000000>>12):
+	printf("regs %p ", regs);
+	switch (regs->msr & 0x000F0000) {
+	case (0x80000000 >> 12):
 		printf("Machine check signal - probably due to mm fault\n"
 			"with mmu off\n");
 		break;
-	case (0x80000000>>13):
+	case (0x80000000 >> 13):
 		printf("Transfer error ack signal\n");
 		break;
-	case (0x80000000>>14):
+	case (0x80000000 >> 14):
 		printf("Data parity signal\n");
 		break;
-	case (0x80000000>>15):
+	case (0x80000000 >> 15):
 		printf("Address parity signal\n");
 		break;
 	default:
@@ -155,8 +152,8 @@
 
 void DebugException(struct pt_regs *regs)
 {
-  printf("Debugger trap at @ %lx\n", regs->nip );
-  show_regs(regs);
+	printf("Debugger trap at @ %lx\n", regs->nip);
+	show_regs(regs);
 }
 
 /* Probe an address by reading.  If not present, return -1, otherwise
diff --git a/arch/powerpc/include/asm/iopin_8xx.h b/arch/powerpc/include/asm/iopin_8xx.h
index beca988..15679a2 100644
--- a/arch/powerpc/include/asm/iopin_8xx.h
+++ b/arch/powerpc/include/asm/iopin_8xx.h
@@ -27,8 +27,7 @@
 #define IOPIN_PORTC	2
 #define IOPIN_PORTD	3
 
-static __inline__ void
-iopin_set_high(iopin_t *iopin)
+static inline void iopin_set_high(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -51,8 +50,7 @@
 	}
 }
 
-static __inline__ void
-iopin_set_low(iopin_t *iopin)
+static inline void iopin_set_low(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -75,8 +73,7 @@
 	}
 }
 
-static __inline__ uint
-iopin_is_high(iopin_t *iopin)
+static inline uint iopin_is_high(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -100,8 +97,7 @@
 	return 0;
 }
 
-static __inline__ uint
-iopin_is_low(iopin_t *iopin)
+static inline uint iopin_is_low(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -125,8 +121,7 @@
 	return 0;
 }
 
-static __inline__ void
-iopin_set_out(iopin_t *iopin)
+static inline void iopin_set_out(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -149,8 +144,7 @@
 	}
 }
 
-static __inline__ void
-iopin_set_in(iopin_t *iopin)
+static inline void iopin_set_in(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -173,8 +167,7 @@
 	}
 }
 
-static __inline__ uint
-iopin_is_out(iopin_t *iopin)
+static inline uint iopin_is_out(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -198,8 +191,7 @@
 	return 0;
 }
 
-static __inline__ uint
-iopin_is_in(iopin_t *iopin)
+static inline uint iopin_is_in(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -223,8 +215,7 @@
 	return 0;
 }
 
-static __inline__ void
-iopin_set_odr(iopin_t *iopin)
+static inline void iopin_set_odr(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -239,8 +230,7 @@
 	}
 }
 
-static __inline__ void
-iopin_set_act(iopin_t *iopin)
+static inline void iopin_set_act(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -255,8 +245,7 @@
 	}
 }
 
-static __inline__ uint
-iopin_is_odr(iopin_t *iopin)
+static inline uint iopin_is_odr(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -272,8 +261,7 @@
 	return 0;
 }
 
-static __inline__ uint
-iopin_is_act(iopin_t *iopin)
+static inline uint iopin_is_act(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -289,8 +277,7 @@
 	return 0;
 }
 
-static __inline__ void
-iopin_set_ded(iopin_t *iopin)
+static inline void iopin_set_ded(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -313,8 +300,7 @@
 	}
 }
 
-static __inline__ void
-iopin_set_gen(iopin_t *iopin)
+static inline void iopin_set_gen(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -337,8 +323,7 @@
 	}
 }
 
-static __inline__ uint
-iopin_is_ded(iopin_t *iopin)
+static inline uint iopin_is_ded(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -362,8 +347,7 @@
 	return 0;
 }
 
-static __inline__ uint
-iopin_is_gen(iopin_t *iopin)
+static inline uint iopin_is_gen(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -387,8 +371,7 @@
 	return 0;
 }
 
-static __inline__ void
-iopin_set_opt2(iopin_t *iopin)
+static inline void iopin_set_opt2(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -399,8 +382,7 @@
 	}
 }
 
-static __inline__ void
-iopin_set_opt1(iopin_t *iopin)
+static inline void iopin_set_opt1(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -411,8 +393,7 @@
 	}
 }
 
-static __inline__ uint
-iopin_is_opt2(iopin_t *iopin)
+static inline uint iopin_is_opt2(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -424,8 +405,7 @@
 	return 0;
 }
 
-static __inline__ uint
-iopin_is_opt1(iopin_t *iopin)
+static inline uint iopin_is_opt1(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -437,8 +417,7 @@
 	return 0;
 }
 
-static __inline__ void
-iopin_set_falledge(iopin_t *iopin)
+static inline void iopin_set_falledge(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -449,8 +428,7 @@
 	}
 }
 
-static __inline__ void
-iopin_set_anyedge(iopin_t *iopin)
+static inline void iopin_set_anyedge(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -461,8 +439,7 @@
 	}
 }
 
-static __inline__ uint
-iopin_is_falledge(iopin_t *iopin)
+static inline uint iopin_is_falledge(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 
@@ -474,8 +451,7 @@
 	return 0;
 }
 
-static __inline__ uint
-iopin_is_anyedge(iopin_t *iopin)
+static inline uint iopin_is_anyedge(iopin_t *iopin)
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;