From: Arnd Bergmann <arnd@arndb.de>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>, Peter Rosin <peda@axentia.se>,
Wolfram Sang <wsa@the-dreams.de>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] [media] cx231xx-i2c: reduce stack size in bus scan
Date: Thu, 2 Feb 2017 15:53:06 +0100 [thread overview]
Message-ID: <20170202145318.3803805-3-arnd@arndb.de> (raw)
In-Reply-To: <20170202145318.3803805-1-arnd@arndb.de>
The cx231xx_do_i2c_scan function needs a lot of stack because
it puts an i2c_client structure on it:
drivers/media/usb/cx231xx/cx231xx-i2c.c: In function 'cx231xx_do_i2c_scan':
drivers/media/usb/cx231xx/cx231xx-i2c.c:518:1: error: the frame size of 1248 bytes is larger than 1152 bytes [-Werror=frame-larger-than=]
This changes it to call i2c_transfer() directly instead, avoiding the
need for the structure.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/media/usb/cx231xx/cx231xx-i2c.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c
index 35e9acfe63d3..24e23a06d8c6 100644
--- a/drivers/media/usb/cx231xx/cx231xx-i2c.c
+++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c
@@ -491,20 +491,24 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port)
{
unsigned char buf;
int i, rc;
- struct i2c_client client;
+ struct i2c_adapter *adap;
+ struct i2c_msg msg = {
+ .flags = I2C_M_RD,
+ .len = 1,
+ .buf = &buf,
+ };
if (!i2c_scan)
return;
/* Don't generate I2C errors during scan */
dev->i2c_scan_running = true;
-
- memset(&client, 0, sizeof(client));
- client.adapter = cx231xx_get_i2c_adap(dev, i2c_port);
+ adap = cx231xx_get_i2c_adap(dev, i2c_port);
for (i = 0; i < 128; i++) {
- client.addr = i;
- rc = i2c_master_recv(&client, &buf, 0);
+ msg.addr = i;
+ rc = i2c_transfer(adap, &msg, 1);
+
if (rc < 0)
continue;
dev_info(dev->dev,
--
2.9.0
next prev parent reply other threads:[~2017-02-02 14:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-02 14:53 [PATCH 1/4] [media] pvrusb2: reduce stack usage pvr2_eeprom_analyze() Arnd Bergmann
2017-02-02 14:53 ` [PATCH 2/4] [media] em28xx: reduce stack usage in probe functions Arnd Bergmann
2017-02-13 14:00 ` Hans Verkuil
2017-02-02 14:53 ` Arnd Bergmann [this message]
2017-02-02 14:53 ` [PATCH 4/4] [media] mxl111sf: reduce stack usage in init function Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170202145318.3803805-3-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=peda@axentia.se \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®