Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 250250
b: refs/heads/master
c: e0bae9b
h: refs/heads/master
v: v3
  • Loading branch information
Antti Palosaari authored and Mauro Carvalho Chehab committed May 20, 2011
1 parent 1158960 commit 98d0739
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bedbf3d1451dbecd7a46ffbc6ece28561673b748
refs/heads/master: e0bae9b33a406465bce6f38e9aaeef1ebfcfb461
16 changes: 9 additions & 7 deletions trunk/drivers/media/dvb/frontends/cx24116.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ static int cx24116_load_firmware(struct dvb_frontend *fe,
{
struct cx24116_state *state = fe->demodulator_priv;
struct cx24116_cmd cmd;
int i, ret, len, remaining;
int i, ret, len, max, remaining;
unsigned char vers[4];

dprintk("%s\n", __func__);
Expand Down Expand Up @@ -604,14 +604,16 @@ static int cx24116_load_firmware(struct dvb_frontend *fe,
cx24116_writereg(state, 0xF6, 0x00);

/* Split firmware to the max I2C write len and write.
* This overflows 16 bit intentionally in order to get max write
* len when i2c_wr_max is set to 0. */
for (remaining = fw->size; remaining > 0;
remaining -= (u16) (state->config->i2c_wr_max - 1)) {
* Writes whole firmware as one write when i2c_wr_max is set to 0. */
if (state->config->i2c_wr_max)
max = state->config->i2c_wr_max;
else
max = INT_MAX; /* enough for 32k firmware */

for (remaining = fw->size; remaining > 0; remaining -= max - 1) {
len = remaining;
if (len > (u16) (state->config->i2c_wr_max - 1))
len = (u16) (state->config->i2c_wr_max - 1);
if (len > max - 1)
len = max - 1;

cx24116_writeregN(state, 0xF7, &fw->data[fw->size - remaining],
len);
Expand Down

0 comments on commit 98d0739

Please sign in to comment.