From patchwork Wed Dec 13 14:47:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Zhang X-Patchwork-Id: 10110201 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 E3CFE60352 for ; Wed, 13 Dec 2017 14:48:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCA5228722 for ; Wed, 13 Dec 2017 14:48:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C148728A35; Wed, 13 Dec 2017 14:48:56 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6BC3C28722 for ; Wed, 13 Dec 2017 14:48:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=G5uJfZhN3x1gWugFRdZJHBV3wjLr87vtvUmjKwAv8mk=; b=n6d0AZuhQRpOCK RprZn5Vqzl5KNL+myftWKldgGWXhn+YE/lV9HQQD4q+pdnhXtFLX17M8mx08mUncU+D6yQVAIVo4X eimcW5MMNyyJ50Dbpk/pJ1WGba8g3ifN0Ot7FM0mPUe1483tKz0RMMMFzSJDgewZyrY+caUYV0lGd 2VoqKpeQ5f1c5j5UmXsJKxHinSh4x6UjkEgPlgZXE1YZLT6lpydvaggHg1fH9xY07IVOngAN2m9Nb Fm5mDxhrsK+OLY3mKcl1AKtSE8CuP9M1yJDxV6bolxjWnwpftRjovWda+rU/G2HGM15pXSJIGgLTc 1aAiMWo9Wt12rSLhj2gg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eP8L2-00060G-O7; Wed, 13 Dec 2017 14:48:48 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eP8KZ-0005Uf-LA; Wed, 13 Dec 2017 14:48:23 +0000 Received: by mail-wm0-x243.google.com with SMTP id 9so5503182wme.4; Wed, 13 Dec 2017 06:47:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=HRAIdik8VUlJFLYUPG5xTYHND4f2ND0ZFkJZFWbYJ5A=; b=fV68nN9LxR9xfPS27DF3sPUgXVWQG6T6uktlNeTzq8XCcX113TOfZcnk+1mG30HZKE +J5TeSbCv/Kz1d+nP90bnb60YSVl8DzN8zi9HPLQ4CN+73JuUcZSlUGJLiclJLasFSTy lXjeX7LB2lhWSpENQN8slFriFauxDlZramn7RT/ulGqMfD4nLJfjkrZaDL6LiPl+aGzA RfvROYvTGy20A8Gy8XjmHGQpKArXP/0C73Q+x10Si5ykIhqEB59ng7tcq55w3aamwdxV Xi99eonSceRH+okLt7alG2ubPvssk3VV6NFQEyznmFfkEae9JLyj8dRmuCghYQSPkr51 /bIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=HRAIdik8VUlJFLYUPG5xTYHND4f2ND0ZFkJZFWbYJ5A=; b=kelZznq3N8NbQr68Ftdz7IW3+ixGmCH8ECviMOsC89341Vsm9ZOuMOuMUHD3bb6yFQ Ng6hdUQOPNtlz0w+6B+a3n3/iAFD07AnznC18/kc1SkUayipECDcO18i2+3UauUXsJfX BRWBRx3N+zZHju6CEgVHjO/rrds6r8D1GWqq9skQMazRpI3lS3E8/BiHfLakjIGFAEYi u2NLJJE7sNv+VDih/vdDBPce6cGzu2Iap9sYVx5xLHRES2Ht4tR6UqVa4iOp04TbGBE1 X+vf2pubX70I4vkGp2Oh9avYP8gq4D/Ec4rVLPFS382Pj9y9jJ4hmt8VL2G3a7jxBi4g R0Cg== X-Gm-Message-State: AKGB3mLPAE84r0vUwBb2oFRjBECm5SNlblNqzFRM6wx9LviOUa6M5bqL mxHCXY/bTH9kOETmrNFKFkQ= X-Google-Smtp-Source: ACJfBotqKdAgpKsp+IYjiqZzcs93L2QtGWssICuGZp/Jg2DRMGzfU2lY0iDGuJ3N8ufjo+Su/kWczw== X-Received: by 10.80.170.24 with SMTP id o24mr8327354edc.40.1513176478171; Wed, 13 Dec 2017 06:47:58 -0800 (PST) Received: from arx-s1 ([79.124.8.2]) by smtp.gmail.com with ESMTPSA id v15sm1493895edb.41.2017.12.13.06.47.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Dec 2017 06:47:57 -0800 (PST) Date: Wed, 13 Dec 2017 22:47:48 +0800 From: hao_zhang To: thierry.reding@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, linux@armlinux.org.uk, wens@csie.org, linus.walleij@linaro.org, maxime.ripard@free-electrons.com Subject: [PATCH v4 4/4] ARM: pinctrl: sunxi-pinctrl: fix pin funtion can not be match correctly. Message-ID: <20171213144748.GA18267@arx-s1> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171213_064820_077499_933CBA36 X-CRM114-Status: UNSURE ( 9.96 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, hao5781286@gmail.com, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Pin function can not be match correctly when SUNXI_PIN describe with mutiple variant and same function. such as: on pinctrl-sun4i-a10.c SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 2), SUNXI_FUNCTION(0x0, "gpio_in"), SUNXI_FUNCTION(0x1, "gpio_out"), SUNXI_FUNCTION_VARIANT(0x2, "pwm", /* PWM0 */ PINCTRL_SUN4I_A10 | PINCTRL_SUN7I_A20), SUNXI_FUNCTION_VARIANT(0x3, "pwm", /* PWM0 */ PINCTRL_SUN8I_R40)), it would always match to the first variant function (PINCTRL_SUN4I_A10, PINCTRL_SUN7I_A20) so we should add variant compare on it. Signed-off-by: hao_zhang Acked-by: Maxime Ripard --- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index 4b6cb25..f23e74e 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -83,9 +83,11 @@ sunxi_pinctrl_desc_find_function_by_name(struct sunxi_pinctrl *pctl, struct sunxi_desc_function *func = pin->functions; while (func->name) { - if (!strcmp(func->name, func_name)) + if (!strcmp(func->name, func_name)) { + if (!(func->variant) || + (func->variant & pctl->variant)) return func; - + } func++; } }