diff options
author | Joern Engel <joern@logfs.org> | 2014-09-16 16:23:18 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-10-01 17:39:29 -0400 |
commit | f9b6721a9cef94908467abf7a2cacbd15a7d23cb (patch) | |
tree | c480d2a154ffe68f5dc7f57011b26414241be600 | |
parent | 55a9066fffd2f533e7ed434b072469ef09d6c476 (diff) |
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: Joern Engel <joern@logfs.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | drivers/scsi/qla2xxx/qla_target.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index c22b1c141fec..68c90ad441f4 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c | |||
@@ -1409,12 +1409,13 @@ out_err: | |||
1409 | return -1; | 1409 | return -1; |
1410 | } | 1410 | } |
1411 | 1411 | ||
1412 | static inline void qlt_unmap_sg(struct scsi_qla_host *vha, | 1412 | static void qlt_unmap_sg(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd) |
1413 | struct qla_tgt_cmd *cmd) | ||
1414 | { | 1413 | { |
1415 | struct qla_hw_data *ha = vha->hw; | 1414 | struct qla_hw_data *ha = vha->hw; |
1416 | 1415 | ||
1417 | BUG_ON(!cmd->sg_mapped); | 1416 | if (!cmd->sg_mapped) |
1417 | return; | ||
1418 | |||
1418 | pci_unmap_sg(ha->pdev, cmd->sg, cmd->sg_cnt, cmd->dma_data_direction); | 1419 | pci_unmap_sg(ha->pdev, cmd->sg, cmd->sg_cnt, cmd->dma_data_direction); |
1419 | cmd->sg_mapped = 0; | 1420 | cmd->sg_mapped = 0; |
1420 | 1421 | ||
@@ -2403,8 +2404,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type, | |||
2403 | return 0; | 2404 | return 0; |
2404 | 2405 | ||
2405 | out_unmap_unlock: | 2406 | out_unmap_unlock: |
2406 | if (cmd->sg_mapped) | 2407 | qlt_unmap_sg(vha, cmd); |
2407 | qlt_unmap_sg(vha, cmd); | ||
2408 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 2408 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
2409 | 2409 | ||
2410 | return res; | 2410 | return res; |
@@ -2468,8 +2468,7 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd) | |||
2468 | return res; | 2468 | return res; |
2469 | 2469 | ||
2470 | out_unlock_free_unmap: | 2470 | out_unlock_free_unmap: |
2471 | if (cmd->sg_mapped) | 2471 | qlt_unmap_sg(vha, cmd); |
2472 | qlt_unmap_sg(vha, cmd); | ||
2473 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 2472 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
2474 | 2473 | ||
2475 | return res; | 2474 | return res; |
@@ -2706,8 +2705,7 @@ done: | |||
2706 | if (!ha_locked && !in_interrupt()) | 2705 | if (!ha_locked && !in_interrupt()) |
2707 | msleep(250); /* just in case */ | 2706 | msleep(250); /* just in case */ |
2708 | 2707 | ||
2709 | if (cmd->sg_mapped) | 2708 | qlt_unmap_sg(vha, cmd); |
2710 | qlt_unmap_sg(vha, cmd); | ||
2711 | vha->hw->tgt.tgt_ops->free_cmd(cmd); | 2709 | vha->hw->tgt.tgt_ops->free_cmd(cmd); |
2712 | } | 2710 | } |
2713 | return; | 2711 | return; |
@@ -2927,8 +2925,7 @@ static void qlt_do_ctio_completion(struct scsi_qla_host *vha, uint32_t handle, | |||
2927 | se_cmd = &cmd->se_cmd; | 2925 | se_cmd = &cmd->se_cmd; |
2928 | tfo = se_cmd->se_tfo; | 2926 | tfo = se_cmd->se_tfo; |
2929 | 2927 | ||
2930 | if (cmd->sg_mapped) | 2928 | qlt_unmap_sg(vha, cmd); |
2931 | qlt_unmap_sg(vha, cmd); | ||
2932 | 2929 | ||
2933 | if (unlikely(status != CTIO_SUCCESS)) { | 2930 | if (unlikely(status != CTIO_SUCCESS)) { |
2934 | switch (status & 0xFFFF) { | 2931 | switch (status & 0xFFFF) { |