diff mbox series

[07/11] qla2xxx: Make qla2x00_process_response_queue() easier to read

Message ID 20190404194448.121489-8-bvanassche@acm.org (mailing list archive)
State Accepted
Headers show
Series qla2xxx patches for kernel v5.2 | expand

Commit Message

Bart Van Assche April 4, 2019, 7:44 p.m. UTC
Make qla2x00_process_response_queue() easier to read by splitting this
function. This patch does not change any functionality.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/qla2xxx/qla_isr.c | 85 +++++++++++++++++++---------------
 1 file changed, 47 insertions(+), 38 deletions(-)

Comments

Himanshu Madhani April 8, 2019, 4:47 p.m. UTC | #1
On 4/4/19, 12:45 PM, "Bart Van Assche" <bvanassche@acm.org> wrote:

    External Email
    
    ----------------------------------------------------------------------
    Make qla2x00_process_response_queue() easier to read by splitting this
    function. This patch does not change any functionality.
    
    Cc: Himanshu Madhani <hmadhani@marvell.com>
    Cc: Giridhar Malavali <gmalavali@marvell.com>
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
    ---
     drivers/scsi/qla2xxx/qla_isr.c | 85 +++++++++++++++++++---------------
     1 file changed, 47 insertions(+), 38 deletions(-)
    
    diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
    index 055d313a0461..aed1fc352efd 100644
    --- a/drivers/scsi/qla2xxx/qla_isr.c
    +++ b/drivers/scsi/qla2xxx/qla_isr.c
    @@ -1972,6 +1972,52 @@ static void qla_ctrlvp_completed(scsi_qla_host_t *vha, struct req_que *req,
     	sp->done(sp, rval);
     }
     
    +/* Process a single response queue entry. */
    +static void qla2x00_process_response_entry(struct scsi_qla_host *vha,
    +					   struct rsp_que *rsp,
    +					   sts_entry_t *pkt)
    +{
    +	sts21_entry_t *sts21_entry;
    +	sts22_entry_t *sts22_entry;
    +	uint16_t handle_cnt;
    +	uint16_t cnt;
    +
    +	switch (pkt->entry_type) {
    +	case STATUS_TYPE:
    +		qla2x00_status_entry(vha, rsp, pkt);
    +		break;
    +	case STATUS_TYPE_21:
    +		sts21_entry = (sts21_entry_t *)pkt;
    +		handle_cnt = sts21_entry->handle_count;
    +		for (cnt = 0; cnt < handle_cnt; cnt++)
    +			qla2x00_process_completed_request(vha, rsp->req,
    +						sts21_entry->handle[cnt]);
    +		break;
    +	case STATUS_TYPE_22:
    +		sts22_entry = (sts22_entry_t *)pkt;
    +		handle_cnt = sts22_entry->handle_count;
    +		for (cnt = 0; cnt < handle_cnt; cnt++)
    +			qla2x00_process_completed_request(vha, rsp->req,
    +						sts22_entry->handle[cnt]);
    +		break;
    +	case STATUS_CONT_TYPE:
    +		qla2x00_status_cont_entry(rsp, (sts_cont_entry_t *)pkt);
    +		break;
    +	case MBX_IOCB_TYPE:
    +		qla2x00_mbx_iocb_entry(vha, rsp->req, (struct mbx_entry *)pkt);
    +		break;
    +	case CT_IOCB_TYPE:
    +		qla2x00_ct_entry(vha, rsp->req, pkt, CT_IOCB_TYPE);
    +		break;
    +	default:
    +		/* Type Not Supported. */
    +		ql_log(ql_log_warn, vha, 0x504a,
    +		       "Received unknown response pkt type %x entry status=%x.\n",
    +		       pkt->entry_type, pkt->entry_status);
    +		break;
    +	}
    +}
    +
     /**
      * qla2x00_process_response_queue() - Process response queue entries.
      * @rsp: response queue
    @@ -1983,8 +2029,6 @@ qla2x00_process_response_queue(struct rsp_que *rsp)
     	struct qla_hw_data *ha = rsp->hw;
     	struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
     	sts_entry_t	*pkt;
    -	uint16_t        handle_cnt;
    -	uint16_t        cnt;
     
     	vha = pci_get_drvdata(ha->pdev);
     
    @@ -2009,42 +2053,7 @@ qla2x00_process_response_queue(struct rsp_que *rsp)
     			continue;
     		}
     
    -		switch (pkt->entry_type) {
    -		case STATUS_TYPE:
    -			qla2x00_status_entry(vha, rsp, pkt);
    -			break;
    -		case STATUS_TYPE_21:
    -			handle_cnt = ((sts21_entry_t *)pkt)->handle_count;
    -			for (cnt = 0; cnt < handle_cnt; cnt++) {
    -				qla2x00_process_completed_request(vha, rsp->req,
    -				    ((sts21_entry_t *)pkt)->handle[cnt]);
    -			}
    -			break;
    -		case STATUS_TYPE_22:
    -			handle_cnt = ((sts22_entry_t *)pkt)->handle_count;
    -			for (cnt = 0; cnt < handle_cnt; cnt++) {
    -				qla2x00_process_completed_request(vha, rsp->req,
    -				    ((sts22_entry_t *)pkt)->handle[cnt]);
    -			}
    -			break;
    -		case STATUS_CONT_TYPE:
    -			qla2x00_status_cont_entry(rsp, (sts_cont_entry_t *)pkt);
    -			break;
    -		case MBX_IOCB_TYPE:
    -			qla2x00_mbx_iocb_entry(vha, rsp->req,
    -			    (struct mbx_entry *)pkt);
    -			break;
    -		case CT_IOCB_TYPE:
    -			qla2x00_ct_entry(vha, rsp->req, pkt, CT_IOCB_TYPE);
    -			break;
    -		default:
    -			/* Type Not Supported. */
    -			ql_log(ql_log_warn, vha, 0x504a,
    -			    "Received unknown response pkt type %x "
    -			    "entry status=%x.\n",
    -			    pkt->entry_type, pkt->entry_status);
    -			break;
    -		}
    +		qla2x00_process_response_entry(vha, rsp, pkt);
     		((response_t *)pkt)->signature = RESPONSE_PROCESSED;
     		wmb();
     	}
    -- 
    2.21.0.196.g041f5ea1cf98
    
 
 Thanks for the patch.

Acked-by: Himanshu Madhani <hmadhani@marvell.com>
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 055d313a0461..aed1fc352efd 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1972,6 +1972,52 @@  static void qla_ctrlvp_completed(scsi_qla_host_t *vha, struct req_que *req,
 	sp->done(sp, rval);
 }
 
+/* Process a single response queue entry. */
+static void qla2x00_process_response_entry(struct scsi_qla_host *vha,
+					   struct rsp_que *rsp,
+					   sts_entry_t *pkt)
+{
+	sts21_entry_t *sts21_entry;
+	sts22_entry_t *sts22_entry;
+	uint16_t handle_cnt;
+	uint16_t cnt;
+
+	switch (pkt->entry_type) {
+	case STATUS_TYPE:
+		qla2x00_status_entry(vha, rsp, pkt);
+		break;
+	case STATUS_TYPE_21:
+		sts21_entry = (sts21_entry_t *)pkt;
+		handle_cnt = sts21_entry->handle_count;
+		for (cnt = 0; cnt < handle_cnt; cnt++)
+			qla2x00_process_completed_request(vha, rsp->req,
+						sts21_entry->handle[cnt]);
+		break;
+	case STATUS_TYPE_22:
+		sts22_entry = (sts22_entry_t *)pkt;
+		handle_cnt = sts22_entry->handle_count;
+		for (cnt = 0; cnt < handle_cnt; cnt++)
+			qla2x00_process_completed_request(vha, rsp->req,
+						sts22_entry->handle[cnt]);
+		break;
+	case STATUS_CONT_TYPE:
+		qla2x00_status_cont_entry(rsp, (sts_cont_entry_t *)pkt);
+		break;
+	case MBX_IOCB_TYPE:
+		qla2x00_mbx_iocb_entry(vha, rsp->req, (struct mbx_entry *)pkt);
+		break;
+	case CT_IOCB_TYPE:
+		qla2x00_ct_entry(vha, rsp->req, pkt, CT_IOCB_TYPE);
+		break;
+	default:
+		/* Type Not Supported. */
+		ql_log(ql_log_warn, vha, 0x504a,
+		       "Received unknown response pkt type %x entry status=%x.\n",
+		       pkt->entry_type, pkt->entry_status);
+		break;
+	}
+}
+
 /**
  * qla2x00_process_response_queue() - Process response queue entries.
  * @rsp: response queue
@@ -1983,8 +2029,6 @@  qla2x00_process_response_queue(struct rsp_que *rsp)
 	struct qla_hw_data *ha = rsp->hw;
 	struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
 	sts_entry_t	*pkt;
-	uint16_t        handle_cnt;
-	uint16_t        cnt;
 
 	vha = pci_get_drvdata(ha->pdev);
 
@@ -2009,42 +2053,7 @@  qla2x00_process_response_queue(struct rsp_que *rsp)
 			continue;
 		}
 
-		switch (pkt->entry_type) {
-		case STATUS_TYPE:
-			qla2x00_status_entry(vha, rsp, pkt);
-			break;
-		case STATUS_TYPE_21:
-			handle_cnt = ((sts21_entry_t *)pkt)->handle_count;
-			for (cnt = 0; cnt < handle_cnt; cnt++) {
-				qla2x00_process_completed_request(vha, rsp->req,
-				    ((sts21_entry_t *)pkt)->handle[cnt]);
-			}
-			break;
-		case STATUS_TYPE_22:
-			handle_cnt = ((sts22_entry_t *)pkt)->handle_count;
-			for (cnt = 0; cnt < handle_cnt; cnt++) {
-				qla2x00_process_completed_request(vha, rsp->req,
-				    ((sts22_entry_t *)pkt)->handle[cnt]);
-			}
-			break;
-		case STATUS_CONT_TYPE:
-			qla2x00_status_cont_entry(rsp, (sts_cont_entry_t *)pkt);
-			break;
-		case MBX_IOCB_TYPE:
-			qla2x00_mbx_iocb_entry(vha, rsp->req,
-			    (struct mbx_entry *)pkt);
-			break;
-		case CT_IOCB_TYPE:
-			qla2x00_ct_entry(vha, rsp->req, pkt, CT_IOCB_TYPE);
-			break;
-		default:
-			/* Type Not Supported. */
-			ql_log(ql_log_warn, vha, 0x504a,
-			    "Received unknown response pkt type %x "
-			    "entry status=%x.\n",
-			    pkt->entry_type, pkt->entry_status);
-			break;
-		}
+		qla2x00_process_response_entry(vha, rsp, pkt);
 		((response_t *)pkt)->signature = RESPONSE_PROCESSED;
 		wmb();
 	}