The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        case CMDF_ROUND_DOWN:
                break;
        case CMDF_ROUND_UP:
-               div += (rem + timebase - 1) / timebase;
+               div += DIV_ROUND_UP(rem, timebase);
                break;
        }
        return div > UINT_MAX ? UINT_MAX : (unsigned int)div;