diff mbox series

[1/2] qla2xxx: Introduce a switch/case statement in qlt_xmit_tm_rsp()

Message ID 20181127230455.259829-2-bvanassche@acm.org (mailing list archive)
State Accepted
Headers show
Series Two refactoring patches for the qla2xxx driver | expand

Commit Message

Bart Van Assche Nov. 27, 2018, 11:04 p.m. UTC
This patch improves code readability but does not change any
functionality.

Cc: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/qla2xxx/qla_target.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Madhani, Himanshu Nov. 28, 2018, 11:03 p.m. UTC | #1
> On Nov 27, 2018, at 3:04 PM, Bart Van Assche <bvanassche@acm.org> wrote:
> 
> External Email
> 
> This patch improves code readability but does not change any
> functionality.
> 
> Cc: Himanshu Madhani <himanshu.madhani@cavium.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/qla2xxx/qla_target.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
> index c4504740f0e2..802007a7b21c 100644
> --- a/drivers/scsi/qla2xxx/qla_target.c
> +++ b/drivers/scsi/qla2xxx/qla_target.c
> @@ -2379,20 +2379,20 @@ void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *mcmd)
>        }
> 
>        if (mcmd->flags == QLA24XX_MGMT_SEND_NACK) {
> -               if (mcmd->orig_iocb.imm_ntfy.u.isp24.status_subcode ==
> -                   ELS_LOGO ||
> -                   mcmd->orig_iocb.imm_ntfy.u.isp24.status_subcode ==
> -                   ELS_PRLO ||
> -                   mcmd->orig_iocb.imm_ntfy.u.isp24.status_subcode ==
> -                   ELS_TPRLO) {
> +               switch (mcmd->orig_iocb.imm_ntfy.u.isp24.status_subcode) {
> +               case ELS_LOGO:
> +               case ELS_PRLO:
> +               case ELS_TPRLO:
>                        ql_dbg(ql_dbg_disc, vha, 0x2106,
>                            "TM response logo %phC status %#x state %#x",
>                            mcmd->sess->port_name, mcmd->fc_tm_rsp,
>                            mcmd->flags);
>                        qlt_schedule_sess_for_deletion(mcmd->sess);
> -               } else {
> +                       break;
> +               default:
>                        qlt_send_notify_ack(vha->hw->base_qpair,
>                            &mcmd->orig_iocb.imm_ntfy, 0, 0, 0, 0, 0, 0);
> +                       break;
>                }
>        } else {
>                if (mcmd->orig_iocb.atio.u.raw.entry_type == ABTS_RECV_24XX) {
> --
> 2.20.0.rc0.387.gc7a69e6b6c-goog
> 

Looks Good. 

Acked-by: Himanshu Madhani <himanshu.madhani@cavium.com>

Thanks,
- Himanshu
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index c4504740f0e2..802007a7b21c 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -2379,20 +2379,20 @@  void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *mcmd)
 	}
 
 	if (mcmd->flags == QLA24XX_MGMT_SEND_NACK) {
-		if (mcmd->orig_iocb.imm_ntfy.u.isp24.status_subcode ==
-		    ELS_LOGO ||
-		    mcmd->orig_iocb.imm_ntfy.u.isp24.status_subcode ==
-		    ELS_PRLO ||
-		    mcmd->orig_iocb.imm_ntfy.u.isp24.status_subcode ==
-		    ELS_TPRLO) {
+		switch (mcmd->orig_iocb.imm_ntfy.u.isp24.status_subcode) {
+		case ELS_LOGO:
+		case ELS_PRLO:
+		case ELS_TPRLO:
 			ql_dbg(ql_dbg_disc, vha, 0x2106,
 			    "TM response logo %phC status %#x state %#x",
 			    mcmd->sess->port_name, mcmd->fc_tm_rsp,
 			    mcmd->flags);
 			qlt_schedule_sess_for_deletion(mcmd->sess);
-		} else {
+			break;
+		default:
 			qlt_send_notify_ack(vha->hw->base_qpair,
 			    &mcmd->orig_iocb.imm_ntfy, 0, 0, 0, 0, 0, 0);
+			break;
 		}
 	} else {
 		if (mcmd->orig_iocb.atio.u.raw.entry_type == ABTS_RECV_24XX) {