Message ID | Pine.LNX.4.64.0908021048280.15557@ask.diku.dk |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: Julia Lawall <julia@diku.dk> Date: Sun, 2 Aug 2009 10:48:45 +0200 (CEST) > From: Julia Lawall <julia@diku.dk> > > The kernel.h macro DIV_ROUND_CLOSEST performs the computation (x + d/2)/d > but is perhaps more readable. Applied. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c index 6b969f8..01ce241 100644 --- a/drivers/atm/horizon.c +++ b/drivers/atm/horizon.c @@ -641,7 +641,7 @@ static int make_rate (const hrz_dev * dev, u32 c, rounding r, pre = 1; break; case round_nearest: - pre = (br+(c<<div)/2)/(c<<div); + pre = DIV_ROUND_CLOSEST(br, c<<div); // but p must be non-zero if (!pre) pre = 1; @@ -671,7 +671,7 @@ static int make_rate (const hrz_dev * dev, u32 c, rounding r, pre = DIV_ROUND_UP(br, c<<div); break; case round_nearest: - pre = (br+(c<<div)/2)/(c<<div); + pre = DIV_ROUND_CLOSEST(br, c<<div); break; default: /* round_up */ pre = br/(c<<div);