V4L/DVB: dib3000mc: reduce large stack usage
This patch reduces static stack usage of one of the 2 top offenders as listed by 'make checkstack': Building with CONFIG_FRAME_WARN=2048 produces: drivers/media/dvb/frontends/dib3000mc.c:853: warning: the frame size of 2224 bytes is larger than 2048 bytes and in 'make checkstack', the stack usage goes from: 0x00000bbd dib3000mc_i2c_enumeration [dib3000mc]: 2232 to unlisted with this patch. I don't have the hardware that is needed to test this patch. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Patrick Boettcher <pboettcher@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Родитель
0b42760a75
Коммит
0de8e3533e
|
@ -814,42 +814,51 @@ EXPORT_SYMBOL(dib3000mc_set_config);
|
|||
|
||||
int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib3000mc_config cfg[])
|
||||
{
|
||||
struct dib3000mc_state st = { .i2c_adap = i2c };
|
||||
struct dib3000mc_state *dmcst;
|
||||
int k;
|
||||
u8 new_addr;
|
||||
|
||||
static u8 DIB3000MC_I2C_ADDRESS[] = {20,22,24,26};
|
||||
|
||||
dmcst = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL);
|
||||
if (dmcst == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
dmcst->i2c_adap = i2c;
|
||||
|
||||
for (k = no_of_demods-1; k >= 0; k--) {
|
||||
st.cfg = &cfg[k];
|
||||
dmcst->cfg = &cfg[k];
|
||||
|
||||
/* designated i2c address */
|
||||
new_addr = DIB3000MC_I2C_ADDRESS[k];
|
||||
st.i2c_addr = new_addr;
|
||||
if (dib3000mc_identify(&st) != 0) {
|
||||
st.i2c_addr = default_addr;
|
||||
if (dib3000mc_identify(&st) != 0) {
|
||||
dmcst->i2c_addr = new_addr;
|
||||
if (dib3000mc_identify(dmcst) != 0) {
|
||||
dmcst->i2c_addr = default_addr;
|
||||
if (dib3000mc_identify(dmcst) != 0) {
|
||||
dprintk("-E- DiB3000P/MC #%d: not identified\n", k);
|
||||
kfree(dmcst);
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
|
||||
dib3000mc_set_output_mode(&st, OUTMODE_MPEG2_PAR_CONT_CLK);
|
||||
dib3000mc_set_output_mode(dmcst, OUTMODE_MPEG2_PAR_CONT_CLK);
|
||||
|
||||
// set new i2c address and force divstr (Bit 1) to value 0 (Bit 0)
|
||||
dib3000mc_write_word(&st, 1024, (new_addr << 3) | 0x1);
|
||||
st.i2c_addr = new_addr;
|
||||
dib3000mc_write_word(dmcst, 1024, (new_addr << 3) | 0x1);
|
||||
dmcst->i2c_addr = new_addr;
|
||||
}
|
||||
|
||||
for (k = 0; k < no_of_demods; k++) {
|
||||
st.cfg = &cfg[k];
|
||||
st.i2c_addr = DIB3000MC_I2C_ADDRESS[k];
|
||||
dmcst->cfg = &cfg[k];
|
||||
dmcst->i2c_addr = DIB3000MC_I2C_ADDRESS[k];
|
||||
|
||||
dib3000mc_write_word(&st, 1024, st.i2c_addr << 3);
|
||||
dib3000mc_write_word(dmcst, 1024, dmcst->i2c_addr << 3);
|
||||
|
||||
/* turn off data output */
|
||||
dib3000mc_set_output_mode(&st, OUTMODE_HIGH_Z);
|
||||
dib3000mc_set_output_mode(dmcst, OUTMODE_HIGH_Z);
|
||||
}
|
||||
|
||||
kfree(dmcst);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(dib3000mc_i2c_enumeration);
|
||||
|
|
Загрузка…
Ссылка в новой задаче