[PATCH 5/5] qla2xxx: Clean up open-coded obfuscation of DIV_ROUND_UP()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Roland Dreier <roland@xxxxxxxxxxxxxxx>

Signed-off-by: Roland Dreier <roland@xxxxxxxxxxxxxxx>
---
 drivers/scsi/qla2xxx/qla_target.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index e23679b..2d8a883 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1647,14 +1647,9 @@ static int qla_tgt_pci_map_calc_cnt(struct qla_tgt_prm *prm)
 	 * If greater than four sg entries then we need to allocate
 	 * the continuation entries
 	 */
-	if (prm->seg_cnt > prm->tgt->datasegs_per_cmd) {
-		prm->req_cnt += (uint16_t)(prm->seg_cnt -
-				prm->tgt->datasegs_per_cmd) /
-				prm->tgt->datasegs_per_cont;
-		if (((uint16_t)(prm->seg_cnt - prm->tgt->datasegs_per_cmd)) %
-		    prm->tgt->datasegs_per_cont)
-			prm->req_cnt++;
-	}
+	if (prm->seg_cnt > prm->tgt->datasegs_per_cmd)
+		prm->req_cnt += DIV_ROUND_UP(prm->seg_cnt - prm->tgt->datasegs_per_cmd,
+					     prm->tgt->datasegs_per_cont);
 
 	DEBUG21(qla_printk(KERN_INFO, prm->cmd->vha->hw, "seg_cnt=%d, req_cnt=%d\n",
 			prm->seg_cnt, prm->req_cnt));
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux