aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew R. Ochs <mrochs@linux.vnet.ibm.com>2016-09-02 16:40:20 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2016-09-14 12:47:03 -0400
commitf80132613d576e7e705344d0c33f3b5e65d9e16a (patch)
tree2f6fd2ff16de3a36ab85cdc0b14785b8765fa603
parent05dab43230fdc0d14ca885b473a2740fe017ecb1 (diff)
scsi: cxlflash: Refactor WWPN setup
Commit 964497b3bf3f ("cxlflash: Remove dual port online dependency") logically removed the ability for the WWPN setup routine afu_set_wwpn() to return a non-success value. This routine can safely be made a void to simplify the code as there is no longer a need to report a failure. Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Acked-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/cxlflash/main.c40
1 files changed, 9 insertions, 31 deletions
diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
index 42970a40d49b..b301655f91cd 100644
--- a/drivers/scsi/cxlflash/main.c
+++ b/drivers/scsi/cxlflash/main.c
@@ -1093,42 +1093,25 @@ static int wait_port_offline(__be64 __iomem *fc_regs, u32 delay_us, u32 nretry)
1093 * online. This toggling action can cause this routine to delay up to a few 1093 * online. This toggling action can cause this routine to delay up to a few
1094 * seconds. When configured to use the internal LUN feature of the AFU, a 1094 * seconds. When configured to use the internal LUN feature of the AFU, a
1095 * failure to come online is overridden. 1095 * failure to come online is overridden.
1096 *
1097 * Return:
1098 * 0 when the WWPN is successfully written and the port comes back online
1099 * -1 when the port fails to go offline or come back up online
1100 */ 1096 */
1101static int afu_set_wwpn(struct afu *afu, int port, __be64 __iomem *fc_regs, 1097static void afu_set_wwpn(struct afu *afu, int port, __be64 __iomem *fc_regs,
1102 u64 wwpn) 1098 u64 wwpn)
1103{ 1099{
1104 int rc = 0;
1105
1106 set_port_offline(fc_regs); 1100 set_port_offline(fc_regs);
1107
1108 if (!wait_port_offline(fc_regs, FC_PORT_STATUS_RETRY_INTERVAL_US, 1101 if (!wait_port_offline(fc_regs, FC_PORT_STATUS_RETRY_INTERVAL_US,
1109 FC_PORT_STATUS_RETRY_CNT)) { 1102 FC_PORT_STATUS_RETRY_CNT)) {
1110 pr_debug("%s: wait on port %d to go offline timed out\n", 1103 pr_debug("%s: wait on port %d to go offline timed out\n",
1111 __func__, port); 1104 __func__, port);
1112 rc = -1; /* but continue on to leave the port back online */
1113 } 1105 }
1114 1106
1115 if (rc == 0) 1107 writeq_be(wwpn, &fc_regs[FC_PNAME / 8]);
1116 writeq_be(wwpn, &fc_regs[FC_PNAME / 8]);
1117
1118 /* Always return success after programming WWPN */
1119 rc = 0;
1120 1108
1121 set_port_online(fc_regs); 1109 set_port_online(fc_regs);
1122
1123 if (!wait_port_online(fc_regs, FC_PORT_STATUS_RETRY_INTERVAL_US, 1110 if (!wait_port_online(fc_regs, FC_PORT_STATUS_RETRY_INTERVAL_US,
1124 FC_PORT_STATUS_RETRY_CNT)) { 1111 FC_PORT_STATUS_RETRY_CNT)) {
1125 pr_err("%s: wait on port %d to go online timed out\n", 1112 pr_debug("%s: wait on port %d to go online timed out\n",
1126 __func__, port); 1113 __func__, port);
1127 } 1114 }
1128
1129 pr_debug("%s: returning rc=%d\n", __func__, rc);
1130
1131 return rc;
1132} 1115}
1133 1116
1134/** 1117/**
@@ -1629,15 +1612,10 @@ static int init_global(struct cxlflash_cfg *cfg)
1629 [FC_CRC_THRESH / 8]); 1612 [FC_CRC_THRESH / 8]);
1630 1613
1631 /* Set WWPNs. If already programmed, wwpn[i] is 0 */ 1614 /* Set WWPNs. If already programmed, wwpn[i] is 0 */
1632 if (wwpn[i] != 0 && 1615 if (wwpn[i] != 0)
1633 afu_set_wwpn(afu, i, 1616 afu_set_wwpn(afu, i,
1634 &afu->afu_map->global.fc_regs[i][0], 1617 &afu->afu_map->global.fc_regs[i][0],
1635 wwpn[i])) { 1618 wwpn[i]);
1636 dev_err(dev, "%s: failed to set WWPN on port %d\n",
1637 __func__, i);
1638 rc = -EIO;
1639 goto out;
1640 }
1641 /* Programming WWPN back to back causes additional 1619 /* Programming WWPN back to back causes additional
1642 * offline/online transitions and a PLOGI 1620 * offline/online transitions and a PLOGI
1643 */ 1621 */