aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRandy Dunlap <randy.dunlap@oracle.com>2010-02-08 18:30:33 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 11:58:31 -0400
commit0de8e3533e08745616a30bdb3fa5106c85083e51 (patch)
tree88ebe4b92bc4b11c5d534f2259e30466a1270718
parent0b42760a75afb852be6718fb5e6b54988123b40e (diff)
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>
-rw-r--r--drivers/media/dvb/frontends/dib3000mc.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c
index 40a099810279..afad252abf41 100644
--- a/drivers/media/dvb/frontends/dib3000mc.c
+++ b/drivers/media/dvb/frontends/dib3000mc.c
@@ -814,42 +814,51 @@ EXPORT_SYMBOL(dib3000mc_set_config);
814 814
815int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib3000mc_config cfg[]) 815int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib3000mc_config cfg[])
816{ 816{
817 struct dib3000mc_state st = { .i2c_adap = i2c }; 817 struct dib3000mc_state *dmcst;
818 int k; 818 int k;
819 u8 new_addr; 819 u8 new_addr;
820 820
821 static u8 DIB3000MC_I2C_ADDRESS[] = {20,22,24,26}; 821 static u8 DIB3000MC_I2C_ADDRESS[] = {20,22,24,26};
822 822
823 dmcst = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL);
824 if (dmcst == NULL)
825 return -ENODEV;
826
827 dmcst->i2c_adap = i2c;
828
823 for (k = no_of_demods-1; k >= 0; k--) { 829 for (k = no_of_demods-1; k >= 0; k--) {
824 st.cfg = &cfg[k]; 830 dmcst->cfg = &cfg[k];
825 831
826 /* designated i2c address */ 832 /* designated i2c address */
827 new_addr = DIB3000MC_I2C_ADDRESS[k]; 833 new_addr = DIB3000MC_I2C_ADDRESS[k];
828 st.i2c_addr = new_addr; 834 dmcst->i2c_addr = new_addr;
829 if (dib3000mc_identify(&st) != 0) { 835 if (dib3000mc_identify(dmcst) != 0) {
830 st.i2c_addr = default_addr; 836 dmcst->i2c_addr = default_addr;
831 if (dib3000mc_identify(&st) != 0) { 837 if (dib3000mc_identify(dmcst) != 0) {
832 dprintk("-E- DiB3000P/MC #%d: not identified\n", k); 838 dprintk("-E- DiB3000P/MC #%d: not identified\n", k);
839 kfree(dmcst);
833 return -ENODEV; 840 return -ENODEV;
834 } 841 }
835 } 842 }
836 843
837 dib3000mc_set_output_mode(&st, OUTMODE_MPEG2_PAR_CONT_CLK); 844 dib3000mc_set_output_mode(dmcst, OUTMODE_MPEG2_PAR_CONT_CLK);
838 845
839 // set new i2c address and force divstr (Bit 1) to value 0 (Bit 0) 846 // set new i2c address and force divstr (Bit 1) to value 0 (Bit 0)
840 dib3000mc_write_word(&st, 1024, (new_addr << 3) | 0x1); 847 dib3000mc_write_word(dmcst, 1024, (new_addr << 3) | 0x1);
841 st.i2c_addr = new_addr; 848 dmcst->i2c_addr = new_addr;
842 } 849 }
843 850
844 for (k = 0; k < no_of_demods; k++) { 851 for (k = 0; k < no_of_demods; k++) {
845 st.cfg = &cfg[k]; 852 dmcst->cfg = &cfg[k];
846 st.i2c_addr = DIB3000MC_I2C_ADDRESS[k]; 853 dmcst->i2c_addr = DIB3000MC_I2C_ADDRESS[k];
847 854
848 dib3000mc_write_word(&st, 1024, st.i2c_addr << 3); 855 dib3000mc_write_word(dmcst, 1024, dmcst->i2c_addr << 3);
849 856
850 /* turn off data output */ 857 /* turn off data output */
851 dib3000mc_set_output_mode(&st, OUTMODE_HIGH_Z); 858 dib3000mc_set_output_mode(dmcst, OUTMODE_HIGH_Z);
852 } 859 }
860
861 kfree(dmcst);
853 return 0; 862 return 0;
854} 863}
855EXPORT_SYMBOL(dib3000mc_i2c_enumeration); 864EXPORT_SYMBOL(dib3000mc_i2c_enumeration);