From patchwork Sat Feb 16 21:24:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 2152511 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id B809F3FD4F for ; Sat, 16 Feb 2013 21:35:22 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U6pLk-0003ZB-Hz; Sat, 16 Feb 2013 21:31:12 +0000 Received: from gg-in-x0230.1e100.net ([2607:f8b0:4002:c02::230] helo=mail-gg0-x230.google.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U6pLh-0003Yr-J9 for linux-arm-kernel@lists.infradead.org; Sat, 16 Feb 2013 21:31:10 +0000 Received: by mail-gg0-f176.google.com with SMTP id q6so336025ggc.35 for ; Sat, 16 Feb 2013 13:31:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=i1zh3jvEBugeKiAz3UDHWB/ZjsQybHTyTO/fY/lGDec=; b=xbCGWJLcYzAGnUbsVLd3AKiDlZwsgduqWpMXolmJaPVt4fztGicof0w27EFDl1/iGN zi5+AA41GiP01FDQMVNOAlCv79ddXKVr8LpP9/luHD0nvfeKicMO1esX7IDErkKTXCk6 f0uSjsOJMNql+fKeKL4aG0p7sMO1G0qHCg0P4K6PU8avdTgBX4Me/5FENmviy4Xay10R C8JAySTZk1bFSeC9J+3se2pQaJ92KkLLroBkJLlHfTGcAPGGCgDtFuaGncBokNC0A8zT 4Me0D9JK4PpV12ZJ13A6P13TmARRRsdJXiBT7/wGtI2MFbvUsIu9FXAc0W+UvZeL+CMc Lefw== X-Received: by 10.101.86.15 with SMTP id o15mr3034260anl.10.1361049862216; Sat, 16 Feb 2013 13:24:22 -0800 (PST) Received: from localhost.localdomain ([201.82.137.218]) by mx.google.com with ESMTPS id r68sm3919338yhd.1.2013.02.16.13.24.19 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 16 Feb 2013 13:24:21 -0800 (PST) From: Fabio Estevam To: grant.likely@secretlab.ca Subject: [PATCH] gpio: gpiolib: Remove WARN reference Date: Sat, 16 Feb 2013 19:24:08 -0200 Message-Id: <1361049848-14977-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130216_163109_709452_5C2EAE32 X-CRM114-Status: GOOD ( 15.49 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (festevam[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: marex@denx.de, Fabio Estevam , linus.walleij@linaro.org, acourbot@nvidia.com, shawn.guo@linaro.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Fabio Estevam Since commit 372e722ea4d (gpiolib: use descriptors internally) the following warning is seen on a mx28evk board: [ 5.116291] ------------[ cut here ]------------ [ 5.121306] WARNING: at drivers/gpio/gpiolib.c:125 gpio_to_desc+0x30/0x44() [ 5.128491] invalid GPIO -2 [ 5.131563] Modules linked in: [ 5.134846] [] (unwind_backtrace+0x0/0xf4) from [] (warn_slowpath_common+0x4c/0x68) [ 5.144682] [] (warn_slowpath_common+0x4c/0x68) from [] (warn_slowpath_fmt+0x30/0x40) [ 5.154693] [] (warn_slowpath_fmt+0x30/0x40) from [] (gpio_to_desc+0x30/0x44) [ 5.164002] [] (gpio_to_desc+0x30/0x44) from [] (gpio_request_one+0x10/0xe8) [ 5.173294] [] (gpio_request_one+0x10/0xe8) from [] (devm_gpio_request_one+0x40/0x74) [ 5.183332] [] (devm_gpio_request_one+0x40/0x74) from [] (fec_probe+0x2d0/0x99c) [ 5.192923] [] (fec_probe+0x2d0/0x99c) from [] (platform_drv_probe+0x14/0x18) [ 5.202228] [] (platform_drv_probe+0x14/0x18) from [] (driver_probe_device+0x90/0x224) [ 5.212332] [] (driver_probe_device+0x90/0x224) from [] (__driver_attach+0x94/0x98) [ 5.222162] [] (__driver_attach+0x94/0x98) from [] (bus_for_each_dev+0x78/0x98) [ 5.231642] [] (bus_for_each_dev+0x78/0x98) from [] (bus_add_driver+0x1a4/0x240) [ 5.241207] [] (bus_add_driver+0x1a4/0x240) from [] (driver_register+0x78/0x140) [ 5.250768] [] (driver_register+0x78/0x140) from [] (do_one_initcall+0x30/0x17c) [ 5.260347] [] (do_one_initcall+0x30/0x17c) from [] (kernel_init_freeable+0xe8/0x1b0) [ 5.270381] [] (kernel_init_freeable+0xe8/0x1b0) from [] (kernel_init+0x8/0xe4) [ 5.279886] [] (kernel_init+0x8/0xe4) from [] (ret_from_fork+0x14/0x2c) [ 5.288740] ---[ end trace c15c72a22979d58d ]--- mx28evk has two ethernet controllers. The GPIO that performs the ethernet reset on both ports is the same GPIO, so on the board dts file, only in one ethernet instance is passed the GPIO reset property. Replace the WARN with a pr_warn message. Signed-off-by: Fabio Estevam --- Another possible fix would be to do: arch/arm/boot/dts/imx28-evk.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/imx28-evk.dts b/arch/arm/boot/dts/imx28-evk.dts index 2da316e..87c6aa4 100644 --- a/arch/arm/boot/dts/imx28-evk.dts +++ b/arch/arm/boot/dts/imx28-evk.dts @@ -237,6 +237,8 @@ phy-mode = "rmii"; pinctrl-names = "default"; pinctrl-0 = <&mac1_pins_a>; + phy-reset-gpios = <&gpio4 13 0>; + phy-reset-duration = <100>; status = "okay"; }; }; ,but then we would end up doing the reset twice, since it is the same GPIO that resets the two ethernet controllers. drivers/gpio/gpiolib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index fff9786..01f193a 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -122,10 +122,12 @@ static int gpio_chip_hwgpio(const struct gpio_desc *desc) */ static struct gpio_desc *gpio_to_desc(unsigned gpio) { - if (WARN(!gpio_is_valid(gpio), "invalid GPIO %d\n", gpio)) + if (!gpio_is_valid(gpio)) { + pr_warn("gpiolib: invalid GPIO %d\n", gpio); return NULL; - else + } else { return &gpio_desc[gpio]; + } } /**