Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f9b6721a authored by Joern Engel's avatar Joern Engel Committed by Nicholas Bellinger
Browse files

qla_target: improve qlt_unmap_sg()



Remove the inline attribute.  Modern compilers ignore it and the
function has grown beyond where inline made sense anyway.
Remove the BUG_ON(!cmd->sg_mapped), and instead return if sg_mapped is
not set.  Every caller is doing this check, so we might as well have it
in one place instead of four.

Signed-off-by: default avatarJoern Engel <joern@logfs.org>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 55a9066f
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -1409,12 +1409,13 @@ out_err:
	return -1;
}

static inline void qlt_unmap_sg(struct scsi_qla_host *vha,
	struct qla_tgt_cmd *cmd)
static void qlt_unmap_sg(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd)
{
	struct qla_hw_data *ha = vha->hw;

	BUG_ON(!cmd->sg_mapped);
	if (!cmd->sg_mapped)
		return;

	pci_unmap_sg(ha->pdev, cmd->sg, cmd->sg_cnt, cmd->dma_data_direction);
	cmd->sg_mapped = 0;

@@ -2403,7 +2404,6 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type,
	return 0;

out_unmap_unlock:
	if (cmd->sg_mapped)
	qlt_unmap_sg(vha, cmd);
	spin_unlock_irqrestore(&ha->hardware_lock, flags);

@@ -2468,7 +2468,6 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd)
	return res;

out_unlock_free_unmap:
	if (cmd->sg_mapped)
	qlt_unmap_sg(vha, cmd);
	spin_unlock_irqrestore(&ha->hardware_lock, flags);

@@ -2706,7 +2705,6 @@ done:
		if (!ha_locked && !in_interrupt())
			msleep(250); /* just in case */

		if (cmd->sg_mapped)
		qlt_unmap_sg(vha, cmd);
		vha->hw->tgt.tgt_ops->free_cmd(cmd);
	}
@@ -2927,7 +2925,6 @@ static void qlt_do_ctio_completion(struct scsi_qla_host *vha, uint32_t handle,
	se_cmd = &cmd->se_cmd;
	tfo = se_cmd->se_tfo;

	if (cmd->sg_mapped)
	qlt_unmap_sg(vha, cmd);

	if (unlikely(status != CTIO_SUCCESS)) {