* [PATCH] micrel: Use time_before_eq()
@ 2014-05-22 17:52 Manuel Schölling
2014-05-22 19:50 ` David Miller
2014-05-22 23:06 ` Julia Lawall
0 siblings, 2 replies; 3+ messages in thread
From: Manuel Schölling @ 2014-05-22 17:52 UTC (permalink / raw)
To: davem
Cc: jg1.han, dingtianhong, ebiederm, Julia.Lawall, netdev,
linux-kernel, kernel-janitors, Manuel Schölling
To be future-proof and for better readability the time comparisons are modified
to use time_before_eq() instead of plain, error-prone math.
Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
---
drivers/net/ethernet/micrel/ksz884x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
index 14ac0e2..90fa5f3 100644
--- a/drivers/net/ethernet/micrel/ksz884x.c
+++ b/drivers/net/ethernet/micrel/ksz884x.c
@@ -4930,7 +4930,7 @@ static void netdev_tx_timeout(struct net_device *dev)
* Only reset the hardware if time between calls is long
* enough.
*/
- if (jiffies - last_reset <= dev->watchdog_timeo)
+ if (time_before_eq(jiffies, last_reset + dev->watchdog_timeo))
hw_priv = NULL;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] micrel: Use time_before_eq()
2014-05-22 17:52 [PATCH] micrel: Use time_before_eq() Manuel Schölling
@ 2014-05-22 19:50 ` David Miller
2014-05-22 23:06 ` Julia Lawall
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-05-22 19:50 UTC (permalink / raw)
To: manuel.schoelling
Cc: jg1.han, dingtianhong, ebiederm, Julia.Lawall, netdev,
linux-kernel, kernel-janitors
From: Manuel Schölling <manuel.schoelling@gmx.de>
Date: Thu, 22 May 2014 19:52:45 +0200
> To be future-proof and for better readability the time comparisons are modified
> to use time_before_eq() instead of plain, error-prone math.
>
> Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] micrel: Use time_before_eq()
2014-05-22 17:52 [PATCH] micrel: Use time_before_eq() Manuel Schölling
2014-05-22 19:50 ` David Miller
@ 2014-05-22 23:06 ` Julia Lawall
1 sibling, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2014-05-22 23:06 UTC (permalink / raw)
To: Manuel Schölling
Cc: davem, jg1.han, dingtianhong, ebiederm, Julia.Lawall, netdev,
linux-kernel, kernel-janitors
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1065 bytes --]
On Thu, 22 May 2014, Manuel Schölling wrote:
> To be future-proof and for better readability the time comparisons are modified
> to use time_before_eq() instead of plain, error-prone math.
I had the impression that the real reason for these functions was that
they were somehow sensitive to the possibility of overflow of jiffies?
julia
> Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
> ---
> drivers/net/ethernet/micrel/ksz884x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
> index 14ac0e2..90fa5f3 100644
> --- a/drivers/net/ethernet/micrel/ksz884x.c
> +++ b/drivers/net/ethernet/micrel/ksz884x.c
> @@ -4930,7 +4930,7 @@ static void netdev_tx_timeout(struct net_device *dev)
> * Only reset the hardware if time between calls is long
> * enough.
> */
> - if (jiffies - last_reset <= dev->watchdog_timeo)
> + if (time_before_eq(jiffies, last_reset + dev->watchdog_timeo))
> hw_priv = NULL;
> }
>
> --
> 1.7.10.4
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-05-22 23:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-22 17:52 [PATCH] micrel: Use time_before_eq() Manuel Schölling
2014-05-22 19:50 ` David Miller
2014-05-22 23:06 ` Julia Lawall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).