From patchwork Fri Aug 5 12:22:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 595666 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09E49C25B0C for ; Fri, 5 Aug 2022 12:22:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240645AbiHEMWa (ORCPT ); Fri, 5 Aug 2022 08:22:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240695AbiHEMW0 (ORCPT ); Fri, 5 Aug 2022 08:22:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CE51D6C for ; Fri, 5 Aug 2022 05:22:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E37A1B828AF for ; Fri, 5 Aug 2022 12:22:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E635C43141; Fri, 5 Aug 2022 12:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659702142; bh=vn2WUAHXHsGKqG8gx4eiUN1YZXYE9u0alZ+b+BqHmrc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CtQeO32aRLqO9+w82Hnf5qznoVF09qVAciLzX/GGJDxgfG9TVmcDn1/v30nv1x1YE kbEpDumT9M5EXHS+ntYBZQy34mwVUzHWV3MqT2/rPtOHyWC2L8pd62k8RF8+jOtmoQ ooaccg9kjd5uw2dRM8d1tGp7eUxmcrFBKOIBXHoVRvc8v++jESTngKpIxhEECtzXkh lAma4bbHOHUfmwmLkgUfj51n+3VTal1XnBN9U8GNHP6A7V5/JhTUE/12ndRsxRmqZf Cy0JSPnzceXTi6/0OSEV59MUFvN+iBfsJE+/XEClbDedgrjg+hk/A0BM7P0Od2p3Vv pedOodH1X/edA== Received: by pali.im (Postfix) id CE15E96D; Fri, 5 Aug 2022 14:22:19 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Linus Walleij Cc: =?utf-8?q?Marek_Beh=C3=BAn?= , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Subject: [PATCH v2 3/4] pinctrl: armada-37xx: Checks for errors in gpio_request_enable callback Date: Fri, 5 Aug 2022 14:22:01 +0200 Message-Id: <20220805122202.23174-3-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220805122202.23174-1-pali@kernel.org> References: <20220805122202.23174-1-pali@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Now when all MPP pins are properly defined and every MPP pin has GPIO function, always checks for errors in armada_37xx_gpio_request_enable() function when calling armada_37xx_pmx_set_by_name(). Function armada_37xx_pmx_set_by_name() should not return "not supported" error anymore for any GPIO pin when requesting GPIO mode. Fixes: 87466ccd9401 ("pinctrl: armada-37xx: Add pin controller support for Armada 37xx") Signed-off-by: Pali Rohár --- Changes in v2: * add missing int ret; --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index e5e5f0ea0e77..3227f70922fc 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -500,11 +500,15 @@ static int armada_37xx_gpio_request_enable(struct pinctrl_dev *pctldev, struct armada_37xx_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); struct armada_37xx_pin_group *group; int grp = 0; + int ret; dev_dbg(info->dev, "requesting gpio %d\n", offset); - while ((group = armada_37xx_find_next_grp_by_pin(info, offset, &grp))) - armada_37xx_pmx_set_by_name(pctldev, "gpio", group); + while ((group = armada_37xx_find_next_grp_by_pin(info, offset, &grp))) { + ret = armada_37xx_pmx_set_by_name(pctldev, "gpio", group); + if (ret) + return ret; + } return 0; }