Re: [PATCH 2/9] fnic: host reset returns nonzero value(errno) on success

2013-09-11 Thread James Bottomley
On Mon, 2013-09-09 at 13:31 -0700, Hiral Patel wrote:
 From: Narsimhulu Musini nmus...@cisco.com
 
 Fixed appropriate error codes that returns -1 on failure, and 0 on success

This is about as undescriptive as they come.  What you mean is that
fnic_reset() is used directly by the fc transport callback
issue_fc_host_lip which requires a negative error number on failure.

I really don't think you want to be returning -1, though; that's -EPERM.

 Signed-off-by: Narsimhulu Musini nmus...@cisco.com
 Signed-off-by: Hiral Patel hiral...@cisco.com
 ---
  drivers/scsi/fnic/fnic_scsi.c |8 
  1 file changed, 4 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
 index a97e6e5..ef3c463 100644
 --- a/drivers/scsi/fnic/fnic_scsi.c
 +++ b/drivers/scsi/fnic/fnic_scsi.c
 @@ -2208,7 +2208,7 @@ int fnic_reset(struct Scsi_Host *shost)
  {
   struct fc_lport *lp;
   struct fnic *fnic;
 - int ret = SUCCESS;
 + int ret = 0;
  
   lp = shost_priv(shost);
   fnic = lport_priv(lp);
 @@ -2221,11 +2221,11 @@ int fnic_reset(struct Scsi_Host *shost)
* reset remote port sessions, and if link is up, begin flogi
*/
   if (lp-tt.lport_reset(lp))
 - ret = FAILED;
 + ret = -1;

tt.lport_reset can't actually fail anyway, but if it did, it would
return a negative error no, so why not just do

ret = lp-tt.lport_reset()

instead of the if?

James


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


[PATCH 2/9] fnic: host reset returns nonzero value(errno) on success

2013-09-09 Thread Hiral Patel
From: Narsimhulu Musini nmus...@cisco.com

Fixed appropriate error codes that returns -1 on failure, and 0 on success

Signed-off-by: Narsimhulu Musini nmus...@cisco.com
Signed-off-by: Hiral Patel hiral...@cisco.com
---
 drivers/scsi/fnic/fnic_scsi.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index a97e6e5..ef3c463 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -2208,7 +2208,7 @@ int fnic_reset(struct Scsi_Host *shost)
 {
struct fc_lport *lp;
struct fnic *fnic;
-   int ret = SUCCESS;
+   int ret = 0;
 
lp = shost_priv(shost);
fnic = lport_priv(lp);
@@ -2221,11 +2221,11 @@ int fnic_reset(struct Scsi_Host *shost)
 * reset remote port sessions, and if link is up, begin flogi
 */
if (lp-tt.lport_reset(lp))
-   ret = FAILED;
+   ret = -1;
 
FNIC_SCSI_DBG(KERN_DEBUG, fnic-lport-host,
  Returning from fnic reset %s\n,
- (ret == SUCCESS) ?
+ (ret == 0) ?
  SUCCESS : FAILED);
 
return ret;
@@ -2252,7 +2252,7 @@ int fnic_host_reset(struct scsi_cmnd *sc)
 * scsi-ml tries to send a TUR to every device if host reset is
 * successful, so before returning to scsi, fabric should be up
 */
-   ret = fnic_reset(shost);
+   ret = (fnic_reset(shost) == 0) ? SUCCESS : FAILED;
if (ret == SUCCESS) {
wait_host_tmo = jiffies + FNIC_HOST_RESET_SETTLE_TIME * HZ;
ret = FAILED;
-- 
1.7.10.4

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


[PATCH 2/9] fnic: host reset returns nonzero value(errno) on success

2013-08-29 Thread Hiral Patel
Fixed appropriate error codes that returns -1 on failure, and 0 on success

Signed-off-by: Narsimhulu Musini nmus...@cisco.com
Signed-off-by: Hiral Patel hiral...@cisco.com
---
 drivers/scsi/fnic/fnic_scsi.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index a97e6e5..ef3c463 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -2208,7 +2208,7 @@ int fnic_reset(struct Scsi_Host *shost)
 {
struct fc_lport *lp;
struct fnic *fnic;
-   int ret = SUCCESS;
+   int ret = 0;
 
lp = shost_priv(shost);
fnic = lport_priv(lp);
@@ -2221,11 +2221,11 @@ int fnic_reset(struct Scsi_Host *shost)
 * reset remote port sessions, and if link is up, begin flogi
 */
if (lp-tt.lport_reset(lp))
-   ret = FAILED;
+   ret = -1;
 
FNIC_SCSI_DBG(KERN_DEBUG, fnic-lport-host,
  Returning from fnic reset %s\n,
- (ret == SUCCESS) ?
+ (ret == 0) ?
  SUCCESS : FAILED);
 
return ret;
@@ -2252,7 +2252,7 @@ int fnic_host_reset(struct scsi_cmnd *sc)
 * scsi-ml tries to send a TUR to every device if host reset is
 * successful, so before returning to scsi, fabric should be up
 */
-   ret = fnic_reset(shost);
+   ret = (fnic_reset(shost) == 0) ? SUCCESS : FAILED;
if (ret == SUCCESS) {
wait_host_tmo = jiffies + FNIC_HOST_RESET_SETTLE_TIME * HZ;
ret = FAILED;
-- 
1.7.10.4

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