lkml.org 
[lkml]   [2017]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH v2 00/16] gpio: Tight IRQ chip integration and banked infrastructure
On Fri, Oct 06, 2017 at 01:07:49PM +0200, Thierry Reding wrote:
> On Thu, Sep 28, 2017 at 09:22:17AM -0500, Grygorii Strashko wrote:
[...]
> > - all GPIO IRQs mapped statically
>
> This series predates your work on the dynamic IRQ mapping, so I hadn't
> picked up those changes. This should be easily solved by the attached
> patch, though.

Here's the patch.

Thierry

--- >8 ---
commit 139c254bf963bf373d83970e530a56599f1832cc
Author: Thierry Reding <treding@nvidia.com>
Date: Fri Oct 6 12:12:27 2017 +0200

fixup! gpio: Implement tighter IRQ chip integration

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index b3bd19b793d3..2e450afe61b3 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1708,9 +1708,23 @@ static void gpiochip_irq_relres(struct irq_data *d)

static int gpiochip_to_irq(struct gpio_chip *chip, unsigned offset)
{
+ unsigned int irq;
+ int err;
+
if (!gpiochip_irqchip_irq_valid(chip, offset))
return -ENXIO;
- return irq_create_mapping(chip->irq.domain, offset);
+
+ irq = irq_create_mapping(chip->irq.domain, offset);
+ if (!irq)
+ return 0;
+
+ if (chip->irq.map) {
+ err = irq_set_parent(irq, chip->irq.map[offset]);
+ if (err < 0)
+ return err;
+ }
+
+ return irq;
}

/**
@@ -1856,27 +1870,6 @@ static int gpiochip_add_irqchip(struct gpio_chip *gpiochip)
gpiochip->irq.nested = true;
}

- /*
- * Prepare the mapping since the IRQ chip shall be orthogonal to any
- * GPIO chip calls.
- */
- for (i = 0; i < gpiochip->ngpio; i++) {
- unsigned int irq;
-
- if (!gpiochip_irqchip_irq_valid(gpiochip, i))
- continue;
-
- irq = irq_create_mapping(gpiochip->irq.domain, i);
- if (!irq) {
- chip_err(gpiochip,
- "failed to create IRQ mapping for GPIO#%u\n",
- i);
- continue;
- }
-
- irq_set_parent(irq, gpiochip->irq.map[i]);
- }
-
acpi_gpiochip_request_interrupts(gpiochip);

return 0;[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2017-10-06 13:12    [W:0.113 / U:1.152 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site