[RFC/RFT,2/3] gpio: pxa: remove gpio_to_irq() from hw irq handlers

Message ID 20170708224413.18281-3-grygorii.strashko@ti.com
State New
Headers show

Commit Message

Grygorii Strashko July 8, 2017, 10:44 p.m.
gpio_to_irq() API expected to be used by GPIO consumers and
not drivers and there are no guarantee that its gpiolib implementation
is irq safe.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 drivers/gpio/gpio-pxa.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Linus Walleij Aug. 1, 2017, 7:47 a.m. | #1
On Sun, Jul 9, 2017 at 12:44 AM, Grygorii Strashko
<grygorii.strashko@ti.com> wrote:

> gpio_to_irq() API expected to be used by GPIO consumers and
> not drivers and there are no guarantee that its gpiolib implementation
> is irq safe.
>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

Patch applied.

This is the right thing to do.

PXA developers: please test.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Robert Jarzmik Aug. 1, 2017, 6:41 p.m. | #2
Linus Walleij <linus.walleij@linaro.org> writes:

> On Sun, Jul 9, 2017 at 12:44 AM, Grygorii Strashko
> <grygorii.strashko@ti.com> wrote:
>
>> gpio_to_irq() API expected to be used by GPIO consumers and
>> not drivers and there are no guarantee that its gpiolib implementation
>> is irq safe.
>>
>> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
>
> Patch applied.
>
> This is the right thing to do.
>
> PXA developers: please test.

Hi Linus,

Currently pxa25x and pxa27x are broken because of a .data section misalignment
(issue cross arm architectures), so testing is a bit hard for me right now. I'll
wait to have a working again tree to test, and then report.

Cheers.

--
Robert
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index 832f3e4..6029899 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -451,7 +451,9 @@  static irqreturn_t pxa_gpio_demux_handler(int in_irq, void *d)
 			for_each_set_bit(n, &gedr, BITS_PER_LONG) {
 				loop = 1;
 
-				generic_handle_irq(gpio_to_irq(gpio + n));
+				generic_handle_irq(
+					irq_find_mapping(pchip->irqdomain,
+							 gpio + n));
 			}
 		}
 		handled += loop;
@@ -465,9 +467,9 @@  static irqreturn_t pxa_gpio_direct_handler(int in_irq, void *d)
 	struct pxa_gpio_chip *pchip = d;
 
 	if (in_irq == pchip->irq0) {
-		generic_handle_irq(gpio_to_irq(0));
+		generic_handle_irq(irq_find_mapping(pchip->irqdomain, 0));
 	} else if (in_irq == pchip->irq1) {
-		generic_handle_irq(gpio_to_irq(1));
+		generic_handle_irq(irq_find_mapping(pchip->irqdomain, 1));
 	} else {
 		pr_err("%s() unknown irq %d\n", __func__, in_irq);
 		return IRQ_NONE;