Skip to content

Commit 9a5875f

Browse files
notrobrgl
authored andcommitted
gpio: dln2: Fix interrupts when replugging the device
When replugging the device the following message shows up: gpio gpiochip2: (dln2): detected irqchip that is shared with multiple gpiochips: please fix the driver. This also has the effect that interrupts won't work. The same problem would also show up if multiple devices where plugged in. Fix this by allocating the irq_chip data structure per instance like other drivers do. I don't know when this problem appeared, but it is present in 5.10. Cc: <stable@vger.kernel.org> # 5.10+ Cc: Daniel Baluta <daniel.baluta@gmail.com> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
1 parent d6912b1 commit 9a5875f

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

drivers/gpio/gpio-dln2.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
struct dln2_gpio {
4747
struct platform_device *pdev;
4848
struct gpio_chip gpio;
49+
struct irq_chip irqchip;
4950

5051
/*
5152
* Cache pin direction to save us one transfer, since the hardware has
@@ -383,15 +384,6 @@ static void dln2_irq_bus_unlock(struct irq_data *irqd)
383384
mutex_unlock(&dln2->irq_lock);
384385
}
385386

386-
static struct irq_chip dln2_gpio_irqchip = {
387-
.name = "dln2-irq",
388-
.irq_mask = dln2_irq_mask,
389-
.irq_unmask = dln2_irq_unmask,
390-
.irq_set_type = dln2_irq_set_type,
391-
.irq_bus_lock = dln2_irq_bus_lock,
392-
.irq_bus_sync_unlock = dln2_irq_bus_unlock,
393-
};
394-
395387
static void dln2_gpio_event(struct platform_device *pdev, u16 echo,
396388
const void *data, int len)
397389
{
@@ -473,8 +465,15 @@ static int dln2_gpio_probe(struct platform_device *pdev)
473465
dln2->gpio.direction_output = dln2_gpio_direction_output;
474466
dln2->gpio.set_config = dln2_gpio_set_config;
475467

468+
dln2->irqchip.name = "dln2-irq",
469+
dln2->irqchip.irq_mask = dln2_irq_mask,
470+
dln2->irqchip.irq_unmask = dln2_irq_unmask,
471+
dln2->irqchip.irq_set_type = dln2_irq_set_type,
472+
dln2->irqchip.irq_bus_lock = dln2_irq_bus_lock,
473+
dln2->irqchip.irq_bus_sync_unlock = dln2_irq_bus_unlock,
474+
476475
girq = &dln2->gpio.irq;
477-
girq->chip = &dln2_gpio_irqchip;
476+
girq->chip = &dln2->irqchip;
478477
/* The event comes from the outside so no parent handler */
479478
girq->parent_handler = NULL;
480479
girq->num_parents = 0;

0 commit comments

Comments
 (0)