return -EINVAL;
}
- val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV;
+ val = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
*selector = val;
val <<= info->vol_shift;
mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
return -EINVAL;
}
- val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV;
+ val = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
*selector = val;
val <<= info->vol_shift;
mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
thresh = (info->max_uV + info->min_uV) / 2;
if (min_uV < thresh) {
- val = (thresh - min_uV + info->step_uV - 1) / info->step_uV;
+ val = DIV_ROUND_UP(thresh - min_uV, info->step_uV);
val |= 0x4;
} else {
- val = (min_uV - thresh + info->step_uV - 1) / info->step_uV;
+ val = DIV_ROUND_UP(min_uV - thresh, info->step_uV);
}
*selector = val;
return -EINVAL;
}
- val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV;
+ val = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
*selector = val;
val <<= info->vol_shift;
mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
return -EINVAL;
}
- val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV;
+ val = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
val = (val >= 20) ? val - 12 : ((val > 7) ? 8 : val);
*selector = val;
val <<= info->vol_shift;