Skip to content

Commit

Permalink
[media] rtl2832_sdr: remove plain 64-bit divisions
Browse files Browse the repository at this point in the history
Commit 0ba2aeb
(v4l2-ctrls: increase internal min/max/step/def to 64 bit)
changes v4l2 controls to 64-bit. Driver it not working on 32-bit
arch as it uses directly control 'step' which is changed to 64-bit.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
  • Loading branch information
Antti Palosaari authored and Mauro Carvalho Chehab committed Jul 22, 2014
1 parent 9aabd95 commit a98ccfc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/media/dvb-frontends/rtl2832_sdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1364,17 +1364,16 @@ static int rtl2832_sdr_s_ctrl(struct v4l2_ctrl *ctrl)
/* TODO: these controls should be moved to tuner drivers */
if (s->bandwidth_auto->val) {
/* Round towards the closest legal value */
s32 val = s->f_adc + s->bandwidth->step / 2;
s32 val = s->f_adc + div_u64(s->bandwidth->step, 2);
u32 offset;

val = clamp_t(s32, val, s->bandwidth->minimum,
s->bandwidth->maximum);
offset = val - s->bandwidth->minimum;
offset = s->bandwidth->step *
(offset / s->bandwidth->step);
div_u64(offset, s->bandwidth->step);
s->bandwidth->val = s->bandwidth->minimum + offset;
}

c->bandwidth_hz = s->bandwidth->val;

if (!test_bit(POWER_ON, &s->flags))
Expand Down

0 comments on commit a98ccfc

Please sign in to comment.