From patchwork Fri Mar 23 23:44:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timur Tabi X-Patchwork-Id: 10305821 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 9306D600CC for ; Fri, 23 Mar 2018 23:45:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83A4F29219 for ; Fri, 23 Mar 2018 23:45:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 76B432921B; Fri, 23 Mar 2018 23:45:25 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 EDE5129219 for ; Fri, 23 Mar 2018 23:45:24 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From: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=bQfiZ7A9ajpz4ZxO6ILjGV1KtwrldItXwi1Ltz02T04=; b=rMw aVbZboS2/uSDk4/rbiHKK5CchMiEGmxl3/4u4UoHYKxAbNBFQ7e2Tc+bpDSivnzLTW/qJ03M30uPv Uc5c0QIxZWWd75Ytw4N83yA9Ic7pyRj7un0lFVmLOnNKm2nx8WwdI6U4Ay5RpMdOSZjst/TR3ujQd 3uV+Rlusr1xp9lPDTA/ra2NakOaCGeDW9juZ/IUzuPZfvmvo9GHKsdslrx13yMAm4gQdK4zXhhLCz 10FvZDMoQKuFPVYxxBr9SFNpYQUW753GbCPCjRLb4eZiNkVUI2sas9pLymeJL0IjRdGjPhxwi1OUX yIW+6e60F398kM7PszgxJ5G/jWTbfhA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ezWN5-00031u-Pr; Fri, 23 Mar 2018 23:45:19 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ezWN0-0002SX-DY for linux-arm-kernel@lists.infradead.org; Fri, 23 Mar 2018 23:45:17 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 11F89607EB; Fri, 23 Mar 2018 23:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521848704; bh=qjExqb0C/rj/eW5TRnREYdz90btx38fabEmVNYz4lm8=; h=From:To:Cc:Subject:Date:From; b=Mj2ik0CNzqtKUyxMBiaygUmD3RLRDjt8/c9xEYdiQ3a5Y7zBToRsbjOHgaPzLtB7W md31qFEYpob+SdpNG9bLzNozHjVSjmpoVp8pfpqxE++tjT19zQhRHzSQB7CvbY/9iq d0t73zAK5y5CixexeWQAT9ePbQ/922xp85tK/MwY= Received: from timur-ubuntu.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: timur@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id DF064607A2; Fri, 23 Mar 2018 23:45:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521848703; bh=qjExqb0C/rj/eW5TRnREYdz90btx38fabEmVNYz4lm8=; h=From:To:Cc:Subject:Date:From; b=b2nPXvNFxYLhJkpYbWxYn5s4VuRapN2Lsy1ybsOvCbN+jrPg9Bu8KSJuBS3GgHh3n elr84jBvUZ5nfvsgtQaxezEdiUFD8a9ZT8S2hb67agFV9ULQQOT4ndcfglR1Jsqiem LPYQbLqan0gJGHBthUaJ3KzKr2IQFGyKTEpYILvg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org DF064607A2 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=timur@codeaurora.org From: Timur Tabi To: Bjorn Andersson , Linus Walleij , Stephen Boyd , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH 1/2] pinctrl: qcom: remove static globals to allow multiple TLMMs Date: Fri, 23 Mar 2018 18:44:59 -0500 Message-Id: <1521848700-22214-1-git-send-email-timur@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180323_164514_633344_F5717E45 X-CRM114-Status: GOOD ( 13.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: timur@codeaurora.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-Virus-Scanned: ClamAV using ClamSMTP Two data structures are declared as static globals but are intended to be per-TLMM. Move them into the msm_pinctrl structure and initialize them at runtime. Signed-off-by: Timur Tabi Reviewed-by: Bjorn Andersson Reviewed-by: Stephen Boyd --- drivers/pinctrl/qcom/pinctrl-msm.c | 44 ++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c index ad80a17c9990..fa4e94fedb8c 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -58,7 +58,10 @@ struct msm_pinctrl { struct device *dev; struct pinctrl_dev *pctrl; struct gpio_chip chip; + struct pinctrl_desc desc; struct notifier_block restart_nb; + + struct irq_chip irq_chip; int irq; raw_spinlock_t lock; @@ -390,13 +393,6 @@ static int msm_config_group_set(struct pinctrl_dev *pctldev, .pin_config_group_set = msm_config_group_set, }; -static struct pinctrl_desc msm_pinctrl_desc = { - .pctlops = &msm_pinctrl_ops, - .pmxops = &msm_pinmux_ops, - .confops = &msm_pinconf_ops, - .owner = THIS_MODULE, -}; - static int msm_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { const struct msm_pingroup *g; @@ -776,15 +772,6 @@ static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on) return 0; } -static struct irq_chip msm_gpio_irq_chip = { - .name = "msmgpio", - .irq_mask = msm_gpio_irq_mask, - .irq_unmask = msm_gpio_irq_unmask, - .irq_ack = msm_gpio_irq_ack, - .irq_set_type = msm_gpio_irq_set_type, - .irq_set_wake = msm_gpio_irq_set_wake, -}; - static void msm_gpio_irq_handler(struct irq_desc *desc) { struct gpio_chip *gc = irq_desc_get_handler_data(desc); @@ -877,6 +864,13 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl) chip->of_node = pctrl->dev->of_node; chip->need_valid_mask = msm_gpio_needs_valid_mask(pctrl); + pctrl->irq_chip.name = "msmgpio"; + pctrl->irq_chip.irq_mask = msm_gpio_irq_mask; + pctrl->irq_chip.irq_unmask = msm_gpio_irq_unmask; + pctrl->irq_chip.irq_ack = msm_gpio_irq_ack; + pctrl->irq_chip.irq_set_type = msm_gpio_irq_set_type; + pctrl->irq_chip.irq_set_wake = msm_gpio_irq_set_wake; + ret = gpiochip_add_data(&pctrl->chip, pctrl); if (ret) { dev_err(pctrl->dev, "Failed register gpiochip\n"); @@ -898,7 +892,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl) } ret = gpiochip_irqchip_add(chip, - &msm_gpio_irq_chip, + &pctrl->irq_chip, 0, handle_edge_irq, IRQ_TYPE_NONE); @@ -908,7 +902,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl) return -ENOSYS; } - gpiochip_set_chained_irqchip(chip, &msm_gpio_irq_chip, pctrl->irq, + gpiochip_set_chained_irqchip(chip, &pctrl->irq_chip, pctrl->irq, msm_gpio_irq_handler); return 0; @@ -979,11 +973,15 @@ int msm_pinctrl_probe(struct platform_device *pdev, return pctrl->irq; } - msm_pinctrl_desc.name = dev_name(&pdev->dev); - msm_pinctrl_desc.pins = pctrl->soc->pins; - msm_pinctrl_desc.npins = pctrl->soc->npins; - pctrl->pctrl = devm_pinctrl_register(&pdev->dev, &msm_pinctrl_desc, - pctrl); + pctrl->desc.owner = THIS_MODULE; + pctrl->desc.pctlops = &msm_pinctrl_ops; + pctrl->desc.pmxops = &msm_pinmux_ops; + pctrl->desc.confops = &msm_pinconf_ops; + pctrl->desc.name = dev_name(&pdev->dev); + pctrl->desc.pins = pctrl->soc->pins; + pctrl->desc.npins = pctrl->soc->npins; + + pctrl->pctrl = devm_pinctrl_register(&pdev->dev, &pctrl->desc, pctrl); if (IS_ERR(pctrl->pctrl)) { dev_err(&pdev->dev, "Couldn't register pinctrl driver\n"); return PTR_ERR(pctrl->pctrl);