From kaneshige.kenji@jp.fujitsu.com Wed Nov 23 20:48:14 2005 Message-ID: <43854511.9060405@jp.fujitsu.com> Date: Thu, 24 Nov 2005 13:44:01 +0900 From: Kenji Kaneshige To: Greg KH , CC: Kenji Kaneshige Subject: shpchp: fix improper reference to Slot Avail Regsister The hpc_get_max_bus_speed() function of the SHPCHP driver seems to refer wrong bits in the "Slot Avail Register I" and "Slot Avail Register II". This patch fixes this bug. And this also cleanup the code. Signed-off-by: Kenji Kaneshige Signed-off-by: Greg Kroah-Hartman --- drivers/pci/hotplug/shpchp_hpc.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) --- gregkh-2.6.orig/drivers/pci/hotplug/shpchp_hpc.c +++ gregkh-2.6/drivers/pci/hotplug/shpchp_hpc.c @@ -1121,7 +1121,6 @@ static int hpc_get_max_bus_speed (struct int retval = 0; u8 pi; u32 slot_avail1, slot_avail2; - int slot_num; DBG_ENTER_ROUTINE @@ -1140,39 +1139,39 @@ static int hpc_get_max_bus_speed (struct slot_avail2 = readl(php_ctlr->creg + SLOT_AVAIL2); if (pi == 2) { - if ((slot_num = ((slot_avail2 & SLOT_133MHZ_PCIX_533) >> 27) ) != 0 ) + if (slot_avail2 & SLOT_133MHZ_PCIX_533) bus_speed = PCIX_133MHZ_533; - else if ((slot_num = ((slot_avail2 & SLOT_100MHZ_PCIX_533) >> 23) ) != 0 ) + else if (slot_avail2 & SLOT_100MHZ_PCIX_533) bus_speed = PCIX_100MHZ_533; - else if ((slot_num = ((slot_avail2 & SLOT_66MHZ_PCIX_533) >> 19) ) != 0 ) + else if (slot_avail2 & SLOT_66MHZ_PCIX_533) bus_speed = PCIX_66MHZ_533; - else if ((slot_num = ((slot_avail2 & SLOT_133MHZ_PCIX_266) >> 15) ) != 0 ) + else if (slot_avail2 & SLOT_133MHZ_PCIX_266) bus_speed = PCIX_133MHZ_266; - else if ((slot_num = ((slot_avail2 & SLOT_100MHZ_PCIX_266) >> 11) ) != 0 ) + else if (slot_avail2 & SLOT_100MHZ_PCIX_266) bus_speed = PCIX_100MHZ_266; - else if ((slot_num = ((slot_avail2 & SLOT_66MHZ_PCIX_266) >> 7) ) != 0 ) + else if (slot_avail2 & SLOT_66MHZ_PCIX_266) bus_speed = PCIX_66MHZ_266; - else if ((slot_num = ((slot_avail1 & SLOT_133MHZ_PCIX) >> 23) ) != 0 ) + else if (slot_avail1 & SLOT_133MHZ_PCIX) bus_speed = PCIX_133MHZ; - else if ((slot_num = ((slot_avail1 & SLOT_100MHZ_PCIX) >> 15) ) != 0 ) + else if (slot_avail1 & SLOT_100MHZ_PCIX) bus_speed = PCIX_100MHZ; - else if ((slot_num = ((slot_avail1 & SLOT_66MHZ_PCIX) >> 7) ) != 0 ) + else if (slot_avail1 & SLOT_66MHZ_PCIX) bus_speed = PCIX_66MHZ; - else if ((slot_num = (slot_avail2 & SLOT_66MHZ)) != 0 ) + else if (slot_avail2 & SLOT_66MHZ) bus_speed = PCI_66MHZ; - else if ((slot_num = (slot_avail1 & SLOT_33MHZ)) != 0 ) + else if (slot_avail1 & SLOT_33MHZ) bus_speed = PCI_33MHZ; else bus_speed = PCI_SPEED_UNKNOWN; } else { - if ((slot_num = ((slot_avail1 & SLOT_133MHZ_PCIX) >> 23) ) != 0 ) + if (slot_avail1 & SLOT_133MHZ_PCIX) bus_speed = PCIX_133MHZ; - else if ((slot_num = ((slot_avail1 & SLOT_100MHZ_PCIX) >> 15) ) != 0 ) + else if (slot_avail1 & SLOT_100MHZ_PCIX) bus_speed = PCIX_100MHZ; - else if ((slot_num = ((slot_avail1 & SLOT_66MHZ_PCIX) >> 7) ) != 0 ) + else if (slot_avail1 & SLOT_66MHZ_PCIX) bus_speed = PCIX_66MHZ; - else if ((slot_num = (slot_avail2 & SLOT_66MHZ)) != 0 ) + else if (slot_avail2 & SLOT_66MHZ) bus_speed = PCI_66MHZ; - else if ((slot_num = (slot_avail1 & SLOT_33MHZ)) != 0 ) + else if (slot_avail1 & SLOT_33MHZ) bus_speed = PCI_33MHZ; else bus_speed = PCI_SPEED_UNKNOWN; }