netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] tlan: msecs_to_jiffies convrsion
@ 2015-02-03  8:45 Nicholas Mc Guire
  2015-02-04 21:58 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Mc Guire @ 2015-02-03  8:45 UTC (permalink / raw)
  To: Samuel Chessman; +Cc: netdev, linux-kernel, Nicholas Mc Guire

This is only an API consolidation and should make things more readable
it replaces var * HZ / 1000 by msecs_to_jiffies(var).

As there is a discrepancy between the code and the comments this is in
a separate patch.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

Converting milliseconds to jiffies by val * HZ / 1000 is technically
not wrong but msecs_to_jiffies(val) is the cleaner solution and handles
all corner cases correctly. This basically is a minor API cleanup only
but the comment and the code do not match ! Comments states "do the
longer, just in case" which would be 500 ms - the code though sets it
to HZ/20 == 50ms. This needs a review by someone that knows the driver
details to decide if it should be 50 or 500ms here.

Patch was only compile tested for x86_64_defconfig + CONFIG_TLAN=m

Patch is against 3.0.19-rc7 (localversion = -next-20150203)

 drivers/net/ethernet/ti/tlan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c
index 1f722c9..691ec93 100644
--- a/drivers/net/ethernet/ti/tlan.c
+++ b/drivers/net/ethernet/ti/tlan.c
@@ -2561,7 +2561,7 @@ static void tlan_phy_power_up(struct net_device *dev)
 	 * transceiver.  The TLAN docs say both 50 ms and
 	 * 500 ms, so do the longer, just in case.
 	 */
-	tlan_set_timer(dev, (HZ/20), TLAN_TIMER_PHY_RESET);
+	tlan_set_timer(dev, msecs_to_jiffies(500), TLAN_TIMER_PHY_RESET);
 
 }
 
-- 
1.7.10.4

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

* Re: [PATCH 2/2] tlan: msecs_to_jiffies convrsion
  2015-02-03  8:45 [PATCH 2/2] tlan: msecs_to_jiffies convrsion Nicholas Mc Guire
@ 2015-02-04 21:58 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-02-04 21:58 UTC (permalink / raw)
  To: hofrat; +Cc: chessman, netdev, linux-kernel

From: Nicholas Mc Guire <hofrat@osadl.org>
Date: Tue,  3 Feb 2015 03:45:11 -0500

> This is only an API consolidation and should make things more readable
> it replaces var * HZ / 1000 by msecs_to_jiffies(var).
> 
> As there is a discrepancy between the code and the comments this is in
> a separate patch.
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>

Applied.

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

end of thread, other threads:[~2015-02-04 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-03  8:45 [PATCH 2/2] tlan: msecs_to_jiffies convrsion Nicholas Mc Guire
2015-02-04 21:58 ` David Miller

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).