diff options
author | Randy Dunlap <randy.dunlap@oracle.com> | 2010-02-08 18:30:44 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:58:30 -0400 |
commit | 30d81bb086c84d54cde4dd4d0c75d9455224632b (patch) | |
tree | 052b04fc32e00d36f549f1990cd3492e5a05de1b /drivers/media/dvb/frontends | |
parent | 84e2f037ce9672d0fb118e3e82cecfe6122ace3f (diff) |
V4L/DVB: dib7000p: 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/dib7000p.c:1367: warning: the frame size of 2320 bytes is larger than 2048 bytes
and in 'make checkstack', the stack usage goes from:
0x00002409 dib7000p_i2c_enumeration [dib7000p]: 2328
to unlisted with this patch.
Also change one caller of dib7000p_i2c_enumeration() to check its
return value.
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends')
-rw-r--r-- | drivers/media/dvb/frontends/dib7000p.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c index 85468a45c344..113fc1394d5d 100644 --- a/drivers/media/dvb/frontends/dib7000p.c +++ b/drivers/media/dvb/frontends/dib7000p.c | |||
@@ -1324,46 +1324,54 @@ EXPORT_SYMBOL(dib7000p_pid_filter); | |||
1324 | 1324 | ||
1325 | int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib7000p_config cfg[]) | 1325 | int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib7000p_config cfg[]) |
1326 | { | 1326 | { |
1327 | struct dib7000p_state st = { .i2c_adap = i2c }; | 1327 | struct dib7000p_state *dpst; |
1328 | int k = 0; | 1328 | int k = 0; |
1329 | u8 new_addr = 0; | 1329 | u8 new_addr = 0; |
1330 | 1330 | ||
1331 | dpst = kzalloc(sizeof(struct dib7000p_state), GFP_KERNEL); | ||
1332 | if (!dpst) | ||
1333 | return -ENODEV; | ||
1334 | |||
1335 | dpst->i2c_adap = i2c; | ||
1336 | |||
1331 | for (k = no_of_demods-1; k >= 0; k--) { | 1337 | for (k = no_of_demods-1; k >= 0; k--) { |
1332 | st.cfg = cfg[k]; | 1338 | dpst->cfg = cfg[k]; |
1333 | 1339 | ||
1334 | /* designated i2c address */ | 1340 | /* designated i2c address */ |
1335 | new_addr = (0x40 + k) << 1; | 1341 | new_addr = (0x40 + k) << 1; |
1336 | st.i2c_addr = new_addr; | 1342 | dpst->i2c_addr = new_addr; |
1337 | dib7000p_write_word(&st, 1287, 0x0003); /* sram lead in, rdy */ | 1343 | dib7000p_write_word(dpst, 1287, 0x0003); /* sram lead in, rdy */ |
1338 | if (dib7000p_identify(&st) != 0) { | 1344 | if (dib7000p_identify(dpst) != 0) { |
1339 | st.i2c_addr = default_addr; | 1345 | dpst->i2c_addr = default_addr; |
1340 | dib7000p_write_word(&st, 1287, 0x0003); /* sram lead in, rdy */ | 1346 | dib7000p_write_word(dpst, 1287, 0x0003); /* sram lead in, rdy */ |
1341 | if (dib7000p_identify(&st) != 0) { | 1347 | if (dib7000p_identify(dpst) != 0) { |
1342 | dprintk("DiB7000P #%d: not identified\n", k); | 1348 | dprintk("DiB7000P #%d: not identified\n", k); |
1349 | kfree(dpst); | ||
1343 | return -EIO; | 1350 | return -EIO; |
1344 | } | 1351 | } |
1345 | } | 1352 | } |
1346 | 1353 | ||
1347 | /* start diversity to pull_down div_str - just for i2c-enumeration */ | 1354 | /* start diversity to pull_down div_str - just for i2c-enumeration */ |
1348 | dib7000p_set_output_mode(&st, OUTMODE_DIVERSITY); | 1355 | dib7000p_set_output_mode(dpst, OUTMODE_DIVERSITY); |
1349 | 1356 | ||
1350 | /* set new i2c address and force divstart */ | 1357 | /* set new i2c address and force divstart */ |
1351 | dib7000p_write_word(&st, 1285, (new_addr << 2) | 0x2); | 1358 | dib7000p_write_word(dpst, 1285, (new_addr << 2) | 0x2); |
1352 | 1359 | ||
1353 | dprintk("IC %d initialized (to i2c_address 0x%x)", k, new_addr); | 1360 | dprintk("IC %d initialized (to i2c_address 0x%x)", k, new_addr); |
1354 | } | 1361 | } |
1355 | 1362 | ||
1356 | for (k = 0; k < no_of_demods; k++) { | 1363 | for (k = 0; k < no_of_demods; k++) { |
1357 | st.cfg = cfg[k]; | 1364 | dpst->cfg = cfg[k]; |
1358 | st.i2c_addr = (0x40 + k) << 1; | 1365 | dpst->i2c_addr = (0x40 + k) << 1; |
1359 | 1366 | ||
1360 | // unforce divstr | 1367 | // unforce divstr |
1361 | dib7000p_write_word(&st, 1285, st.i2c_addr << 2); | 1368 | dib7000p_write_word(dpst, 1285, dpst->i2c_addr << 2); |
1362 | 1369 | ||
1363 | /* deactivate div - it was just for i2c-enumeration */ | 1370 | /* deactivate div - it was just for i2c-enumeration */ |
1364 | dib7000p_set_output_mode(&st, OUTMODE_HIGH_Z); | 1371 | dib7000p_set_output_mode(dpst, OUTMODE_HIGH_Z); |
1365 | } | 1372 | } |
1366 | 1373 | ||
1374 | kfree(dpst); | ||
1367 | return 0; | 1375 | return 0; |
1368 | } | 1376 | } |
1369 | EXPORT_SYMBOL(dib7000p_i2c_enumeration); | 1377 | EXPORT_SYMBOL(dib7000p_i2c_enumeration); |