lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 6 Oct 2017 13:11:19 +0200
From:   Thierry Reding <thierry.reding@...il.com>
To:     Grygorii Strashko <grygorii.strashko@...com>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Jonathan Hunter <jonathanh@...dia.com>,
        linux-gpio@...r.kernel.org, linux-tegra@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [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@...dia.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;

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ