diff mbox series

[V3,5/13] hid: use time_is_after_jiffies() instead of open coding it

Message ID 1644890154-64915-6-git-send-email-wangqing@vivo.com (mailing list archive)
State New, archived
Headers show
Series use time_is_{before,after}_jiffies() instead of open coding it | expand

Commit Message

王擎 Feb. 15, 2022, 1:55 a.m. UTC
From: Wang Qing <wangqing@vivo.com>

Use the helper function time_is_{before,after}_jiffies() to improve
code readability.

Signed-off-by: Wang Qing <wangqing@vivo.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 drivers/hid/intel-ish-hid/ipc/ipc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Benjamin Tissoires Feb. 15, 2022, 8:47 a.m. UTC | #1
On Tue, Feb 15, 2022 at 2:56 AM Qing Wang <wangqing@vivo.com> wrote:
>
> From: Wang Qing <wangqing@vivo.com>
>
> Use the helper function time_is_{before,after}_jiffies() to improve
> code readability.
>
> Signed-off-by: Wang Qing <wangqing@vivo.com>
> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

FWIW, this one is
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Wang, is there any plan to take this series through the trivial tree
or should each maintainer take the matching patches?

Cheers,
Benjamin

> ---
>  drivers/hid/intel-ish-hid/ipc/ipc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-ish-hid/ipc/ipc.c
> index 8ccb246..15e1423
> --- a/drivers/hid/intel-ish-hid/ipc/ipc.c
> +++ b/drivers/hid/intel-ish-hid/ipc/ipc.c
> @@ -578,7 +578,7 @@ static void _ish_sync_fw_clock(struct ishtp_device *dev)
>         static unsigned long    prev_sync;
>         uint64_t        usec;
>
> -       if (prev_sync && jiffies - prev_sync < 20 * HZ)
> +       if (prev_sync && time_is_after_jiffies(prev_sync + 20 * HZ))
>                 return;
>
>         prev_sync = jiffies;
> --
> 2.7.4
>
王擎 Feb. 15, 2022, 9:03 a.m. UTC | #2
>>On Tue, Feb 15, 2022 at 2:56 AM Qing Wang <wangqing@vivo.com> wrote:
>>
>> From: Wang Qing <wangqing@vivo.com>
>>
>> Use the helper function time_is_{before,after}_jiffies() to improve
>> code readability.
>>
>> Signed-off-by: Wang Qing <wangqing@vivo.com>
>> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
>
>FWIW, this one is
>Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
>
>Wang, is there any plan to take this series through the trivial tree

That's why I batch them in a series, but I don't know how to take 
this series through the trivial tree directly.

I would appreciate if you could help.

Thanks,
Wang

>or should each maintainer take the matching patches?
>
>Cheers,
>Benjamin
>
>> ---
>>  drivers/hid/intel-ish-hid/ipc/ipc.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-ish-hid/ipc/ipc.c
>> index 8ccb246..15e1423
>> --- a/drivers/hid/intel-ish-hid/ipc/ipc.c
>> +++ b/drivers/hid/intel-ish-hid/ipc/ipc.c
>> @@ -578,7 +578,7 @@ static void _ish_sync_fw_clock(struct ishtp_device *dev)
>>         static unsigned long    prev_sync;
>>         uint64_t        usec;
>>
>> -       if (prev_sync && jiffies - prev_sync < 20 * HZ)
>> +       if (prev_sync && time_is_after_jiffies(prev_sync + 20 * HZ))
>>                 return;
>>
>>         prev_sync = jiffies;
>> --
>> 2.7.4
>>
diff mbox series

Patch

diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-ish-hid/ipc/ipc.c
index 8ccb246..15e1423
--- a/drivers/hid/intel-ish-hid/ipc/ipc.c
+++ b/drivers/hid/intel-ish-hid/ipc/ipc.c
@@ -578,7 +578,7 @@  static void _ish_sync_fw_clock(struct ishtp_device *dev)
 	static unsigned long	prev_sync;
 	uint64_t	usec;
 
-	if (prev_sync && jiffies - prev_sync < 20 * HZ)
+	if (prev_sync && time_is_after_jiffies(prev_sync + 20 * HZ))
 		return;
 
 	prev_sync = jiffies;