mbox series

[00/12] genirq: Move irqchip runtime PM over to irq domain

Message ID 20220201120310.878267-1-maz@kernel.org
Headers show
Series genirq: Move irqchip runtime PM over to irq domain | expand

Message

Marc Zyngier Feb. 1, 2022, 12:02 p.m. UTC
Our irq_chip data structure currently suffers from two problems:

(1) the 'name' field is often dynamically populated with a reference
    to the underlying HW (DT node dame, for example)

(2) the 'parent_device' which is used to implement runtime PM is also
    dynamically populated

(3) there is at least one instance of a subsystem messing with the
    internals of irq_chip structures (gpiochip_set_irq_hooks is
    what I know about)

These things mean that although the primary use of irq_chip is to only
contain function pointers and other *static* information, the above
two fields result in these structures being copied in a number of
drivers. Eventually, it would be much better if the various drivers
would use irq_chip as an 'ops' data structure (potentially made
read-only), and keep the dynamic information somewhere more suitable.

For (2) we already have the irqdomain structure that is designed to
deal with the context in which interrupts are used, and it makes sense
to move the 'parent_device' field over to this structure. This is what
this small series is doing, with some minor cleanup on the way.

(1) and (3) will be dealt in separate series (and I don't have a good
solution for (3) yet).

Thanks,

	M.

Marc Zyngier (12):
  genirq: Allow the PM device to originate from irq domain
  irqchip/gic: Move PM device over to irq domain
  irqchip/renesas-intc-gpio: Move PM device over to irq domain
  irqchip/renesas-irqc: Move PM device over to irq domain
  irqchip/imx-intmux: Move PM device over to irq domain
  gpio: mt7621: Kill parent_device usage
  gpio: omap: Move PM device over to irq domain
  gpio: rcar: Move PM device over to irq domain
  gpio: tpmx86: Move PM device over to irq domain
  pinctrl: npcm: Fix broken references to chip->parent_device
  pinctrl: starfive: Move PM device over to irq domain
  genirq: Kill irq_chip::parent_device

 drivers/gpio/gpio-mt7621.c                |  1 -
 drivers/gpio/gpio-omap.c                  |  7 ++++---
 drivers/gpio/gpio-rcar.c                  |  2 +-
 drivers/gpio/gpio-tqmx86.c                |  3 ++-
 drivers/irqchip/irq-gic.c                 | 12 +++++------
 drivers/irqchip/irq-imx-intmux.c          |  8 +++-----
 drivers/irqchip/irq-renesas-intc-irqpin.c |  3 ++-
 drivers/irqchip/irq-renesas-irqc.c        |  3 ++-
 drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 25 +++++++++++------------
 drivers/pinctrl/pinctrl-starfive.c        |  3 ++-
 include/linux/irq.h                       |  2 --
 include/linux/irqdomain.h                 | 10 +++++++++
 kernel/irq/chip.c                         | 20 +++++++++++++-----
 13 files changed, 59 insertions(+), 40 deletions(-)

Comments

Geert Uytterhoeven Feb. 2, 2022, 2:25 p.m. UTC | #1
On Tue, Feb 1, 2022 at 1:15 PM Marc Zyngier <maz@kernel.org> wrote:
> As a preparation to moving the reference to the device used for
> runtime power management, add a new 'dev' field to the irqdomain
> structure for that exact purpose.
>
> The irq_chip_pm_{get,put}() helpers are made aware of the dual
> location via a new private helper.
>
> No functional change intended.
>
> Signed-off-by: Marc Zyngier <maz@kernel.org>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Geert Uytterhoeven Feb. 2, 2022, 2:25 p.m. UTC | #2
On Tue, Feb 1, 2022 at 1:16 PM Marc Zyngier <maz@kernel.org> wrote:
> Move the reference to the GIC device over to the irq domain.
> This allows for some localised cleanup.
>
> Signed-off-by: Marc Zyngier <maz@kernel.org>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Tony Lindgren Feb. 3, 2022, 7:05 a.m. UTC | #3
* Marc Zyngier <maz@kernel.org> [220201 12:03]:
> Move the reference to the device over to the irq domain.

PM still work for me:

Tested-by: Tony Lindgren <tony@atomide.com>
Bartosz Golaszewski Feb. 8, 2022, 11:13 a.m. UTC | #4
On Tue, Feb 1, 2022 at 1:03 PM Marc Zyngier <maz@kernel.org> wrote:
>
> Our irq_chip data structure currently suffers from two problems:
>
> (1) the 'name' field is often dynamically populated with a reference
>     to the underlying HW (DT node dame, for example)
>
> (2) the 'parent_device' which is used to implement runtime PM is also
>     dynamically populated
>
> (3) there is at least one instance of a subsystem messing with the
>     internals of irq_chip structures (gpiochip_set_irq_hooks is
>     what I know about)
>
> These things mean that although the primary use of irq_chip is to only
> contain function pointers and other *static* information, the above
> two fields result in these structures being copied in a number of
> drivers. Eventually, it would be much better if the various drivers
> would use irq_chip as an 'ops' data structure (potentially made
> read-only), and keep the dynamic information somewhere more suitable.
>
> For (2) we already have the irqdomain structure that is designed to
> deal with the context in which interrupts are used, and it makes sense
> to move the 'parent_device' field over to this structure. This is what
> this small series is doing, with some minor cleanup on the way.
>
> (1) and (3) will be dealt in separate series (and I don't have a good
> solution for (3) yet).
>
> Thanks,
>
>         M.
>
> Marc Zyngier (12):
>   genirq: Allow the PM device to originate from irq domain
>   irqchip/gic: Move PM device over to irq domain
>   irqchip/renesas-intc-gpio: Move PM device over to irq domain
>   irqchip/renesas-irqc: Move PM device over to irq domain
>   irqchip/imx-intmux: Move PM device over to irq domain
>   gpio: mt7621: Kill parent_device usage
>   gpio: omap: Move PM device over to irq domain
>   gpio: rcar: Move PM device over to irq domain
>   gpio: tpmx86: Move PM device over to irq domain
>   pinctrl: npcm: Fix broken references to chip->parent_device
>   pinctrl: starfive: Move PM device over to irq domain
>   genirq: Kill irq_chip::parent_device
>
>  drivers/gpio/gpio-mt7621.c                |  1 -
>  drivers/gpio/gpio-omap.c                  |  7 ++++---
>  drivers/gpio/gpio-rcar.c                  |  2 +-
>  drivers/gpio/gpio-tqmx86.c                |  3 ++-
>  drivers/irqchip/irq-gic.c                 | 12 +++++------
>  drivers/irqchip/irq-imx-intmux.c          |  8 +++-----
>  drivers/irqchip/irq-renesas-intc-irqpin.c |  3 ++-
>  drivers/irqchip/irq-renesas-irqc.c        |  3 ++-
>  drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 25 +++++++++++------------
>  drivers/pinctrl/pinctrl-starfive.c        |  3 ++-
>  include/linux/irq.h                       |  2 --
>  include/linux/irqdomain.h                 | 10 +++++++++
>  kernel/irq/chip.c                         | 20 +++++++++++++-----
>  13 files changed, 59 insertions(+), 40 deletions(-)
>
> --
> 2.30.2
>

The changes for GPIO are small so:

Acked-by: Bartosz Golaszewski <brgl@bgdev.pl>

You can take it through your tree and if there are any conflicts, I'll
just ask for an immutable branch.

Bart