diff options
author | Julia Lawall <julia@diku.dk> | 2009-08-01 15:50:31 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-04 16:44:23 -0400 |
commit | 87cdb9894b9367237f25e5a4c381eb8e594e782b (patch) | |
tree | 541b943159a487dc3120f9158b81a25335a522a9 /drivers/net/wireless/strip.c | |
parent | 2c8d51048f6a54aabe2e15278210cb07288e17bb (diff) |
drivers/net/wireless: Use DIV_ROUND_CLOSEST
The kernel.h macro DIV_ROUND_CLOSEST performs the computation (x + d/2)/d
but is perhaps more readable.
The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@haskernel@
@@
#include <linux/kernel.h>
@depends on haskernel@
expression x,__divisor;
@@
- (((x) + ((__divisor) / 2)) / (__divisor))
+ DIV_ROUND_CLOSEST(x,__divisor)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/strip.c')
-rw-r--r-- | drivers/net/wireless/strip.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c index 73300c226f67..ef2cb20e96ad 100644 --- a/drivers/net/wireless/strip.c +++ b/drivers/net/wireless/strip.c | |||
@@ -1550,9 +1550,12 @@ static int strip_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1550 | 1550 | ||
1551 | if (time_after(jiffies, strip_info->pps_timer + HZ)) { | 1551 | if (time_after(jiffies, strip_info->pps_timer + HZ)) { |
1552 | unsigned long t = jiffies - strip_info->pps_timer; | 1552 | unsigned long t = jiffies - strip_info->pps_timer; |
1553 | unsigned long rx_pps_count = (strip_info->rx_pps_count * HZ * 8 + t / 2) / t; | 1553 | unsigned long rx_pps_count = |
1554 | unsigned long tx_pps_count = (strip_info->tx_pps_count * HZ * 8 + t / 2) / t; | 1554 | DIV_ROUND_CLOSEST(strip_info->rx_pps_count*HZ*8, t); |
1555 | unsigned long sx_pps_count = (strip_info->sx_pps_count * HZ * 8 + t / 2) / t; | 1555 | unsigned long tx_pps_count = |
1556 | DIV_ROUND_CLOSEST(strip_info->tx_pps_count*HZ*8, t); | ||
1557 | unsigned long sx_pps_count = | ||
1558 | DIV_ROUND_CLOSEST(strip_info->sx_pps_count*HZ*8, t); | ||
1556 | 1559 | ||
1557 | strip_info->pps_timer = jiffies; | 1560 | strip_info->pps_timer = jiffies; |
1558 | strip_info->rx_pps_count = 0; | 1561 | strip_info->rx_pps_count = 0; |