mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: adc: ti-tsc2046: use us_to_ktime() where appropriate
@ 2025-08-13  7:55 Xichao Zhao
  2025-08-13 10:34 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Xichao Zhao @ 2025-08-13  7:55 UTC (permalink / raw)
  To: o.rempel, jic23
  Cc: dlechner, nuno.sa, andy, linux-iio, linux-kernel, Xichao Zhao

The scan_interval_us and time_per_scan_us are more suitable for 
using the us_to_ktime(). This can make the code more concise and
enhance readability. Therefore, replace ns_to_ktime() with us_to_ktime().

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
 drivers/iio/adc/ti-tsc2046.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/ti-tsc2046.c b/drivers/iio/adc/ti-tsc2046.c
index 74471f08662e..8eb717b11cff 100644
--- a/drivers/iio/adc/ti-tsc2046.c
+++ b/drivers/iio/adc/ti-tsc2046.c
@@ -535,8 +535,7 @@ static enum hrtimer_restart tsc2046_adc_timer(struct hrtimer *hrtimer)
 		if (priv->poll_cnt < TI_TSC2046_POLL_CNT) {
 			priv->poll_cnt++;
 			hrtimer_start(&priv->trig_timer,
-				      ns_to_ktime(priv->scan_interval_us *
-						  NSEC_PER_USEC),
+				      us_to_ktime(priv->scan_interval_us),
 				      HRTIMER_MODE_REL_SOFT);
 
 			if (priv->poll_cnt >= TI_TSC2046_MIN_POLL_CNT) {
@@ -605,8 +604,7 @@ static void tsc2046_adc_reenable_trigger(struct iio_trigger *trig)
 	 * many samples. Reduce the sample rate for default (touchscreen) use
 	 * case.
 	 */
-	tim = ns_to_ktime((priv->scan_interval_us - priv->time_per_scan_us) *
-			  NSEC_PER_USEC);
+	tim = us_to_ktime(priv->scan_interval_us - priv->time_per_scan_us);
 	hrtimer_start(&priv->trig_timer, tim, HRTIMER_MODE_REL_SOFT);
 }
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: ti-tsc2046: use us_to_ktime() where appropriate
  2025-08-13  7:55 [PATCH] iio: adc: ti-tsc2046: use us_to_ktime() where appropriate Xichao Zhao
@ 2025-08-13 10:34 ` Andy Shevchenko
       [not found]   ` <92f45b4d-447e-45ea-8fc0-a003a32d934c@vivo.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2025-08-13 10:34 UTC (permalink / raw)
  To: Xichao Zhao
  Cc: o.rempel, jic23, dlechner, nuno.sa, andy, linux-iio, linux-kernel

On Wed, Aug 13, 2025 at 9:56 AM Xichao Zhao <zhao.xichao@vivo.com> wrote:
>
> The scan_interval_us and time_per_scan_us are more suitable for
> using the us_to_ktime(). This can make the code more concise and

This makes....

> enhance readability. Therefore, replace ns_to_ktime() with us_to_ktime().

Perhaps Jonathan may tweak the commit message to be more English, but
code wise I agree with you.
Reviewed-by: Andy Shevchenko <andy@kernel.org>

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: ti-tsc2046: use us_to_ktime() where appropriate
       [not found]   ` <92f45b4d-447e-45ea-8fc0-a003a32d934c@vivo.com>
@ 2025-08-16 13:08     ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2025-08-16 13:08 UTC (permalink / raw)
  To: 赵西超
  Cc: Andy Shevchenko, o.rempel, dlechner, nuno.sa, andy, linux-iio,
	linux-kernel

On Wed, 13 Aug 2025 11:33:24 +0000
赵西超 <zhao.xichao@vivo.com> wrote:

> 在 2025/8/13 18:34, Andy Shevchenko 写道:
> 
> On Wed, Aug 13, 2025 at 9:56 AM Xichao Zhao <zhao.xichao@vivo.com><mailto:zhao.xichao@vivo.com> wrote:
> 
> 
> 
> The scan_interval_us and time_per_scan_us are more suitable for
> using the us_to_ktime(). This can make the code more concise and
> 
> 
> 
> This makes....
> 
> 
> 
> enhance readability. Therefore, replace ns_to_ktime() with us_to_ktime().
> 
> 
> 
> Perhaps Jonathan may tweak the commit message to be more English, but
> code wise I agree with you.
> Reviewed-by: Andy Shevchenko <andy@kernel.org><mailto:andy@kernel.org>
> 
> --
> With Best Regards,
> Andy Shevchenko
> 
> 
> Okay, thank you!
> 
> Best regards,
> 
> Xichao Zhao
> 

Tweaked description and applied.  Thanks for a nice cleanup.

Jonathan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-16 13:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-13  7:55 [PATCH] iio: adc: ti-tsc2046: use us_to_ktime() where appropriate Xichao Zhao
2025-08-13 10:34 ` Andy Shevchenko
     [not found]   ` <92f45b4d-447e-45ea-8fc0-a003a32d934c@vivo.com>
2025-08-16 13:08     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®