Received: by 10.223.185.116 with SMTP id b49csp2185942wrg; Thu, 15 Feb 2018 07:48:28 -0800 (PST) X-Google-Smtp-Source: AH8x224WonPb3vkdUUbExxhg+zZeL4YF3YLSxXw3yzeVDqtSsn3Ev8PZZk1C+1o8wssAXYXw17uw X-Received: by 2002:a17:902:a03:: with SMTP id 3-v6mr2941717plo.282.1518709707912; Thu, 15 Feb 2018 07:48:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518709707; cv=none; d=google.com; s=arc-20160816; b=mMNABtShzyfMl2KUvk2iwVhHQvOwcmiJk2oveCruD4xP0tL/bMkM/L2fwKeA2pwHlA jMV4mOEgu6/ZU9S+d9+dG6XxxAlRTdOZ1uRMxosFoQxOBTCDW7RgUquscL4agtFvLY+w WHaPmfDNBaFm88XCZOT0lBOXw/WLjQrHR7DvX+4HNCooBdZAQUC6KIVdsykVtZKs2wwO UoA9lsonJ8bXmF4/AtBjK3FDku0etxQy/X6oTxkhauVAJrSyZEALmhh71Bxk4EY1JphX VH9NsOfZSRY49sUSgjzFMs8W1LVGBQg2RCQz5de/vnGFcV3r4Ky0dAws0JXLirJHOZed 98KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=kYohN5qS8aK+BJyDiWGOWMsmyBWObwqRKSp5z7zc7SQ=; b=QAxZeaIuq7EcWamtPZDtChyhVw8ACBfzTwCUm6OTUzSC+KPdnELd8Z1c0zII3YrCrz qe2ZP3iFhrKA2wr3AE8b8JU8kdNNDmlksGq+ZUJ04d4qp+JlTllMNflKqlMt+CyEjELI P8eX+Et8GzXPfuKXyd1dMKmaG3XChvxch7QHwHHKLqV+KHJJwgiZHVaSipFW+hbN7Ki7 MAzxd7kRS8G0RfNvpdanMGNskiScwvHI0VS7kgKGCHCT14BQriYMhR56e8fR9zz244kN LP0/KGxiqtwZ8Un74Z9Ob8WOzAHcr6/ZynasojQndXfJ7TY00jVMbyRTLGxfMvRMRIV6 5ICw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l6-v6si2277733pls.65.2018.02.15.07.48.10; Thu, 15 Feb 2018 07:48:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424779AbeBOPqy (ORCPT + 99 others); Thu, 15 Feb 2018 10:46:54 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:35942 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424749AbeBOPqs (ORCPT ); Thu, 15 Feb 2018 10:46:48 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id AE791FE4; Thu, 15 Feb 2018 15:46:47 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Peter Rosin Subject: [PATCH 4.15 179/202] pinctrl: sx150x: Register pinctrl before adding the gpiochip Date: Thu, 15 Feb 2018 16:17:59 +0100 Message-Id: <20180215151722.226424430@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Rosin commit 1a1d39e1b8dd1d0f92a79da4fcc1ab0be3ae9bfc upstream. Various gpiolib activity depend on the pinctrl to be up and kicking. Therefore, register the pinctrl before adding a gpiochip. Suggested-by: Linus Walleij Signed-off-by: Peter Rosin Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/pinctrl-sx150x.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) --- a/drivers/pinctrl/pinctrl-sx150x.c +++ b/drivers/pinctrl/pinctrl-sx150x.c @@ -1144,6 +1144,27 @@ static int sx150x_probe(struct i2c_clien if (ret) return ret; + /* Pinctrl_desc */ + pctl->pinctrl_desc.name = "sx150x-pinctrl"; + pctl->pinctrl_desc.pctlops = &sx150x_pinctrl_ops; + pctl->pinctrl_desc.confops = &sx150x_pinconf_ops; + pctl->pinctrl_desc.pins = pctl->data->pins; + pctl->pinctrl_desc.npins = pctl->data->npins; + pctl->pinctrl_desc.owner = THIS_MODULE; + + ret = devm_pinctrl_register_and_init(dev, &pctl->pinctrl_desc, + pctl, &pctl->pctldev); + if (ret) { + dev_err(dev, "Failed to register pinctrl device\n"); + return ret; + } + + ret = pinctrl_enable(pctl->pctldev); + if (ret) { + dev_err(dev, "Failed to enable pinctrl device\n"); + return ret; + } + /* Register GPIO controller */ pctl->gpio.label = devm_kstrdup(dev, client->name, GFP_KERNEL); pctl->gpio.base = -1; @@ -1217,20 +1238,6 @@ static int sx150x_probe(struct i2c_clien client->irq); } - /* Pinctrl_desc */ - pctl->pinctrl_desc.name = "sx150x-pinctrl"; - pctl->pinctrl_desc.pctlops = &sx150x_pinctrl_ops; - pctl->pinctrl_desc.confops = &sx150x_pinconf_ops; - pctl->pinctrl_desc.pins = pctl->data->pins; - pctl->pinctrl_desc.npins = pctl->data->npins; - pctl->pinctrl_desc.owner = THIS_MODULE; - - pctl->pctldev = devm_pinctrl_register(dev, &pctl->pinctrl_desc, pctl); - if (IS_ERR(pctl->pctldev)) { - dev_err(dev, "Failed to register pinctrl device\n"); - return PTR_ERR(pctl->pctldev); - } - return 0; }