[PATCH 2/2] IB/hfi1: Cleanup PCIe speed link configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



IB/hfi1 used duplicated magic numbers. Clean this up by replacing magic
numbers with extract_speed() function. No functional change intended.

Signed-off-by: Frederick Lawler <fred@xxxxxxxxxxxx>
---
 drivers/infiniband/hw/hfi1/pcie.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/pcie.c b/drivers/infiniband/hw/hfi1/pcie.c
index 2e8f686..8227032 100644
--- a/drivers/infiniband/hw/hfi1/pcie.c
+++ b/drivers/infiniband/hw/hfi1/pcie.c
@@ -1041,19 +1041,18 @@ int do_pcie_gen3_transition(struct hfi1_devdata *dd)
 
 	if (pcie_target == 1) {			/* target Gen1 */
 		target_vector = PCI_EXP_LINKSTA_CLS_2_5GB;
-		target_speed = 2500;
 	} else if (pcie_target == 2) {		/* target Gen2 */
 		target_vector = PCI_EXP_LINKSTA_CLS_5_0GB;
-		target_speed = 5000;
 	} else if (pcie_target == 3) {		/* target Gen3 */
 		target_vector = PCI_EXP_LINKSTA_CLS_8_0GB;
-		target_speed = 8000;
 	} else {
 		/* off or invalid target - skip */
 		dd_dev_info(dd, "%s: Skipping PCIe transition\n", __func__);
 		return 0;
 	}
 
+	target_speed = extract_speed(target_vector);
+
 	/* if already at target speed, done (unless forced) */
 	if (dd->lbus_speed == target_speed) {
 		dd_dev_info(dd, "%s: PCIe already at gen%d, %s\n", __func__,
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux