Skip to contentSkip to conversation

gpio: dwapb: Fix missing conversion to GPIO-lib-based IRQ-chip

PATCH In review Jia He 4 participants 4 messages Oct 16, 2020 – Oct 26, 2020

Subsystems (2)
lore
Share & tools
lore

Jia He

author
#0 lore raw

PATCH 1/1 gpio: dwapb: Fix missing conversion to GPIO-lib-based IRQ-chip

Commit 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip") missed the case in dwapb_irq_set_wake().

Without this fix, probing the dwapb gpio driver will hit a error:
"address between user and kernel address ranges" on a Ampere armv8a server and cause a panic.

Fixes 0ea683931adb ("gpio: dwapb: Convert driver to using the

GPIO-lib-based IRQ-chip")

---
 drivers/gpio/gpio-dwapb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-dwapb.c +2 -2
index a5b326754124..2a9046c0fb16 100644
@@ -343,8 +343,8 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 type)
 #ifdef CONFIG_PM_SLEEP
 static int dwapb_irq_set_wake(struct irq_data *d, unsigned int enable)
 {
-	struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d);
-	struct dwapb_gpio *gpio = igc->private;
+	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+	struct dwapb_gpio *gpio = to_dwapb_gpio(gc);
 	struct dwapb_context *ctx = gpio->ports[0].ctx;
 	irq_hw_number_t bit = irqd_to_hwirq(d);
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jia He

Commit 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip") missed the case in dwapb_irq_set_wake().

Without this fix, probing the dwapb gpio driver will hit a error:
"address between user and kernel address ranges" on a Ampere armv8a server and cause a panic.

Thank you for a fix!

Quoted 2 lines
Fixes 0ea683931adb ("gpio: dwapb: Convert driver to using the

GPIO-lib-based IRQ-chip")

Should be one line. But I think Bart or Linus may fix this problem if Serge is okay with a change in general.

Quoted 23 lines
---
 drivers/gpio/gpio-dwapb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-dwapb.c +2 -3
index a5b326754124..2a9046c0fb16 100644
@@ -343,8 +343,8 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 type)
 #ifdef CONFIG_PM_SLEEP
 static int dwapb_irq_set_wake(struct irq_data *d, unsigned int enable)
 {
-       struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d);
-       struct dwapb_gpio *gpio = igc->private;
+       struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+       struct dwapb_gpio *gpio = to_dwapb_gpio(gc);
        struct dwapb_context *ctx = gpio->ports[0].ctx;
        irq_hw_number_t bit = irqd_to_hwirq(d);
 
--

2.17.1

Signature · 2 lines
With Best Regards,
Andy Shevchenko
Acked-by on v1 1/1
#2 lore raw
In reply to Jia He
Quoted 6 lines · Jia He

Commit 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip") missed the case in dwapb_irq_set_wake().

Without this fix, probing the dwapb gpio driver will hit a error:
"address between user and kernel address ranges" on a Ampere armv8a server and cause a panic.

It's strange I didn't get the same panic. Anyway, good catch! Certainly:

Quoted 26 lines
Fixes 0ea683931adb ("gpio: dwapb: Convert driver to using the

GPIO-lib-based IRQ-chip")

---
 drivers/gpio/gpio-dwapb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-dwapb.c +2 -2
index a5b326754124..2a9046c0fb16 100644
@@ -343,8 +343,8 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 type)
 #ifdef CONFIG_PM_SLEEP
 static int dwapb_irq_set_wake(struct irq_data *d, unsigned int enable)
 {
-	struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d);
-	struct dwapb_gpio *gpio = igc->private;
+	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+	struct dwapb_gpio *gpio = to_dwapb_gpio(gc);
 	struct dwapb_context *ctx = gpio->ports[0].ctx;
 	irq_hw_number_t bit = irqd_to_hwirq(d);
 
Signature · 1 line
2.17.1
#3 lore raw
In reply to Jia He
Quoted 10 lines · Jia He

Commit 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip") missed the case in dwapb_irq_set_wake().

Without this fix, probing the dwapb gpio driver will hit a error:
"address between user and kernel address ranges" on a Ampere armv8a server and cause a panic.

Fixes 0ea683931adb ("gpio: dwapb: Convert driver to using the

GPIO-lib-based IRQ-chip")

No need to break the line in Fixes: tag.

Quoted 21 lines
---
 drivers/gpio/gpio-dwapb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-dwapb.c +2 -3
index a5b326754124..2a9046c0fb16 100644
@@ -343,8 +343,8 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 type)
 #ifdef CONFIG_PM_SLEEP
 static int dwapb_irq_set_wake(struct irq_data *d, unsigned int enable)
 {
-       struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d);
-       struct dwapb_gpio *gpio = igc->private;
+       struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+       struct dwapb_gpio *gpio = to_dwapb_gpio(gc);
        struct dwapb_context *ctx = gpio->ports[0].ctx;
        irq_hw_number_t bit = irqd_to_hwirq(d);
 
--
Quoted 2 lines

2.17.1

Applied for fixes, thanks!

Bartosz