Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: tuners/qm1d1c0042: Use DIV_ROUND_CLOSEST directly to make it readable

The kernel.h macro DIV_ROUND_CLOSEST performs the computation (x + d/2)/d
but is perhaps more readable.

Signed-off-by: Zhong Jiang <zhongjiang@huawei.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

authored by

zhong jiang and committed by
Mauro Carvalho Chehab
0f123f82 727fe909

+1 -1
+1 -1
drivers/media/tuners/qm1d1c0042.c
··· 206 206 if (ret < 0) 207 207 return ret; 208 208 209 - a = (freq + state->cfg.xtal_freq / 2) / state->cfg.xtal_freq; 209 + a = DIV_ROUND_CLOSEST(freq, state->cfg.xtal_freq); 210 210 211 211 state->regs[0x06] &= 0x40; 212 212 state->regs[0x06] |= (a - 12) / 4;