All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Sasha Levin <sashal@kernel.org>,
	linux-gpio@vger.kernel.org
Subject: [PATCH AUTOSEL 4.4 40/44] pinctrl: at91: don't use the same irqchip with multiple gpiochips
Date: Fri,  8 Nov 2019 06:47:16 -0500	[thread overview]
Message-ID: <20191108114721.15944-40-sashal@kernel.org> (raw)
In-Reply-To: <20191108114721.15944-1-sashal@kernel.org>

From: Ludovic Desroches <ludovic.desroches@microchip.com>

[ Upstream commit 0c3dfa176912b5f87732545598200fb55e9c1978 ]

Sharing the same irqchip with multiple gpiochips is not a good
practice. For instance, when installing hooks, we change the state
of the irqchip. The initial state of the irqchip for the second
gpiochip to register is then disrupted.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/pinctrl/pinctrl-at91.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 0d2fc0cff35ee..52bbd34f7d0d9 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -1556,16 +1556,6 @@ void at91_pinctrl_gpio_resume(void)
 #define gpio_irq_set_wake	NULL
 #endif /* CONFIG_PM */
 
-static struct irq_chip gpio_irqchip = {
-	.name		= "GPIO",
-	.irq_ack	= gpio_irq_ack,
-	.irq_disable	= gpio_irq_mask,
-	.irq_mask	= gpio_irq_mask,
-	.irq_unmask	= gpio_irq_unmask,
-	/* .irq_set_type is set dynamically */
-	.irq_set_wake	= gpio_irq_set_wake,
-};
-
 static void gpio_irq_handler(struct irq_desc *desc)
 {
 	struct irq_chip *chip = irq_desc_get_chip(desc);
@@ -1608,12 +1598,22 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev,
 	struct gpio_chip	*gpiochip_prev = NULL;
 	struct at91_gpio_chip   *prev = NULL;
 	struct irq_data		*d = irq_get_irq_data(at91_gpio->pioc_virq);
+	struct irq_chip		*gpio_irqchip;
 	int ret, i;
 
+	gpio_irqchip = devm_kzalloc(&pdev->dev, sizeof(*gpio_irqchip), GFP_KERNEL);
+	if (!gpio_irqchip)
+		return -ENOMEM;
+
 	at91_gpio->pioc_hwirq = irqd_to_hwirq(d);
 
-	/* Setup proper .irq_set_type function */
-	gpio_irqchip.irq_set_type = at91_gpio->ops->irq_type;
+	gpio_irqchip->name = "GPIO";
+	gpio_irqchip->irq_ack = gpio_irq_ack;
+	gpio_irqchip->irq_disable = gpio_irq_mask;
+	gpio_irqchip->irq_mask = gpio_irq_mask;
+	gpio_irqchip->irq_unmask = gpio_irq_unmask;
+	gpio_irqchip->irq_set_wake = gpio_irq_set_wake,
+	gpio_irqchip->irq_set_type = at91_gpio->ops->irq_type;
 
 	/* Disable irqs of this PIO controller */
 	writel_relaxed(~0, at91_gpio->regbase + PIO_IDR);
@@ -1624,7 +1624,7 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev,
 	 * interrupt.
 	 */
 	ret = gpiochip_irqchip_add(&at91_gpio->chip,
-				   &gpio_irqchip,
+				   gpio_irqchip,
 				   0,
 				   handle_edge_irq,
 				   IRQ_TYPE_EDGE_BOTH);
@@ -1642,7 +1642,7 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev,
 	if (!gpiochip_prev) {
 		/* Then register the chain on the parent IRQ */
 		gpiochip_set_chained_irqchip(&at91_gpio->chip,
-					     &gpio_irqchip,
+					     gpio_irqchip,
 					     at91_gpio->pioc_virq,
 					     gpio_irq_handler);
 		return 0;
-- 
2.20.1


  parent reply	other threads:[~2019-11-08 11:49 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-08 11:46 [PATCH AUTOSEL 4.4 01/44] iio: dac: mcp4922: fix error handling in mcp4922_write_raw Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 02/44] ALSA: pcm: signedness bug in snd_pcm_plug_alloc() Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 03/44] ARM: dts: at91/trivial: Fix USART1 definition for at91sam9g45 Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 04/44] ALSA: seq: Do error checks at creating system ports Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 05/44] gfs2: Don't set GFS2_RDF_UPTODATE when the lvb is updated Sasha Levin
2019-11-08 11:46   ` [Cluster-devel] " Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 06/44] ASoC: dpcm: Properly initialise hw->rate_max Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 07/44] MIPS: BCM47XX: Enable USB power on Netgear WNDR3400v3 Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 08/44] ARM: dts: exynos: Fix sound in Snow-rev5 Chromebook Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 09/44] i40e: use correct length for strncpy Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 10/44] i40e: hold the rtnl lock on clearing interrupt scheme Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 11/44] i40e: Prevent deleting MAC address from VF when set by PF Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 12/44] ARM: dts: pxa: fix power i2c base address Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 13/44] rtl8187: Fix warning generated when strncpy() destination length matches the sixe argument Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 14/44] net: lan78xx: Bail out if lan78xx_get_endpoints fails Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 15/44] ASoC: sgtl5000: avoid division by zero if lo_vag is zero Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 16/44] ARM: dts: exynos: Disable pull control for S5M8767 PMIC Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 17/44] ath10k: wmi: disable softirq's while calling ieee80211_rx Sasha Levin
2019-11-08 11:46   ` Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 18/44] mips: txx9: fix iounmap related issue Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 19/44] of: make PowerMac cache node search conditional on CONFIG_PPC_PMAC Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 20/44] ARM: dts: omap3-gta04: give spi_lcd node a label so that we can overwrite in other DTS files Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 21/44] ARM: dts: omap3-gta04: tvout: enable as display1 alias Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 22/44] ARM: dts: omap3-gta04: make NAND partitions compatible with recent U-Boot Sasha Levin
2019-11-08 11:46 ` [PATCH AUTOSEL 4.4 23/44] ARM: dts: omap3-gta04: keep vpll2 always on Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 24/44] dmaengine: dma-jz4780: Further residue status fix Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 25/44] signal: Always ignore SIGKILL and SIGSTOP sent to the global init Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 26/44] signal: Properly deliver SIGILL from uprobes Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 27/44] signal: Properly deliver SIGSEGV from x86 uprobes Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 28/44] scsi: sym53c8xx: fix NULL pointer dereference panic in sym_int_sir() Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 29/44] ARM: imx6: register pm_power_off handler if "fsl,pmic-stby-poweroff" is set Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 30/44] scsi: pm80xx: Corrected dma_unmap_sg() parameter Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 31/44] scsi: pm80xx: Fixed system hang issue during kexec boot Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 32/44] kprobes: Don't call BUG_ON() if there is a kprobe in use on free list Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 33/44] nvmem: core: return error code instead of NULL from nvmem_device_get Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 34/44] media: fix: media: pci: meye: validate offset to avoid arbitrary access Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 35/44] ALSA: intel8x0m: Register irq handler after register initializations Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 36/44] pinctrl: at91-pio4: fix has_config check in atmel_pctl_dt_subnode_to_map() Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 37/44] llc: avoid blocking in llc_sap_close() Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 38/44] powerpc/vdso: Correct call frame information Sasha Levin
2019-11-08 11:47   ` Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 39/44] ARM: dts: socfpga: Fix I2C bus unit-address error Sasha Levin
2019-11-08 11:47 ` Sasha Levin [this message]
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 41/44] cxgb4: Fix endianness issue in t4_fwcache() Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 42/44] power: supply: ab8500_fg: silence uninitialized variable warnings Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 43/44] power: supply: max8998-charger: Fix platform data retrieval Sasha Levin
2019-11-08 11:47 ` [PATCH AUTOSEL 4.4 44/44] kernfs: Fix range checks in kernfs_get_target_path Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191108114721.15944-40-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ludovic.desroches@microchip.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.