From patchwork Mon Feb 1 22:48:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 8184551 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 61B90BEEE5 for ; Mon, 1 Feb 2016 22:51:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7AB3420395 for ; Mon, 1 Feb 2016 22:51:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7DF04200F2 for ; Mon, 1 Feb 2016 22:51:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aQNHE-0006Vy-8H; Mon, 01 Feb 2016 22:48:56 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aQNHA-0006S6-Tv for linux-arm-kernel@lists.infradead.org; Mon, 01 Feb 2016 22:48:54 +0000 Received: by mail-wm0-x236.google.com with SMTP id l66so93515318wml.0 for ; Mon, 01 Feb 2016 14:48:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gEsIqzKSdTnD14ikmJ7NJTmGQ4tzl+s68E7pWIrRwGY=; b=O8blF2gfLxa/wzG/Xl16P2Vx6VO9PEH5N8r6qeK6cJzE5TpjVgzkQrsCSt+ijhNjvp ZSka6rMf3+7QC+nd3xkU3UrKSAprr5/K+sMoFx231MUMxzLkl3iFJk/xmGcWtqqU2ufB J24id1yb+EIfWhL8RKK7nAJ3AatsLy5rveUKR7+/X3ZaonbRAYFTicNyv/vxUevHDrfq 9hwbqzwutwwK0s5G2c3UVpJEF4t4sfyZ0sloiYGK86z7IHQMFJv8KDBCS4YVeamvPgAn Ae0+XUoowYlLGcLbMcUonGCRFL0m0JkvZua10iDj5yxSg2qhlHZLdzh12ZTaHsaiF+Y7 B1ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gEsIqzKSdTnD14ikmJ7NJTmGQ4tzl+s68E7pWIrRwGY=; b=eSJ+yaipI1CIr1Ek+w5t5yYXNjAvbHvSKYCK4Is/z8T+cuBR9jhq0DZqQCxVw8TNBa Sk4FcimNSFNgv5CZ+cJSHFvkkzIKEFPnAGwYH0QHMP9FCAygx7F7Jt8awhKCYmtHOkXJ 3AlyJfzpBqNCDbdVu9TD5W66g/yHd1/uFUvHzz1CJPjNGR9oWPh15cRX4VCWkD2MVfUy T2vb+orIMoiXLvpPyV0GmTGl1/ysS7dRsuRKCMX3SIlpdqZhfUgKtExZIRgy/43MBoIZ PJiu1aZiuXuy9VVOzfetQ+KLF1fetghTCremywAMtRBtP9cZMxuHkOOn3a0fwWu+jEyq KzlQ== X-Gm-Message-State: AG10YOT7xsHkrUmBHLzeXLbKZ7Ab5u78syGyodFIEksHl4WXNUvYbPU4FOnRGTa6LeoKPw== X-Received: by 10.28.5.213 with SMTP id 204mr13797494wmf.20.1454366910772; Mon, 01 Feb 2016 14:48:30 -0800 (PST) Received: from topkick.lan (f051037209.adsl.alicedsl.de. [78.51.37.209]) by smtp.gmail.com with ESMTPSA id ll9sm31171041wjc.29.2016.02.01.14.48.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Feb 2016 14:48:29 -0800 (PST) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH v2] pinctrl: mvebu: fix num_settings in mpp group assignment Date: Mon, 1 Feb 2016 23:48:23 +0100 Message-Id: <1454366903-7038-1-git-send-email-sebastian.hesselbarth@gmail.com> In-Reply-To: <1453844952-28292-1-git-send-email-sebastian.hesselbarth@gmail.com> References: <1453844952-28292-1-git-send-email-sebastian.hesselbarth@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160201_144853_133331_11E07247 X-CRM114-Status: GOOD ( 13.16 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gregory Clement , Andrew Lunn , Linus Walleij , linux-arm-kernel@lists.infradead.org, Aaro Koskinen MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When assigning mpp settings from static mpp modes to mpp groups, we do not want any groups that have no supported setting for a specific Kirkwood variant. However, when there is at least a single supported setting, we need to assign the number of all settings in this mode to grp->num_settings as we are reusing the static modes table. Fixes: 0581b16b1840 ("pinctrl: mvebu: complain about missing group after checking variant") Reported-by: Aaro Koskinen Signed-off-by: Sebastian Hesselbarth Tested-by: Aaro Koskinen --- Changelog: v1->v2: - Chose a less intrusive fix by adding supp_settings variable instead of looping over the settings twice. Aaro, Linus, I prefer this less intrusive fix in favor of v1. @Aaro: Can you please test again? Cc: Aaro Koskinen Cc: Linus Walleij Cc: Gregory Clement Cc: Andrew Lunn Cc: linux-arm-kernel@lists.infradead.org --- drivers/pinctrl/mvebu/pinctrl-mvebu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c index e4d473811bb3..3ef798fac81b 100644 --- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c +++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c @@ -666,16 +666,19 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) struct mvebu_mpp_ctrl_setting *set = &mode->settings[0]; struct mvebu_pinctrl_group *grp; unsigned num_settings; + unsigned supp_settings; - for (num_settings = 0; ; set++) { + for (num_settings = 0, supp_settings = 0; ; set++) { if (!set->name) break; + num_settings++; + /* skip unsupported settings for this variant */ if (pctl->variant && !(pctl->variant & set->variant)) continue; - num_settings++; + supp_settings++; /* find gpio/gpo/gpi settings */ if (strcmp(set->name, "gpio") == 0) @@ -688,7 +691,7 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) } /* skip modes with no settings for this variant */ - if (!num_settings) + if (!supp_settings) continue; grp = mvebu_pinctrl_find_group_by_pid(pctl, mode->pid);