From patchwork Thu Feb 2 14:53:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9552109 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 4E3D5604A7 for ; Thu, 2 Feb 2017 14:54:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 434E327DF9 for ; Thu, 2 Feb 2017 14:54:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3821A28477; Thu, 2 Feb 2017 14:54:10 +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 BC75427DF9 for ; Thu, 2 Feb 2017 14:54:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751876AbdBBOx4 (ORCPT ); Thu, 2 Feb 2017 09:53:56 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:62472 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751500AbdBBOxy (ORCPT ); Thu, 2 Feb 2017 09:53:54 -0500 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.129]) with ESMTPA (Nemesis) id 0MdziP-1cpTdN3dWP-00PdZZ; Thu, 02 Feb 2017 15:53:44 +0100 From: Arnd Bergmann To: Mauro Carvalho Chehab Cc: Arnd Bergmann , Peter Rosin , Wolfram Sang , 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 Message-Id: <20170202145318.3803805-3-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:0VSJpngUZV7uYF/P+VmV6LEIPKe05njRB9jlHU+muEkrKEgcj1a Bdwj9+BpPkNERVG4isjgh4VOzDUGLadZ0wMAeG7iKj4ea4NlGP9P6wKk4+rn94+258It2XH cu27041hVMgA684zpshSjE62JUFKpjaxyNnkDklXdKBtslg/12EgXy+1MFpPDoM3aqQ4xEt Lhx9LHBhXVRlh644xW1JA== X-UI-Out-Filterresults: notjunk:1; V01:K0:aXtTrBxatrs=:FV3XXpQBRQkPBwiGZNaXzW olyEJdi+skTuaxXSNAtjG3An+QJIWsqegGBiuptF2QUxcMGqvDOY/dVqf1NZjxz6YgnWqysrE 4F4UvT8Eh+8TqQDqyXDZw8OKgutHYQUaL9aCt250ZG5Bz7c0r1GCCyXBGcdO/jgogznxXF3/y 6wJgsJYN+cyjvxLsC97ok3LSzAGD0vbcRnCxdOB/cjesXgPEJiaiPoKjAVI+gFUZvyIWeHKXO 2uT68BQ59s7MeFKWJtFS+ilnVT09ICkrJAAF0O1CDLLX8X6GyKjmjISX5DgvXYvCC7S+ZC6Ij /VI/lEh2dubU0UPKDkjESih3oMFvnUuIAwuqRFD/fHUUjL/wz9e7dMY4Ih9KvepD6rw1KLHRz vyjwv6FPubbkPUPUW985wsz93s2OC6DM3ZkjzTxB8Vfu5TIPpJfcq65Sw3UHuqsp2CYU9tMGj Cmb2vSKnpp9LUwk2lD9aggDPV1E3stvRcc6o9If9tU9gJBXoKQttIwB3hLcYTSr+g23RmXJqE YtLd/FGZxQabPowUkSsg5TXFWBHyDZ/qB9qOxRdMI/f9iPHhrpPkbRcEWJ4UPfr0IhdeTCXxw t/pfZtJAvuqQrwhO1OELCYLjzwZySh/rNzVNJXbAKRh6J62sDowEzeFP3neER4VeF8+69nWiQ WXSbv/Qervw9gQmJBc2WHr6p9uSmeNu0OlcnEa6eM7TCFETFRfE6yqGzSrde2I8JzzE8= 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 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 --- 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,