Re: [PATCH 17/23] zfcp: use enum zfcp_erp_act_result for argument/return of affected functions

2018-11-16 Thread Hannes Reinecke

On 11/8/18 3:44 PM, Steffen Maier wrote:

With that instead of just "int" it becomes clear which functions return
this type and which ones also accept it as argument they just pass through
in some cases or modify in other cases.
v2.6.27 commit 287ac01acf22 ("[SCSI] zfcp: Cleanup code in zfcp_erp.c")
introduced the enum which was cpp defines previously.

Silence some false -Wswitch compiler warning cases with individual
NOP cases. When adding more enum values and building with W=1 we
would get compiler warnings about missed new cases.

Consistently use the variable name "result", so change "retval" in
zfcp_erp_strategy() to "result". This avoids confusion with other
compile unit variables "retval" having different semantics and type.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
  drivers/s390/scsi/zfcp_erp.c | 124 +--
  1 file changed, 84 insertions(+), 40 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 3da870e55ab5..5c7fb64111fe 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -713,7 +713,8 @@ static void zfcp_erp_enqueue_ptp_port(struct zfcp_adapter 
*adapter)
_zfcp_erp_port_reopen(port, 0, "ereptp1");
  }
  
-static int zfcp_erp_adapter_strat_fsf_xconf(struct zfcp_erp_action *erp_action)

+static enum zfcp_erp_act_result zfcp_erp_adapter_strat_fsf_xconf(
+   struct zfcp_erp_action *erp_action)
  {
int retries;
int sleep = 1;
@@ -758,7 +759,8 @@ static int zfcp_erp_adapter_strat_fsf_xconf(struct 
zfcp_erp_action *erp_action)
return ZFCP_ERP_SUCCEEDED;
  }
  
-static int zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *act)

+static enum zfcp_erp_act_result zfcp_erp_adapter_strategy_open_fsf_xport(
+   struct zfcp_erp_action *act)
  {
int ret;
struct zfcp_adapter *adapter = act->adapter;
@@ -783,7 +785,8 @@ static int zfcp_erp_adapter_strategy_open_fsf_xport(struct 
zfcp_erp_action *act)
return ZFCP_ERP_SUCCEEDED;
  }
  
-static int zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *act)

+static enum zfcp_erp_act_result zfcp_erp_adapter_strategy_open_fsf(
+   struct zfcp_erp_action *act)
  {
if (zfcp_erp_adapter_strat_fsf_xconf(act) == ZFCP_ERP_FAILED)
return ZFCP_ERP_FAILED;
@@ -822,7 +825,8 @@ static void zfcp_erp_adapter_strategy_close(struct 
zfcp_erp_action *act)
  ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, >status);
  }
  
-static int zfcp_erp_adapter_strategy_open(struct zfcp_erp_action *act)

+static enum zfcp_erp_act_result zfcp_erp_adapter_strategy_open(
+   struct zfcp_erp_action *act)
  {
struct zfcp_adapter *adapter = act->adapter;
  
@@ -843,7 +847,8 @@ static int zfcp_erp_adapter_strategy_open(struct zfcp_erp_action *act)

return ZFCP_ERP_SUCCEEDED;
  }
  
-static int zfcp_erp_adapter_strategy(struct zfcp_erp_action *act)

+static enum zfcp_erp_act_result zfcp_erp_adapter_strategy(
+   struct zfcp_erp_action *act)
  {
struct zfcp_adapter *adapter = act->adapter;
  
@@ -861,7 +866,8 @@ static int zfcp_erp_adapter_strategy(struct zfcp_erp_action *act)

return ZFCP_ERP_SUCCEEDED;
  }
  
-static int zfcp_erp_port_forced_strategy_close(struct zfcp_erp_action *act)

+static enum zfcp_erp_act_result zfcp_erp_port_forced_strategy_close(
+   struct zfcp_erp_action *act)
  {
int retval;
  
@@ -875,7 +881,8 @@ static int zfcp_erp_port_forced_strategy_close(struct zfcp_erp_action *act)

return ZFCP_ERP_CONTINUES;
  }
  
-static int zfcp_erp_port_forced_strategy(struct zfcp_erp_action *erp_action)

+static enum zfcp_erp_act_result zfcp_erp_port_forced_strategy(
+   struct zfcp_erp_action *erp_action)
  {
struct zfcp_port *port = erp_action->port;
int status = atomic_read(>status);
@@ -902,7 +909,8 @@ static int zfcp_erp_port_forced_strategy(struct 
zfcp_erp_action *erp_action)
return ZFCP_ERP_FAILED;
  }
  
-static int zfcp_erp_port_strategy_close(struct zfcp_erp_action *erp_action)

+static enum zfcp_erp_act_result zfcp_erp_port_strategy_close(
+   struct zfcp_erp_action *erp_action)
  {
int retval;
  
@@ -915,7 +923,8 @@ static int zfcp_erp_port_strategy_close(struct zfcp_erp_action *erp_action)

return ZFCP_ERP_CONTINUES;
  }
  
-static int zfcp_erp_port_strategy_open_port(struct zfcp_erp_action *erp_action)

+static enum zfcp_erp_act_result zfcp_erp_port_strategy_open_port(
+   struct zfcp_erp_action *erp_action)
  {
int retval;
  
@@ -941,7 +950,8 @@ static int zfcp_erp_open_ptp_port(struct zfcp_erp_action *act)

return zfcp_erp_port_strategy_open_port(act);
  }
  
-static int zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *act)

+static enum zfcp_erp_act_result zfcp_erp_port_strategy_open_common(
+   struct zfcp_erp_action *act)
  {
struct zfcp_adapter *adapter = act->adapter;

[PATCH 17/23] zfcp: use enum zfcp_erp_act_result for argument/return of affected functions

2018-11-08 Thread Steffen Maier
With that instead of just "int" it becomes clear which functions return
this type and which ones also accept it as argument they just pass through
in some cases or modify in other cases.
v2.6.27 commit 287ac01acf22 ("[SCSI] zfcp: Cleanup code in zfcp_erp.c")
introduced the enum which was cpp defines previously.

Silence some false -Wswitch compiler warning cases with individual
NOP cases. When adding more enum values and building with W=1 we
would get compiler warnings about missed new cases.

Consistently use the variable name "result", so change "retval" in
zfcp_erp_strategy() to "result". This avoids confusion with other
compile unit variables "retval" having different semantics and type.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_erp.c | 124 +--
 1 file changed, 84 insertions(+), 40 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 3da870e55ab5..5c7fb64111fe 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -713,7 +713,8 @@ static void zfcp_erp_enqueue_ptp_port(struct zfcp_adapter 
*adapter)
_zfcp_erp_port_reopen(port, 0, "ereptp1");
 }
 
-static int zfcp_erp_adapter_strat_fsf_xconf(struct zfcp_erp_action *erp_action)
+static enum zfcp_erp_act_result zfcp_erp_adapter_strat_fsf_xconf(
+   struct zfcp_erp_action *erp_action)
 {
int retries;
int sleep = 1;
@@ -758,7 +759,8 @@ static int zfcp_erp_adapter_strat_fsf_xconf(struct 
zfcp_erp_action *erp_action)
return ZFCP_ERP_SUCCEEDED;
 }
 
-static int zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action 
*act)
+static enum zfcp_erp_act_result zfcp_erp_adapter_strategy_open_fsf_xport(
+   struct zfcp_erp_action *act)
 {
int ret;
struct zfcp_adapter *adapter = act->adapter;
@@ -783,7 +785,8 @@ static int zfcp_erp_adapter_strategy_open_fsf_xport(struct 
zfcp_erp_action *act)
return ZFCP_ERP_SUCCEEDED;
 }
 
-static int zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *act)
+static enum zfcp_erp_act_result zfcp_erp_adapter_strategy_open_fsf(
+   struct zfcp_erp_action *act)
 {
if (zfcp_erp_adapter_strat_fsf_xconf(act) == ZFCP_ERP_FAILED)
return ZFCP_ERP_FAILED;
@@ -822,7 +825,8 @@ static void zfcp_erp_adapter_strategy_close(struct 
zfcp_erp_action *act)
  ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, >status);
 }
 
-static int zfcp_erp_adapter_strategy_open(struct zfcp_erp_action *act)
+static enum zfcp_erp_act_result zfcp_erp_adapter_strategy_open(
+   struct zfcp_erp_action *act)
 {
struct zfcp_adapter *adapter = act->adapter;
 
@@ -843,7 +847,8 @@ static int zfcp_erp_adapter_strategy_open(struct 
zfcp_erp_action *act)
return ZFCP_ERP_SUCCEEDED;
 }
 
-static int zfcp_erp_adapter_strategy(struct zfcp_erp_action *act)
+static enum zfcp_erp_act_result zfcp_erp_adapter_strategy(
+   struct zfcp_erp_action *act)
 {
struct zfcp_adapter *adapter = act->adapter;
 
@@ -861,7 +866,8 @@ static int zfcp_erp_adapter_strategy(struct zfcp_erp_action 
*act)
return ZFCP_ERP_SUCCEEDED;
 }
 
-static int zfcp_erp_port_forced_strategy_close(struct zfcp_erp_action *act)
+static enum zfcp_erp_act_result zfcp_erp_port_forced_strategy_close(
+   struct zfcp_erp_action *act)
 {
int retval;
 
@@ -875,7 +881,8 @@ static int zfcp_erp_port_forced_strategy_close(struct 
zfcp_erp_action *act)
return ZFCP_ERP_CONTINUES;
 }
 
-static int zfcp_erp_port_forced_strategy(struct zfcp_erp_action *erp_action)
+static enum zfcp_erp_act_result zfcp_erp_port_forced_strategy(
+   struct zfcp_erp_action *erp_action)
 {
struct zfcp_port *port = erp_action->port;
int status = atomic_read(>status);
@@ -902,7 +909,8 @@ static int zfcp_erp_port_forced_strategy(struct 
zfcp_erp_action *erp_action)
return ZFCP_ERP_FAILED;
 }
 
-static int zfcp_erp_port_strategy_close(struct zfcp_erp_action *erp_action)
+static enum zfcp_erp_act_result zfcp_erp_port_strategy_close(
+   struct zfcp_erp_action *erp_action)
 {
int retval;
 
@@ -915,7 +923,8 @@ static int zfcp_erp_port_strategy_close(struct 
zfcp_erp_action *erp_action)
return ZFCP_ERP_CONTINUES;
 }
 
-static int zfcp_erp_port_strategy_open_port(struct zfcp_erp_action *erp_action)
+static enum zfcp_erp_act_result zfcp_erp_port_strategy_open_port(
+   struct zfcp_erp_action *erp_action)
 {
int retval;
 
@@ -941,7 +950,8 @@ static int zfcp_erp_open_ptp_port(struct zfcp_erp_action 
*act)
return zfcp_erp_port_strategy_open_port(act);
 }
 
-static int zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *act)
+static enum zfcp_erp_act_result zfcp_erp_port_strategy_open_common(
+   struct zfcp_erp_action *act)
 {
struct zfcp_adapter *adapter = act->adapter;
struct zfcp_port *port = act->port;
@@ -982,7 +992,8 @@ static int