From patchwork Tue Mar 30 18:02:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Maraschini X-Patchwork-Id: 89355 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2UI2s2G008323 for ; Tue, 30 Mar 2010 18:02:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755277Ab0C3SCv (ORCPT ); Tue, 30 Mar 2010 14:02:51 -0400 Received: from mail-vw0-f46.google.com ([209.85.212.46]:61388 "EHLO mail-vw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754975Ab0C3SCv (ORCPT ); Tue, 30 Mar 2010 14:02:51 -0400 Received: by vws20 with SMTP id 20so910588vws.19 for ; Tue, 30 Mar 2010 11:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:content-type :content-transfer-encoding; bh=kg3mPCNWlSvi5AbJ8eyi9wQyJVVFsCi3mZKTH99eyuc=; b=MWwmqEtVBlGiIM5QxscLaeK8DE7nDFtqqpkHA9rmEeNVJ7NIbVp95wltQLRhaUyrXy CQsjaCnokPj/mjzLcyM+4t1pUZzpprS+XKC1b+nlO5+a4eBfINcKwa7sJbx8kv/+kiEH cvjNXrJbW2bM92grC9yDThaRW7HcWU5OG6Y1Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; b=VwjBp0317CxXqEqJj6rBPbe6Lh9pJ58kCoifJD+INF3YOVtN5ANm7gBP7H0tUo1t1L fbCScWYdSiBSK7uV0n0Vl0wtMQ/VHzkUvS7ZVICH6ZFHByCJBrAkNq4Cpo+e3kmsVu6D mzr6ww96wmt5Xw/DeSU/LPuZtm4gKXl66EI3Q= Received: by 10.220.122.220 with SMTP id m28mr4080282vcr.2.1269972168396; Tue, 30 Mar 2010 11:02:48 -0700 (PDT) Received: from [192.168.10.170] ([200.175.93.74]) by mx.google.com with ESMTPS id 31sm124638855vws.7.2010.03.30.11.02.45 (version=SSLv3 cipher=RC4-MD5); Tue, 30 Mar 2010 11:02:47 -0700 (PDT) Message-ID: <4BB23CB0.1080501@gmail.com> Date: Tue, 30 Mar 2010 15:02:24 -0300 From: Ricardo Maraschini User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Thunderbird/3.0.3 MIME-Version: 1.0 To: linux-media@vger.kernel.org CC: dougsland@gmail.com, mchehab@infradead.org Subject: [PATCH] dib7000p.c: Fix for warning: the frame size of 1236 bytes is larger than 1024 bytes Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 30 Mar 2010 18:02:55 +0000 (UTC) --- a/linux/drivers/media/dvb/frontends/dib7000p.c Sat Mar 27 23:09:47 2010 -0300 +++ b/linux/drivers/media/dvb/frontends/dib7000p.c Tue Mar 30 13:03:59 2010 -0300 @@ -1349,46 +1349,57 @@ int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib7000p_config cfg[]) { - struct dib7000p_state st = { .i2c_adap = i2c }; + struct dib7000p_state *st = NULL; int k = 0; u8 new_addr = 0; + st = kmalloc(sizeof(struct dib7000p_state), GFP_KERNEL); + if (!st) { + dprintk("DiB7000P: Unable to allocate memory\n"); + return -ENOMEM; + } + + st->i2c_adap = i2c; + + for (k = no_of_demods-1; k >= 0; k--) { - st.cfg = cfg[k]; + st->cfg = cfg[k]; /* designated i2c address */ new_addr = (0x40 + k) << 1; - st.i2c_addr = new_addr; - dib7000p_write_word(&st, 1287, 0x0003); /* sram lead in, rdy */ - if (dib7000p_identify(&st) != 0) { - st.i2c_addr = default_addr; - dib7000p_write_word(&st, 1287, 0x0003); /* sram lead in, rdy */ - if (dib7000p_identify(&st) != 0) { + st->i2c_addr = new_addr; + dib7000p_write_word(st, 1287, 0x0003); /* sram lead in, rdy */ + if (dib7000p_identify(st) != 0) { + st->i2c_addr = default_addr; + dib7000p_write_word(st, 1287, 0x0003); /* sram lead in, rdy */ + if (dib7000p_identify(st) != 0) { dprintk("DiB7000P #%d: not identified\n", k); + kfree(st); return -EIO; } } /* start diversity to pull_down div_str - just for i2c-enumeration */ - dib7000p_set_output_mode(&st, OUTMODE_DIVERSITY); + dib7000p_set_output_mode(st, OUTMODE_DIVERSITY); /* set new i2c address and force divstart */ - dib7000p_write_word(&st, 1285, (new_addr << 2) | 0x2); + dib7000p_write_word(st, 1285, (new_addr << 2) | 0x2); dprintk("IC %d initialized (to i2c_address 0x%x)", k, new_addr); } for (k = 0; k < no_of_demods; k++) { - st.cfg = cfg[k]; - st.i2c_addr = (0x40 + k) << 1; + st->cfg = cfg[k]; + st->i2c_addr = (0x40 + k) << 1; // unforce divstr - dib7000p_write_word(&st, 1285, st.i2c_addr << 2); + dib7000p_write_word(st, 1285, st->i2c_addr << 2); /* deactivate div - it was just for i2c-enumeration */ - dib7000p_set_output_mode(&st, OUTMODE_HIGH_Z); + dib7000p_set_output_mode(st, OUTMODE_HIGH_Z); } + kfree(st); return 0; } EXPORT_SYMBOL(dib7000p_i2c_enumeration);