diff options
author | Julia Lawall <julia@diku.dk> | 2009-08-01 16:48:41 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-12 12:19:08 -0300 |
commit | 75b697f747b14b0c6afae48ee0f5e605abd2df4c (patch) | |
tree | 3812e853ff3d8758cded2fdfebb58bdec76babfc /drivers/media/dvb/frontends/ves1820.c | |
parent | 166987c6987a25a95cef6889d24088f0eb2daa36 (diff) | |
download | kernel_samsung_espresso10-75b697f747b14b0c6afae48ee0f5e605abd2df4c.zip kernel_samsung_espresso10-75b697f747b14b0c6afae48ee0f5e605abd2df4c.tar.gz kernel_samsung_espresso10-75b697f747b14b0c6afae48ee0f5e605abd2df4c.tar.bz2 |
V4L/DVB (12483): 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@
@@
@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: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends/ves1820.c')
-rw-r--r-- | drivers/media/dvb/frontends/ves1820.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c index 6e78e48..550a07a 100644 --- a/drivers/media/dvb/frontends/ves1820.c +++ b/drivers/media/dvb/frontends/ves1820.c @@ -165,7 +165,7 @@ static int ves1820_set_symbolrate(struct ves1820_state *state, u32 symbolrate) tmp = ((symbolrate << 4) % fin) << 8; ratio = (ratio << 8) + tmp / fin; tmp = (tmp % fin) << 8; - ratio = (ratio << 8) + (tmp + fin / 2) / fin; + ratio = (ratio << 8) + DIV_ROUND_CLOSEST(tmp, fin); BDR = ratio; BDRI = (((state->config->xin << 5) / symbolrate) + 1) / 2; |