
From: Ralf Baechle <ralf@linux-mips.org>

 o Handle big and little endian configurations in PCI code
 o Get rid of superfluous bug checks
 o The usual cleanups of spinlock definitions

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/mips/pci/ops-tx4927.c                                 |   50 +++++-----
 25-akpm/arch/mips/tx4927/common/tx4927_irq.c                       |    4 
 25-akpm/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c   |    4 
 25-akpm/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c |    4 
 4 files changed, 31 insertions(+), 31 deletions(-)

diff -puN arch/mips/pci/ops-tx4927.c~mips-tx49-updates arch/mips/pci/ops-tx4927.c
--- 25/arch/mips/pci/ops-tx4927.c~mips-tx49-updates	2005-01-29 11:25:58.114034632 -0800
+++ 25-akpm/arch/mips/pci/ops-tx4927.c	2005-01-29 11:25:58.124033112 -0800
@@ -42,8 +42,8 @@
 #include <linux/init.h>
 
 #include <asm/addrspace.h>
+#include <asm/byteorder.h>
 #include <asm/tx4927/tx4927_pci.h>
-#include <asm/debug.h>
 
 /* initialize in setup */
 struct resource pci_io_resource = {
@@ -107,16 +107,6 @@ static int tx4927_pcibios_read_config(st
         dev = PCI_SLOT(devfn);
         func = PCI_FUNC(devfn);
 
-	if (size == 2) {
-		if (where & 1)
-	                return PCIBIOS_BAD_REGISTER_NUMBER;
-	}
-
-	if (size == 4) {
-		if (where & 3)
-			return PCIBIOS_BAD_REGISTER_NUMBER;
-	}
-
 	/* check if the bus is top-level */
 	if (bus->parent != NULL) {
 		busno = bus->number;
@@ -130,11 +120,21 @@ static int tx4927_pcibios_read_config(st
 	switch (size) {
 	case 1:
 		*val = *(volatile u8 *) ((ulong) & tx4927_pcicptr->
-                              g2pcfgdata | (where & 3));
+                              g2pcfgdata |
+#ifdef __LITTLE_ENDIAN
+						(where & 3));
+#else
+						((where & 0x3) ^ 0x3));
+#endif
 		break;
 	case 2:
 		*val = *(volatile u16 *) ((ulong) & tx4927_pcicptr->
-                               g2pcfgdata | (where & 3));
+                               g2pcfgdata |
+#ifdef __LITTLE_ENDIAN
+						(where & 3));
+#else
+						((where & 0x3) ^ 0x2));
+#endif
 		break;
 	case 4:
 		*val = tx4927_pcicptr->g2pcfgdata;
@@ -156,16 +156,6 @@ static int tx4927_pcibios_write_config(s
         dev = PCI_SLOT(devfn);
         func = PCI_FUNC(devfn);
 
-	if (size == 1) {
-		if (where & 1)
-			return PCIBIOS_BAD_REGISTER_NUMBER;
-	}
-
-	if (size == 4) {
-		if (where & 3)
-			return PCIBIOS_BAD_REGISTER_NUMBER;
-	}
-
 	/* check if the bus is top-level */
 	if (bus->parent != NULL) {
 		busno = bus->number;
@@ -179,12 +169,22 @@ static int tx4927_pcibios_write_config(s
 	switch (size) {
 	case 1:
 		 *(volatile u8 *) ((ulong) & tx4927_pcicptr->
-                          g2pcfgdata | (where & 3)) = val;
+                          g2pcfgdata |
+#ifdef __LITTLE_ENDIAN
+					(where & 3)) = val;
+#else
+					((where & 0x3) ^ 0x3)) = val;
+#endif
 		break;
 
 	case 2:
 		*(volatile u16 *) ((ulong) & tx4927_pcicptr->
-                           g2pcfgdata | (where & 3)) = val;
+                           g2pcfgdata |
+#ifdef __LITTLE_ENDIAN
+					(where & 3)) = val;
+#else
+					((where & 0x3) ^ 0x2)) = val;
+#endif
 		break;
 	case 4:
 		tx4927_pcicptr->g2pcfgdata = val;
diff -puN arch/mips/tx4927/common/tx4927_irq.c~mips-tx49-updates arch/mips/tx4927/common/tx4927_irq.c
--- 25/arch/mips/tx4927/common/tx4927_irq.c~mips-tx49-updates	2005-01-29 11:25:58.115034480 -0800
+++ 25-akpm/arch/mips/tx4927/common/tx4927_irq.c	2005-01-29 11:25:58.122033416 -0800
@@ -143,8 +143,8 @@ static void tx4927_irq_pic_end(unsigned 
  * Kernel structs for all pic's
  */
 
-static spinlock_t tx4927_cp0_lock = SPIN_LOCK_UNLOCKED;
-static spinlock_t tx4927_pic_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(tx4927_cp0_lock);
+static DEFINE_SPINLOCK(tx4927_pic_lock);
 
 #define TX4927_CP0_NAME "TX4927-CP0"
 static struct hw_interrupt_type tx4927_irq_cp0_type = {
diff -puN arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c~mips-tx49-updates arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
--- 25/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c~mips-tx49-updates	2005-01-29 11:25:58.117034176 -0800
+++ 25-akpm/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c	2005-01-29 11:25:58.123033264 -0800
@@ -248,7 +248,7 @@ static void toshiba_rbtx4927_irq_isa_mas
 static void toshiba_rbtx4927_irq_isa_end(unsigned int irq);
 #endif
 
-static spinlock_t toshiba_rbtx4927_ioc_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(toshiba_rbtx4927_ioc_lock);
 
 
 #define TOSHIBA_RBTX4927_IOC_NAME "RBTX4927-IOC"
@@ -669,7 +669,7 @@ void __init arch_init_irq(void)
 {
 	extern void tx4927_irq_init(void);
 
-	cli();
+	local_irq_disable();
 
 	tx4927_irq_init();
 	toshiba_rbtx4927_irq_ioc_init();
diff -puN arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c~mips-tx49-updates arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
--- 25/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c~mips-tx49-updates	2005-01-29 11:25:58.118034024 -0800
+++ 25-akpm/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c	2005-01-29 11:25:58.124033112 -0800
@@ -727,7 +727,7 @@ void toshiba_rbtx4927_restart(char *comm
 	reg_wr08(RBTX4927_SW_RESET_DO, RBTX4927_SW_RESET_DO_SET);
 
 	/* do something passive while waiting for reset */
-	cli();
+	local_irq_disable();
 	while (1)
 		asm_wait();
 
@@ -738,7 +738,7 @@ void toshiba_rbtx4927_restart(char *comm
 void toshiba_rbtx4927_halt(void)
 {
 	printk(KERN_NOTICE "System Halted\n");
-	cli();
+	local_irq_disable();
 	while (1) {
 		asm_wait();
 	}
_
