Commit 4133601c authored by Jemma Denson's avatar Jemma Denson Committed by Mauro Carvalho Chehab

[media] cx24120: More tidying in cx24120_init

Remove reg1 by refactoring for loops
Change ret into an int as it's only used for return values now,
and remove reset_result by using ret instead.
Signed-off-by: default avatarJemma Denson <jdenson@gmail.com>
Signed-off-by: default avatarPatrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 1668797d
...@@ -1181,10 +1181,8 @@ int cx24120_init(struct dvb_frontend *fe) ...@@ -1181,10 +1181,8 @@ int cx24120_init(struct dvb_frontend *fe)
struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dtv_frontend_properties *c = &fe->dtv_property_cache;
struct cx24120_state *state = fe->demodulator_priv; struct cx24120_state *state = fe->demodulator_priv;
struct cx24120_cmd cmd; struct cx24120_cmd cmd;
u8 ret, reg, reg1; u8 reg;
int reset_result; int ret, i;
int i;
unsigned char vers[4]; unsigned char vers[4];
if (state->cold_init) if (state->cold_init)
...@@ -1211,15 +1209,15 @@ int cx24120_init(struct dvb_frontend *fe) ...@@ -1211,15 +1209,15 @@ int cx24120_init(struct dvb_frontend *fe)
cx24120_writereg(state, 0xf3, 0x03); cx24120_writereg(state, 0xf3, 0x03);
cx24120_writereg(state, 0xf4, 0x44); cx24120_writereg(state, 0xf4, 0x44);
for (reg1 = 0xf0; reg1 < 0xf3; reg1++) { for (i = 0; i < 3; i++) {
cx24120_writereg(state, reg1, 0x04); cx24120_writereg(state, 0xf0 + i, 0x04);
cx24120_writereg(state, reg1 - 10, 0x02); cx24120_writereg(state, 0xe6 + i, 0x02);
} }
cx24120_writereg(state, 0xea, (reg | 0x01)); cx24120_writereg(state, 0xea, (reg | 0x01));
for (reg1 = 0xc5; reg1 < 0xcb; reg1 += 2) { for (i = 0; i < 6; i += 2) {
cx24120_writereg(state, reg1, 0x00); cx24120_writereg(state, 0xc5 + i, 0x00);
cx24120_writereg(state, reg1 + 1, 0x00); cx24120_writereg(state, 0xc6 + i, 0x00);
} }
cx24120_writereg(state, 0xe4, 0x03); cx24120_writereg(state, 0xe4, 0x03);
...@@ -1266,15 +1264,15 @@ int cx24120_init(struct dvb_frontend *fe) ...@@ -1266,15 +1264,15 @@ int cx24120_init(struct dvb_frontend *fe)
reg = cx24120_readreg(state, 0xe1); reg = cx24120_readreg(state, 0xe1);
if (reg == fw->data[fw->size - 1]) { if (reg == fw->data[fw->size - 1]) {
dev_dbg(&state->i2c->dev, "Firmware uploaded successfully\n"); dev_dbg(&state->i2c->dev, "Firmware uploaded successfully\n");
reset_result = 0; ret = 0;
} else { } else {
err("Firmware upload failed. Last byte returned=0x%x\n", ret); err("Firmware upload failed. Last byte returned=0x%x\n", ret);
reset_result = -EREMOTEIO; ret = -EREMOTEIO;
} }
cx24120_writereg(state, 0xdc, 0x00); cx24120_writereg(state, 0xdc, 0x00);
release_firmware(fw); release_firmware(fw);
if (reset_result != 0) if (ret != 0)
return reset_result; return ret;
/* Start tuner */ /* Start tuner */
cmd.id = CMD_START_TUNER; cmd.id = CMD_START_TUNER;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment