* [PATCH] et131x: use msecs_to_jiffies for conversions
@ 2015-02-11 9:27 Nicholas Mc Guire
2015-02-11 18:11 ` Mark Einon
2015-02-12 3:38 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Nicholas Mc Guire @ 2015-02-11 9:27 UTC (permalink / raw)
To: Mark Einon; +Cc: David S. Miller, netdev, linux-kernel, Nicholas Mc Guire
This is only an API consolidation and should make things more readable.
Converting milliseconds to jiffies by "val * HZ / 1000" is technically
OK but msecs_to_jiffies(val) is the cleaner solution and handles all
corner cases correctly. This is a minor API cleanup only.
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---
Patch was compile-tested only for x86_64_defconfig + CONFIG_ET131X=m
Patch is against 3.19.0 (localversion-next is -next-20150211)
drivers/net/ethernet/agere/et131x.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/agere/et131x.c b/drivers/net/ethernet/agere/et131x.c
index 384dc16..9e78bc7 100644
--- a/drivers/net/ethernet/agere/et131x.c
+++ b/drivers/net/ethernet/agere/et131x.c
@@ -3127,7 +3127,8 @@ static void et131x_error_timer_handler(unsigned long data)
}
/* This is a periodic timer, so reschedule */
- mod_timer(&adapter->error_timer, jiffies + TX_ERROR_PERIOD * HZ / 1000);
+ mod_timer(&adapter->error_timer, jiffies +
+ msecs_to_jiffies(TX_ERROR_PERIOD));
}
static void et131x_adapter_memory_free(struct et131x_adapter *adapter)
@@ -3647,7 +3648,8 @@ static int et131x_open(struct net_device *netdev)
/* Start the timer to track NIC errors */
init_timer(&adapter->error_timer);
- adapter->error_timer.expires = jiffies + TX_ERROR_PERIOD * HZ / 1000;
+ adapter->error_timer.expires = jiffies +
+ msecs_to_jiffies(TX_ERROR_PERIOD);
adapter->error_timer.function = et131x_error_timer_handler;
adapter->error_timer.data = (unsigned long)adapter;
add_timer(&adapter->error_timer);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] et131x: use msecs_to_jiffies for conversions
2015-02-11 9:27 [PATCH] et131x: use msecs_to_jiffies for conversions Nicholas Mc Guire
@ 2015-02-11 18:11 ` Mark Einon
2015-02-12 3:38 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Mark Einon @ 2015-02-11 18:11 UTC (permalink / raw)
To: Nicholas Mc Guire; +Cc: David S. Miller, netdev, linux-kernel
On Wed, Feb 11, 2015 at 04:27:54AM -0500, Nicholas Mc Guire wrote:
> This is only an API consolidation and should make things more readable.
> Converting milliseconds to jiffies by "val * HZ / 1000" is technically
> OK but msecs_to_jiffies(val) is the cleaner solution and handles all
> corner cases correctly. This is a minor API cleanup only.
>
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Acked-by: Mark Einon <mark.einon@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] et131x: use msecs_to_jiffies for conversions
2015-02-11 9:27 [PATCH] et131x: use msecs_to_jiffies for conversions Nicholas Mc Guire
2015-02-11 18:11 ` Mark Einon
@ 2015-02-12 3:38 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-02-12 3:38 UTC (permalink / raw)
To: hofrat; +Cc: mark.einon, netdev, linux-kernel
From: Nicholas Mc Guire <hofrat@osadl.org>
Date: Wed, 11 Feb 2015 04:27:54 -0500
> This is only an API consolidation and should make things more readable.
> Converting milliseconds to jiffies by "val * HZ / 1000" is technically
> OK but msecs_to_jiffies(val) is the cleaner solution and handles all
> corner cases correctly. This is a minor API cleanup only.
>
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-12 3:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-11 9:27 [PATCH] et131x: use msecs_to_jiffies for conversions Nicholas Mc Guire
2015-02-11 18:11 ` Mark Einon
2015-02-12 3:38 ` 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).