Skip to content

Commit

Permalink
media: tuners/qm1d1c0042: Use DIV_ROUND_CLOSEST directly to make it r…
Browse files Browse the repository at this point in the history
…eadable

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

Signed-off-by: Zhong Jiang <[email protected]>
Signed-off-by: Sean Young <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
xiongzhongjiang authored and mchehab committed Oct 16, 2019
1 parent 727fe90 commit 0f123f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/media/tuners/qm1d1c0042.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static int qm1d1c0042_set_params(struct dvb_frontend *fe)
if (ret < 0)
return ret;

a = (freq + state->cfg.xtal_freq / 2) / state->cfg.xtal_freq;
a = DIV_ROUND_CLOSEST(freq, state->cfg.xtal_freq);

state->regs[0x06] &= 0x40;
state->regs[0x06] |= (a - 12) / 4;
Expand Down

0 comments on commit 0f123f8

Please sign in to comment.