iio: common: scmi_sensors: Get rid of const_ilog2()

Fisrt of all, const_ilog2() was a workaround of some sparse issue,
which was never appeared in the C functions. Second, the calls here
are done against constants and work with a bit of luck. Replace
this altogether by a pre-calculated simple integer constant.
Amend a comment to give a hint where it comes from.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
pull/1354/merge
Andy Shevchenko 2025-11-03 09:29:11 +01:00 committed by Jonathan Cameron
parent 02f86101e4
commit 69f5dcaa99
1 changed files with 2 additions and 3 deletions

View File

@ -66,10 +66,9 @@ static int scmi_iio_sensor_update_cb(struct notifier_block *nb,
/* /*
* Timestamp returned by SCMI is in seconds and is equal to * Timestamp returned by SCMI is in seconds and is equal to
* time * power-of-10 multiplier(tstamp_scale) seconds. * time * power-of-10 multiplier(tstamp_scale) seconds.
* Converting the timestamp to nanoseconds below. * Converting the timestamp to nanoseconds (10) below.
*/ */
tstamp_scale = sensor->sensor_info->tstamp_scale + tstamp_scale = sensor->sensor_info->tstamp_scale + 9;
const_ilog2(NSEC_PER_SEC) / const_ilog2(10);
if (tstamp_scale < 0) { if (tstamp_scale < 0) {
do_div(time, int_pow(10, abs(tstamp_scale))); do_div(time, int_pow(10, abs(tstamp_scale)));
time_ns = time; time_ns = time;