scsi: qla2xxx: Introduce the function qla2xxx_init_sp()

This patch does not change any functionality but makes the next patch
easier to read.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Himanshu Madhani <hmadhani@marvell.com>
Reviewed-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Bart Van Assche 2019-08-08 20:02:05 -07:00 committed by Martin K. Petersen
parent 6c18a43e3c
commit bdb61b9b94
1 changed files with 15 additions and 13 deletions

View File

@ -152,6 +152,18 @@ qla2x00_chip_is_down(scsi_qla_host_t *vha)
return (qla2x00_reset_active(vha) || !vha->hw->flags.fw_started); return (qla2x00_reset_active(vha) || !vha->hw->flags.fw_started);
} }
static void qla2xxx_init_sp(srb_t *sp, scsi_qla_host_t *vha,
struct qla_qpair *qpair, fc_port_t *fcport)
{
memset(sp, 0, sizeof(*sp));
sp->fcport = fcport;
sp->iocbs = 1;
sp->vha = vha;
sp->qpair = qpair;
sp->cmd_type = TYPE_SRB;
INIT_LIST_HEAD(&sp->elem);
}
static inline srb_t * static inline srb_t *
qla2xxx_get_qpair_sp(scsi_qla_host_t *vha, struct qla_qpair *qpair, qla2xxx_get_qpair_sp(scsi_qla_host_t *vha, struct qla_qpair *qpair,
fc_port_t *fcport, gfp_t flag) fc_port_t *fcport, gfp_t flag)
@ -164,19 +176,9 @@ qla2xxx_get_qpair_sp(scsi_qla_host_t *vha, struct qla_qpair *qpair,
return NULL; return NULL;
sp = mempool_alloc(qpair->srb_mempool, flag); sp = mempool_alloc(qpair->srb_mempool, flag);
if (!sp) if (sp)
goto done; qla2xxx_init_sp(sp, vha, qpair, fcport);
else
memset(sp, 0, sizeof(*sp));
sp->fcport = fcport;
sp->iocbs = 1;
sp->vha = vha;
sp->qpair = qpair;
sp->cmd_type = TYPE_SRB;
INIT_LIST_HEAD(&sp->elem);
done:
if (!sp)
QLA_QPAIR_MARK_NOT_BUSY(qpair); QLA_QPAIR_MARK_NOT_BUSY(qpair);
return sp; return sp;
} }