[PATCH v5 17/34] cxlflash: Remove dual port online dependency

2015-10-01 Thread Matthew R. Ochs
At present, both ports must be online for the device to
configure properly. Remove this dependency and the unnecessary
internal LUN override logic as well. Additionally, as a refactoring
measure, change the return code variable name to match that used
throughout the driver.

With this change, the card will be able to configure even when the
link is down. At some later point when the link is transitioned to
'up', a link state change interrupt will trigger the port configuration.
Note that despite its void-like behavior, the function was left with a
return code for right now in case its behavior needs to be altered again
in the near future based on testing.

Signed-off-by: Matthew R. Ochs 
Signed-off-by: Manoj N. Kumar 
Reviewed-by: Brian King 
---
 drivers/scsi/cxlflash/main.c | 27 ++-
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
index ed9fd8c..c25efc3 100644
--- a/drivers/scsi/cxlflash/main.c
+++ b/drivers/scsi/cxlflash/main.c
@@ -1030,7 +1030,7 @@ static int wait_port_offline(u64 *fc_regs, u32 delay_us, 
u32 nretry)
  */
 static int afu_set_wwpn(struct afu *afu, int port, u64 *fc_regs, u64 wwpn)
 {
-   int ret = 0;
+   int rc = 0;
 
set_port_offline(fc_regs);
 
@@ -1038,33 +1038,26 @@ static int afu_set_wwpn(struct afu *afu, int port, u64 
*fc_regs, u64 wwpn)
   FC_PORT_STATUS_RETRY_CNT)) {
pr_debug("%s: wait on port %d to go offline timed out\n",
 __func__, port);
-   ret = -1; /* but continue on to leave the port back online */
+   rc = -1; /* but continue on to leave the port back online */
}
 
-   if (ret == 0)
+   if (rc == 0)
writeq_be(wwpn, _regs[FC_PNAME / 8]);
 
+   /* Always return success after programming WWPN */
+   rc = 0;
+
set_port_online(fc_regs);
 
if (!wait_port_online(fc_regs, FC_PORT_STATUS_RETRY_INTERVAL_US,
  FC_PORT_STATUS_RETRY_CNT)) {
-   pr_debug("%s: wait on port %d to go online timed out\n",
-__func__, port);
-   ret = -1;
-
-   /*
-* Override for internal lun!!!
-*/
-   if (afu->internal_lun) {
-   pr_debug("%s: Overriding port %d online timeout!!!\n",
-__func__, port);
-   ret = 0;
-   }
+   pr_err("%s: wait on port %d to go online timed out\n",
+  __func__, port);
}
 
-   pr_debug("%s: returning rc=%d\n", __func__, ret);
+   pr_debug("%s: returning rc=%d\n", __func__, rc);
 
-   return ret;
+   return rc;
 }
 
 /**
-- 
2.1.0

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v5 17/34] cxlflash: Remove dual port online dependency

2015-10-01 Thread Daniel Axtens
"Matthew R. Ochs"  writes:

> At present, both ports must be online for the device to
> configure properly. Remove this dependency and the unnecessary
> internal LUN override logic as well. Additionally, as a refactoring
> measure, change the return code variable name to match that used
> throughout the driver.
>
> With this change, the card will be able to configure even when the
> link is down. At some later point when the link is transitioned to
> 'up', a link state change interrupt will trigger the port configuration.
> Note that despite its void-like behavior, the function was left with a
> return code for right now in case its behavior needs to be altered again
> in the near future based on testing.
>

Thanks for updating that.

Reviewed-by: Daniel Axtens 

Regards,
Daniel

> Signed-off-by: Matthew R. Ochs 
> Signed-off-by: Manoj N. Kumar 
> Reviewed-by: Brian King 
> ---
>  drivers/scsi/cxlflash/main.c | 27 ++-
>  1 file changed, 10 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
> index ed9fd8c..c25efc3 100644
> --- a/drivers/scsi/cxlflash/main.c
> +++ b/drivers/scsi/cxlflash/main.c
> @@ -1030,7 +1030,7 @@ static int wait_port_offline(u64 *fc_regs, u32 
> delay_us, u32 nretry)
>   */
>  static int afu_set_wwpn(struct afu *afu, int port, u64 *fc_regs, u64 wwpn)
>  {
> - int ret = 0;
> + int rc = 0;
>  
>   set_port_offline(fc_regs);
>  
> @@ -1038,33 +1038,26 @@ static int afu_set_wwpn(struct afu *afu, int port, 
> u64 *fc_regs, u64 wwpn)
>  FC_PORT_STATUS_RETRY_CNT)) {
>   pr_debug("%s: wait on port %d to go offline timed out\n",
>__func__, port);
> - ret = -1; /* but continue on to leave the port back online */
> + rc = -1; /* but continue on to leave the port back online */
>   }
>  
> - if (ret == 0)
> + if (rc == 0)
>   writeq_be(wwpn, _regs[FC_PNAME / 8]);
>  
> + /* Always return success after programming WWPN */
> + rc = 0;
> +
>   set_port_online(fc_regs);
>  
>   if (!wait_port_online(fc_regs, FC_PORT_STATUS_RETRY_INTERVAL_US,
> FC_PORT_STATUS_RETRY_CNT)) {
> - pr_debug("%s: wait on port %d to go online timed out\n",
> -  __func__, port);
> - ret = -1;
> -
> - /*
> -  * Override for internal lun!!!
> -  */
> - if (afu->internal_lun) {
> - pr_debug("%s: Overriding port %d online timeout!!!\n",
> -  __func__, port);
> - ret = 0;
> - }
> + pr_err("%s: wait on port %d to go online timed out\n",
> +__func__, port);
>   }
>  
> - pr_debug("%s: returning rc=%d\n", __func__, ret);
> + pr_debug("%s: returning rc=%d\n", __func__, rc);
>  
> - return ret;
> + return rc;
>  }
>  
>  /**
> -- 
> 2.1.0
>
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev


signature.asc
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev