* Patch by Matthew S. McClintock, 14 Apr 2004:
  fix initdram function for utx8245 board

* Patch by Markus Pietrek, 14 Apr 2004:
  use ATAG_INITRD2 instead of deprecated ATAG_INITRD tag

* Patch by Reinhard Meyer, 18 Apr 2004:
  provide the IDE Reset Function for EMK 5200 boards

* Patch by Masami Komiya, 12 Apr 2004:
  fix pci_hose_write_config_{byte,word}_via_dword problems
diff --git a/drivers/pci.c b/drivers/pci.c
index 5a9dae4..b9dcc5b 100644
--- a/drivers/pci.c
+++ b/drivers/pci.c
@@ -103,14 +103,14 @@
 					     pci_dev_t dev, 		\
 					     int offset, type val)	\
 {									\
-	u32 val32, mask, ldata;						\
+	u32 val32, mask, ldata, shift;					\
 									\
 	if (pci_hose_read_config_dword(hose, dev, offset & 0xfc, &val32) < 0)\
 		return -1;						\
 									\
-	mask = val_mask;						\
-	ldata = (((unsigned long)val) & mask) << ((offset & (int)off_mask) * 8);\
-	mask <<= ((mask & (int)off_mask) * 8);				\
+	shift = ((offset & (int)off_mask) * 8);				\
+	ldata = (((unsigned long)val) & val_mask) << shift;		\
+	mask = val_mask << shift;					\
 	val32 = (val32 & ~mask) | ldata;				\
 									\
 	if (pci_hose_write_config_dword(hose, dev, offset & 0xfc, val32) < 0)\