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

iio: adc: ti-tsc2046: use us_to_ktime() where appropriate

Given scan_interval_us and time_per_scan_us are both in usecs, it
makes more sense to use us_to_ktime() helper rather than converting
to nanosecs as needed for ns_to_ktime().

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://patch.msgid.link/20250813075556.466872-1-zhao.xichao@vivo.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Xichao Zhao and committed by
Jonathan Cameron
ea9b0421 946bfea3

+2 -4
+2 -4
drivers/iio/adc/ti-tsc2046.c
··· 535 535 if (priv->poll_cnt < TI_TSC2046_POLL_CNT) { 536 536 priv->poll_cnt++; 537 537 hrtimer_start(&priv->trig_timer, 538 - ns_to_ktime(priv->scan_interval_us * 539 - NSEC_PER_USEC), 538 + us_to_ktime(priv->scan_interval_us), 540 539 HRTIMER_MODE_REL_SOFT); 541 540 542 541 if (priv->poll_cnt >= TI_TSC2046_MIN_POLL_CNT) { ··· 604 605 * many samples. Reduce the sample rate for default (touchscreen) use 605 606 * case. 606 607 */ 607 - tim = ns_to_ktime((priv->scan_interval_us - priv->time_per_scan_us) * 608 - NSEC_PER_USEC); 608 + tim = us_to_ktime(priv->scan_interval_us - priv->time_per_scan_us); 609 609 hrtimer_start(&priv->trig_timer, tim, HRTIMER_MODE_REL_SOFT); 610 610 } 611 611