All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio: dwapb: Fix missing conversion to GPIO-lib-based IRQ-chip
@ 2020-10-16 15:35 Jia He
  2020-10-16 15:43 ` Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jia He @ 2020-10-16 15:35 UTC (permalink / raw)
  To: Hoan Tran, Serge Semin, Linus Walleij, Bartosz Golaszewski
  Cc: Andy Shevchenko, linux-gpio, linux-kernel, 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")
Signed-off-by: Jia He <justin.he@arm.com>
---
 drivers/gpio/gpio-dwapb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index a5b326754124..2a9046c0fb16 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: dwapb: Fix missing conversion to GPIO-lib-based IRQ-chip
  2020-10-16 15:35 [PATCH] gpio: dwapb: Fix missing conversion to GPIO-lib-based IRQ-chip Jia He
@ 2020-10-16 15:43 ` Andy Shevchenko
  2020-10-16 16:39 ` Serge Semin
  2020-10-26 14:50 ` Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2020-10-16 15:43 UTC (permalink / raw)
  To: Jia He
  Cc: Hoan Tran, Serge Semin, Linus Walleij, Bartosz Golaszewski,
	open list:GPIO SUBSYSTEM, Linux Kernel Mailing List

On Fri, Oct 16, 2020 at 6:36 PM Jia He <justin.he@arm.com> wrote:
>
> 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!

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>


> 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.

> Signed-off-by: Jia He <justin.he@arm.com>
> ---
>  drivers/gpio/gpio-dwapb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index a5b326754124..2a9046c0fb16 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -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
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: dwapb: Fix missing conversion to GPIO-lib-based IRQ-chip
  2020-10-16 15:35 [PATCH] gpio: dwapb: Fix missing conversion to GPIO-lib-based IRQ-chip Jia He
  2020-10-16 15:43 ` Andy Shevchenko
@ 2020-10-16 16:39 ` Serge Semin
  2020-10-26 14:50 ` Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: Serge Semin @ 2020-10-16 16:39 UTC (permalink / raw)
  To: Jia He
  Cc: Hoan Tran, Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
	linux-gpio, linux-kernel


On Fri, Oct 16, 2020 at 11:35:44PM +0800, Jia He wrote:
> 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:
Acked-by: Serge Semin <fancer.lancer@gmail.com>

> 
> Fixes: 0ea683931adb ("gpio: dwapb: Convert driver to using the
> GPIO-lib-based IRQ-chip")
> Signed-off-by: Jia He <justin.he@arm.com>
> ---
>  drivers/gpio/gpio-dwapb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index a5b326754124..2a9046c0fb16 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: dwapb: Fix missing conversion to GPIO-lib-based IRQ-chip
  2020-10-16 15:35 [PATCH] gpio: dwapb: Fix missing conversion to GPIO-lib-based IRQ-chip Jia He
  2020-10-16 15:43 ` Andy Shevchenko
  2020-10-16 16:39 ` Serge Semin
@ 2020-10-26 14:50 ` Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2020-10-26 14:50 UTC (permalink / raw)
  To: Jia He
  Cc: Hoan Tran, Serge Semin, Linus Walleij, Andy Shevchenko, linux-gpio, LKML

On Fri, Oct 16, 2020 at 5:36 PM Jia He <justin.he@arm.com> wrote:
>
> 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.

> Signed-off-by: Jia He <justin.he@arm.com>
> ---
>  drivers/gpio/gpio-dwapb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index a5b326754124..2a9046c0fb16 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -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
>

Applied for fixes, thanks!

Bartosz

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-26 14:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-16 15:35 [PATCH] gpio: dwapb: Fix missing conversion to GPIO-lib-based IRQ-chip Jia He
2020-10-16 15:43 ` Andy Shevchenko
2020-10-16 16:39 ` Serge Semin
2020-10-26 14:50 ` Bartosz Golaszewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.