From patchwork Tue Jan 26 21:49:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 8127981 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 9C6B7BEEE5 for ; Tue, 26 Jan 2016 21:51:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A3CC420266 for ; Tue, 26 Jan 2016 21:51:39 +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 909F820260 for ; Tue, 26 Jan 2016 21:51:38 +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 1aOBV8-0000qK-Em; Tue, 26 Jan 2016 21:50:14 +0000 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aOBV3-0008Q1-CB for linux-arm-kernel@lists.infradead.org; Tue, 26 Jan 2016 21:50:10 +0000 Received: by mail-wm0-x234.google.com with SMTP id r129so122723623wmr.0 for ; Tue, 26 Jan 2016 13:49:48 -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=JLgAt07xSFhWN+EzGGO74EbtFSqdJCOn2K/RLqxZrMM=; b=TeHTkIgD12tloL55QAz3o42ZThF+dBklDeyFz4+MSf/8bH021UoqIEbwMI7aKPHUVV mewB2tGbDXT2aNAc3PVwE31BiNURF34AkxsfC/vv4miWQssoP0gir2TBXuGd55htfuTT bBCoS5cC9l6b8X2KG6y6c9oTJQApFzdGivNzT2MNmFGsftYE9MnpoSd6QSDaJ8z5K85S iZVa0IKRMCNb9ZlG7f/2dUXuwMjZ1a8IhFvmaFvjmQSCPk7iZQi7KPb+aWyDy+DYkBiR ZAmiBfFZiNWd7NsSF88RL/0qcn7RlixKwDih7n0I2y6sds2ERk/VX+W4r/Qpw0k8vKLt GtqA== 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=JLgAt07xSFhWN+EzGGO74EbtFSqdJCOn2K/RLqxZrMM=; b=GIf7x2ofRb8pYJHdCE/dIscO6IFcD85eCCzg3uHWSWYgn18jt8O3kD8Y5qqefFYUGk snQR9CA3vVRD06CfvI2KkZPFIQvW5MqwjX0um0ve7JbG/Yu+53EuTE6DwW8/dHR8EHXf yZkLXmOngg4Hpfm6Hkxc9OOULzFCNpuWN4PwUCuGzBQt032atir9N8uQA8UWqMM6a7k0 +fE6SinWg5J40eSNInQLugL3x7lG784PN2KTzAM4N2z92IrHUbTtOnf4z30laD7r9ZUn /sgnqtqwYa2+E65Yzt5a5UEYiYREHS5/IBM8KRJCjs0V02pEzhGGxterpTepRliI4jTr TPFA== X-Gm-Message-State: AG10YOSLh1xB99ZqUATUpPMq/NlDbjYw9Q99mNtgaeqayGn2KIOiDM5WZap0gJftF1jhrQ== X-Received: by 10.28.12.9 with SMTP id 9mr27676341wmm.76.1453844987776; Tue, 26 Jan 2016 13:49:47 -0800 (PST) Received: from topkick.lan (f050233150.adsl.alicedsl.de. [78.50.233.150]) by smtp.gmail.com with ESMTPSA id lh1sm3199334wjb.20.2016.01.26.13.49.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jan 2016 13:49:47 -0800 (PST) From: Sebastian Hesselbarth To: Sebastian Hesselbarth , Aaro Koskinen Subject: [PATCH] pinctrl: mvebu: fix num_settings in mpp group assignment Date: Tue, 26 Jan 2016 22:49:12 +0100 Message-Id: <1453844952-28292-1-git-send-email-sebastian.hesselbarth@gmail.com> In-Reply-To: <20160126182251.GF15550@darkstar.musicnaut.iki.fi> References: <20160126182251.GF15550@darkstar.musicnaut.iki.fi> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160126_135009_697277_9F9671B9 X-CRM114-Status: GOOD ( 14.48 ) 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 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.1 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 setting for a specific Kirkwood variant. However, when there is at least a single 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 --- Aaro, thanks for reporting the issue. It really looks like we should rework the mpp mode/setting/group assignment one day. Please apply this fix and report back with a Tested-by if it works. Sebastian --- drivers/pinctrl/mvebu/pinctrl-mvebu.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c index e4d473811bb3..4a3c7fe533b5 100644 --- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c +++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c @@ -663,11 +663,11 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) /* assign mpp modes to groups */ for (n = 0; n < soc->nmodes; n++) { struct mvebu_mpp_mode *mode = &soc->modes[n]; - struct mvebu_mpp_ctrl_setting *set = &mode->settings[0]; + struct mvebu_mpp_ctrl_setting *set; struct mvebu_pinctrl_group *grp; unsigned num_settings; - for (num_settings = 0; ; set++) { + for (num_settings = 0, set = &mode->settings[0]; ; set++) { if (!set->name) break; @@ -676,6 +676,21 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) continue; num_settings++; + } + + /* skip modes with no settings for this variant */ + if (!num_settings) + continue; + + for (num_settings = 0, set = &mode->settings[0]; ; set++) { + if (!set->name) + break; + + num_settings++; + + /* skip unsupported settings for this variant */ + if (pctl->variant && !(pctl->variant & set->variant)) + continue; /* find gpio/gpo/gpi settings */ if (strcmp(set->name, "gpio") == 0) @@ -687,10 +702,6 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) set->flags = MVEBU_SETTING_GPI; } - /* skip modes with no settings for this variant */ - if (!num_settings) - continue; - grp = mvebu_pinctrl_find_group_by_pid(pctl, mode->pid); if (!grp) { dev_warn(&pdev->dev, "unknown pinctrl group %d\n",