mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-19 21:56:31 +00:00
Cleanup and microoptimization: it's better to use DIV_ROUND_UP is such cases
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4273 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -2037,14 +2037,9 @@ static int q2t_pci_map_calc_cnt(struct q2t_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);
|
||||
|
||||
out:
|
||||
TRACE_DBG("seg_cnt=%d, req_cnt=%d, res=%d", prm->seg_cnt,
|
||||
|
||||
Reference in New Issue
Block a user