From patchwork Thu Feb 2 14:53:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9552113 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B4A2A604A7 for ; Thu, 2 Feb 2017 14:54:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8DDD27DF9 for ; Thu, 2 Feb 2017 14:54:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CF2628477; Thu, 2 Feb 2017 14:54:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3001127DF9 for ; Thu, 2 Feb 2017 14:54:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751473AbdBBOyP (ORCPT ); Thu, 2 Feb 2017 09:54:15 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:51834 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751394AbdBBOyN (ORCPT ); Thu, 2 Feb 2017 09:54:13 -0500 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.129]) with ESMTPA (Nemesis) id 0MKQMA-1cZrGc1LBG-001lAA; Thu, 02 Feb 2017 15:53:56 +0100 From: Arnd Bergmann To: Mauro Carvalho Chehab Cc: Arnd Bergmann , Michael Krufky , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] [media] mxl111sf: reduce stack usage in init function Date: Thu, 2 Feb 2017 15:53:07 +0100 Message-Id: <20170202145318.3803805-4-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170202145318.3803805-1-arnd@arndb.de> References: <20170202145318.3803805-1-arnd@arndb.de> X-Provags-ID: V03:K0:TaGV1g2pX5UUesKXq8fkGo9iOVrGAAuzAk7+nZM0+6GTr1zPf21 0Tqhb/YHzkdzgU2g7YsSOggYL7D019OeHcI315eK7l3YvLiyPCQ/38SyeqhYFiS+ArAE9k3 iYQN9cKU88gtpLSWEIwshH0srPX9wrNPG9uJzGSpI2iSNNgC9wtDLEw87Cu7Myng8/4h0L8 tb7c6qvlAlGblPaI43gpA== X-UI-Out-Filterresults: notjunk:1; V01:K0:O0f8HAyly+o=:QeTMxgXumCFQogv++HAxvl IueOllSiDKJqdZGuj1xxUiea2x+hINRFt9F0HqBAlAea0BYfnfUwMxAnUA64vSbTRNgb0thOQ zCa6HdP3/H2f29EeQOheD0lqtFhIaQl7zpOJNnulVKAQ5y25l9cSnL9gezN+pXrnMa/4824PJ S1Hg4N5vY9NcxBUEFFD+FmUMgS1aKilRoIob3gp+rnoOOE9S50hsk0NNBfPcCb4wVRIYh1Sj2 lViGR45anC6ujuun/wHo6UFCVlI5A8DfMryaLVW9xAOdjP7UBjdU6cAczZ/RZkNwoA40UpGjQ Rzz1JITJXQLLSoCu7/oCvxTd4C7wk3NPBUQsAqePvbREq/OUZyBQQzVeMZyRgnIjLQ9limJdP j0XGdP6M6Xu7zdLr1aXCrl2SxQLj+3UxF6LqClmwR/lZL/K9MXE31W9R4JeJrrW6xTCH34iaB B0utTcP88bFgol1Eg6eXFk8HlOAbelKM41xxoKYj1A6HZzY3a9b1keU/Z363tMpzBSU/OyEVN 1H3/SSdgF2HNVLx9d64DvDuQZiiT3ORaXio7TNLJ5q01VjfuexGZX0zAul1j1+ugNvd+DFSFy VFUBw5pYWuZoodwg+11/FAnGg2NeaizxtjYSN53FLOq4n8CVefgXKhVEjUFgt3gTsZWg+La26 mTE+Z6+tWLZoH4w4PenK1oAoPsPpTcb13KOcqfAUFdjsZ3fcwMpEZcp32U5mo/j6Fyak= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP mxl111sf uses a lot of kernel stack memory as it puts an i2c_client structure on the stack: drivers/media/usb/dvb-usb-v2/mxl111sf.c: In function 'mxl111sf_init': drivers/media/usb/dvb-usb-v2/mxl111sf.c:953:1: error: the frame size of 1248 bytes is larger than 1152 bytes [-Werror=frame-larger-than=] We can avoid doing this by open-coding the call to i2c_transfer() instead of calling tveeprom_read(), and not passing an i2c_client pointer to tveeprom_hauppauge_analog(), which would ignore that anyway. Signed-off-by: Arnd Bergmann --- drivers/media/usb/dvb-usb-v2/mxl111sf.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf.c b/drivers/media/usb/dvb-usb-v2/mxl111sf.c index 80c635980526..60bc5cc9a483 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf.c +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf.c @@ -919,7 +919,12 @@ static int mxl111sf_init(struct dvb_usb_device *d) struct mxl111sf_state *state = d_to_priv(d); int ret; static u8 eeprom[256]; - struct i2c_client c; + u8 reg = 0; + struct i2c_msg msg[2] = { + { .addr = 0xa0 >> 1, .len = 1, .buf = ® }, + { .addr = 0xa0 >> 1, .flags = I2C_M_RD, + .len = sizeof(eeprom), .buf = eeprom }, + }; ret = get_chip_info(state); if (mxl_fail(ret)) @@ -930,13 +935,10 @@ static int mxl111sf_init(struct dvb_usb_device *d) if (state->chip_rev > MXL111SF_V6) mxl111sf_config_pin_mux_modes(state, PIN_MUX_TS_SPI_IN_MODE_1); - c.adapter = &d->i2c_adap; - c.addr = 0xa0 >> 1; - - ret = tveeprom_read(&c, eeprom, sizeof(eeprom)); + ret = i2c_transfer(&d->i2c_adap, msg, 2); if (mxl_fail(ret)) return 0; - tveeprom_hauppauge_analog(&c, &state->tv, (0x84 == eeprom[0xa0]) ? + tveeprom_hauppauge_analog(NULL, &state->tv, (0x84 == eeprom[0xa0]) ? eeprom + 0xa0 : eeprom + 0x80); #if 0 switch (state->tv.model) {