Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Andy Shevchenko and committed by
Jonathan Cameron
69f5dcaa 02f86101

+2 -3
+2 -3
drivers/iio/common/scmi_sensors/scmi_iio.c
··· 66 66 /* 67 67 * Timestamp returned by SCMI is in seconds and is equal to 68 68 * time * power-of-10 multiplier(tstamp_scale) seconds. 69 - * Converting the timestamp to nanoseconds below. 69 + * Converting the timestamp to nanoseconds (10⁹) below. 70 70 */ 71 - tstamp_scale = sensor->sensor_info->tstamp_scale + 72 - const_ilog2(NSEC_PER_SEC) / const_ilog2(10); 71 + tstamp_scale = sensor->sensor_info->tstamp_scale + 9; 73 72 if (tstamp_scale < 0) { 74 73 do_div(time, int_pow(10, abs(tstamp_scale))); 75 74 time_ns = time;