switch (flags & CMDF_ROUND_MASK) {
                case CMDF_ROUND_NEAREST:
                default:
-                       timer = (*ns + base / 2) / base;
+                       timer = DIV_ROUND_CLOSEST(*ns, base);
                        break;
                case CMDF_ROUND_DOWN:
                        timer = *ns / base;
 
        switch (flags & CMDF_ROUND_MASK) {
        default:
        case CMDF_ROUND_NEAREST:
-               div += (rem + (timebase / 2)) / timebase;
+               div += DIV_ROUND_CLOSEST(rem, timebase);
                break;
        case CMDF_ROUND_DOWN:
                break;
 
                num_entries = fifo->max_segment_length;
 
        /*  1 == 256 entries, 2 == 512 entries, etc */
-       num_increments = (num_entries + increment_size / 2) / increment_size;
+       num_increments = DIV_ROUND_CLOSEST(num_entries, increment_size);
 
        bits = (~(num_increments - 1)) & fifo->fifo_size_reg_mask;
        devpriv->fifo_size_bits &= ~fifo->fifo_size_reg_mask;
                break;
        case CMDF_ROUND_NEAREST:
        default:
-               divisor = (ns + TIMER_BASE / 2) / TIMER_BASE;
+               divisor = DIV_ROUND_CLOSEST(ns, TIMER_BASE);
                break;
        }
        return divisor;
 
                switch (flags & CMDF_ROUND_MASK) {
                case CMDF_ROUND_NEAREST:
                default:
-                       divider = (*ns + base / 2) / base;
+                       divider = DIV_ROUND_CLOSEST(*ns, base);
                        break;
                case CMDF_ROUND_DOWN:
                        divider = (*ns) / base;
 
                switch (flags & CMDF_ROUND_MASK) {
                case CMDF_ROUND_NEAREST:
                default:
-                       divider = (*nanosec + base / 2) / base;
+                       divider = DIV_ROUND_CLOSEST(*nanosec, base);
                        break;
                case CMDF_ROUND_DOWN:
                        divider = (*nanosec) / base;
 
        switch (flags & CMDF_ROUND_MASK) {
        case CMDF_ROUND_NEAREST:
        default:
-               divider = (*nanosec + base / 2) / base;
+               divider = DIV_ROUND_CLOSEST(*nanosec, base);
                break;
        case CMDF_ROUND_DOWN:
                divider = (*nanosec) / base;