diff options
author | Antti Palosaari <crope@iki.fi> | 2011-05-04 16:23:09 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-05-20 08:30:04 -0400 |
commit | e0bae9b33a406465bce6f38e9aaeef1ebfcfb461 (patch) | |
tree | e8dbe1cc94ed9e556fc8bce3e48d2fa1e431a2ae /drivers/media/dvb/frontends | |
parent | bedbf3d1451dbecd7a46ffbc6ece28561673b748 (diff) |
[media] cx24116: make FW DL split more readable
Change firmware download split, which I introduced few patch earlier,
a little bit to make it more readable as requested [1].
Anyhow, for some reason this seems to increase compiled binary size
52 bytes, on my AMD64 box, which is rather much for so small change.
[1] http://www.spinics.net/lists/linux-media/msg31968.html
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends')
-rw-r--r-- | drivers/media/dvb/frontends/cx24116.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/media/dvb/frontends/cx24116.c b/drivers/media/dvb/frontends/cx24116.c index 26e65a66719a..95c6465b87a1 100644 --- a/drivers/media/dvb/frontends/cx24116.c +++ b/drivers/media/dvb/frontends/cx24116.c | |||
@@ -566,7 +566,7 @@ static int cx24116_load_firmware(struct dvb_frontend *fe, | |||
566 | { | 566 | { |
567 | struct cx24116_state *state = fe->demodulator_priv; | 567 | struct cx24116_state *state = fe->demodulator_priv; |
568 | struct cx24116_cmd cmd; | 568 | struct cx24116_cmd cmd; |
569 | int i, ret, len, remaining; | 569 | int i, ret, len, max, remaining; |
570 | unsigned char vers[4]; | 570 | unsigned char vers[4]; |
571 | 571 | ||
572 | dprintk("%s\n", __func__); | 572 | dprintk("%s\n", __func__); |
@@ -604,14 +604,16 @@ static int cx24116_load_firmware(struct dvb_frontend *fe, | |||
604 | cx24116_writereg(state, 0xF6, 0x00); | 604 | cx24116_writereg(state, 0xF6, 0x00); |
605 | 605 | ||
606 | /* Split firmware to the max I2C write len and write. | 606 | /* Split firmware to the max I2C write len and write. |
607 | * This overflows 16 bit intentionally in order to get max write | 607 | * Writes whole firmware as one write when i2c_wr_max is set to 0. */ |
608 | * len when i2c_wr_max is set to 0. */ | 608 | if (state->config->i2c_wr_max) |
609 | for (remaining = fw->size; remaining > 0; | 609 | max = state->config->i2c_wr_max; |
610 | remaining -= (u16) (state->config->i2c_wr_max - 1)) { | 610 | else |
611 | max = INT_MAX; /* enough for 32k firmware */ | ||
611 | 612 | ||
613 | for (remaining = fw->size; remaining > 0; remaining -= max - 1) { | ||
612 | len = remaining; | 614 | len = remaining; |
613 | if (len > (u16) (state->config->i2c_wr_max - 1)) | 615 | if (len > max - 1) |
614 | len = (u16) (state->config->i2c_wr_max - 1); | 616 | len = max - 1; |
615 | 617 | ||
616 | cx24116_writeregN(state, 0xF7, &fw->data[fw->size - remaining], | 618 | cx24116_writeregN(state, 0xF7, &fw->data[fw->size - remaining], |
617 | len); | 619 | len); |