All of lore.kernel.org
 help / color / mirror / Atom feed
From: "irqchip-bot for Marc Zyngier" <tip-bot2@linutronix.de>
To: linux-kernel@vger.kernel.org
Cc: Marc Zyngier <maz@kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Tony Lindgren <tony@atomide.com>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	tglx@linutronix.de
Subject: [irqchip: irq/irqchip-next] genirq: Allow the PM device to originate from irq domain
Date: Wed, 09 Feb 2022 16:18:01 -0000	[thread overview]
Message-ID: <164442348103.16921.9094020077297342205.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20220201120310.878267-2-maz@kernel.org>

The following commit has been merged into the irq/irqchip-next branch of irqchip:

Commit-ID:     1f8863bfb5ca500ea1c7669b16b1931ba27fce20
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/1f8863bfb5ca500ea1c7669b16b1931ba27fce20
Author:        Marc Zyngier <maz@kernel.org>
AuthorDate:    Tue, 01 Feb 2022 12:02:59 
Committer:     Marc Zyngier <maz@kernel.org>
CommitterDate: Wed, 09 Feb 2022 13:35:56 

genirq: Allow the PM device to originate from irq domain

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>
Tested-by: Tony Lindgren <tony@atomide.com>
Acked-by: Bartosz Golaszewski <brgl@bgdev.pl>
Link: https://lore.kernel.org/r/20220201120310.878267-2-maz@kernel.org
---
 include/linux/irqdomain.h | 10 ++++++++++
 kernel/irq/chip.c         | 23 ++++++++++++++++++-----
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index d476405..be25a33 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -151,6 +151,8 @@ struct irq_domain_chip_generic;
  * @gc: Pointer to a list of generic chips. There is a helper function for
  *      setting up one or more generic chips for interrupt controllers
  *      drivers using the generic chip library which uses this pointer.
+ * @dev: Pointer to a device that the domain represent, and that will be
+ *       used for power management purposes.
  * @parent: Pointer to parent irq_domain to support hierarchy irq_domains
  *
  * Revmap data, used internally by irq_domain
@@ -171,6 +173,7 @@ struct irq_domain {
 	struct fwnode_handle *fwnode;
 	enum irq_domain_bus_token bus_token;
 	struct irq_domain_chip_generic *gc;
+	struct device *dev;
 #ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
 	struct irq_domain *parent;
 #endif
@@ -226,6 +229,13 @@ static inline struct device_node *irq_domain_get_of_node(struct irq_domain *d)
 	return to_of_node(d->fwnode);
 }
 
+static inline void irq_domain_set_pm_device(struct irq_domain *d,
+					    struct device *dev)
+{
+	if (d)
+		d->dev = dev;
+}
+
 #ifdef CONFIG_IRQ_DOMAIN
 struct fwnode_handle *__irq_domain_alloc_fwnode(unsigned int type, int id,
 						const char *name, phys_addr_t *pa);
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index c093246..a2a12cd 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -1558,6 +1558,17 @@ int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
 	return 0;
 }
 
+static struct device *irq_get_parent_device(struct irq_data *data)
+{
+	if (data->chip->parent_device)
+		return data->chip->parent_device;
+
+	if (data->domain)
+		return data->domain->dev;
+
+	return NULL;
+}
+
 /**
  * irq_chip_pm_get - Enable power for an IRQ chip
  * @data:	Pointer to interrupt specific data
@@ -1567,12 +1578,13 @@ int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
  */
 int irq_chip_pm_get(struct irq_data *data)
 {
+	struct device *dev = irq_get_parent_device(data);
 	int retval;
 
-	if (IS_ENABLED(CONFIG_PM) && data->chip->parent_device) {
-		retval = pm_runtime_get_sync(data->chip->parent_device);
+	if (IS_ENABLED(CONFIG_PM) && dev) {
+		retval = pm_runtime_get_sync(dev);
 		if (retval < 0) {
-			pm_runtime_put_noidle(data->chip->parent_device);
+			pm_runtime_put_noidle(dev);
 			return retval;
 		}
 	}
@@ -1590,10 +1602,11 @@ int irq_chip_pm_get(struct irq_data *data)
  */
 int irq_chip_pm_put(struct irq_data *data)
 {
+	struct device *dev = irq_get_parent_device(data);
 	int retval = 0;
 
-	if (IS_ENABLED(CONFIG_PM) && data->chip->parent_device)
-		retval = pm_runtime_put(data->chip->parent_device);
+	if (IS_ENABLED(CONFIG_PM) && dev)
+		retval = pm_runtime_put(dev);
 
 	return (retval < 0) ? retval : 0;
 }

  parent reply	other threads:[~2022-02-09 16:18 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-01 12:02 [PATCH 00/12] genirq: Move irqchip runtime PM over to irq domain Marc Zyngier
2022-02-01 12:02 ` Marc Zyngier
2022-02-01 12:02 ` Marc Zyngier
2022-02-01 12:02 ` [PATCH 01/12] genirq: Allow the PM device to originate from " Marc Zyngier
2022-02-01 12:02   ` Marc Zyngier
2022-02-01 12:02   ` Marc Zyngier
2022-02-02 14:25   ` Geert Uytterhoeven
2022-02-02 14:25     ` Geert Uytterhoeven
2022-02-02 14:25     ` Geert Uytterhoeven
2022-02-03  7:04   ` Tony Lindgren
2022-02-03  7:04     ` Tony Lindgren
2022-02-03  7:04     ` Tony Lindgren
2022-02-09 16:18   ` irqchip-bot for Marc Zyngier [this message]
2022-02-01 12:03 ` [PATCH 02/12] irqchip/gic: Move PM device over to " Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-02 14:25   ` Geert Uytterhoeven
2022-02-02 14:25     ` Geert Uytterhoeven
2022-02-02 14:25     ` Geert Uytterhoeven
2022-02-09 16:18   ` [irqchip: irq/irqchip-next] " irqchip-bot for Marc Zyngier
2022-02-01 12:03 ` [PATCH 03/12] irqchip/renesas-intc-gpio: " Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-02 14:27   ` Geert Uytterhoeven
2022-02-02 14:27     ` Geert Uytterhoeven
2022-02-02 14:27     ` Geert Uytterhoeven
2022-02-09 13:40     ` Marc Zyngier
2022-02-09 13:40       ` Marc Zyngier
2022-02-09 13:40       ` Marc Zyngier
2022-02-09 16:17   ` [irqchip: irq/irqchip-next] irqchip/renesas-intc-irqpin: " irqchip-bot for Marc Zyngier
2022-02-01 12:03 ` [PATCH 04/12] irqchip/renesas-irqc: " Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-02 14:28   ` Geert Uytterhoeven
2022-02-02 14:28     ` Geert Uytterhoeven
2022-02-02 14:28     ` Geert Uytterhoeven
2022-02-09 16:17   ` [irqchip: irq/irqchip-next] " irqchip-bot for Marc Zyngier
2022-02-01 12:03 ` [PATCH 05/12] irqchip/imx-intmux: " Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-09 16:17   ` [irqchip: irq/irqchip-next] " irqchip-bot for Marc Zyngier
2022-02-01 12:03 ` [PATCH 06/12] gpio: mt7621: Kill parent_device usage Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-09 16:17   ` [irqchip: irq/irqchip-next] " irqchip-bot for Marc Zyngier
2022-02-01 12:03 ` [PATCH 07/12] gpio: omap: Move PM device over to irq domain Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-03  7:05   ` Tony Lindgren
2022-02-03  7:05     ` Tony Lindgren
2022-02-03  7:05     ` Tony Lindgren
2022-02-09 16:17   ` [irqchip: irq/irqchip-next] " irqchip-bot for Marc Zyngier
2022-02-01 12:03 ` [PATCH 08/12] gpio: rcar: " Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-02 14:28   ` Geert Uytterhoeven
2022-02-02 14:28     ` Geert Uytterhoeven
2022-02-02 14:28     ` Geert Uytterhoeven
2022-02-09 16:17   ` [irqchip: irq/irqchip-next] " irqchip-bot for Marc Zyngier
2022-02-01 12:03 ` [PATCH 09/12] gpio: tpmx86: " Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-09 16:17   ` [irqchip: irq/irqchip-next] " irqchip-bot for Marc Zyngier
2022-02-01 12:03 ` [PATCH 10/12] pinctrl: npcm: Fix broken references to chip->parent_device Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-09 16:17   ` [irqchip: irq/irqchip-next] " irqchip-bot for Marc Zyngier
2022-02-10 11:09   ` irqchip-bot for Marc Zyngier
2022-02-11  0:42   ` [PATCH 10/12] " Linus Walleij
2022-02-11  0:42     ` Linus Walleij
2022-02-11  0:42     ` Linus Walleij
2022-02-01 12:03 ` [PATCH 11/12] pinctrl: starfive: Move PM device over to irq domain Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-01 15:16   ` Emil Renner Berthing
2022-02-01 15:16     ` Emil Renner Berthing
2022-02-01 15:16     ` Emil Renner Berthing
2022-02-01 15:30     ` Emil Renner Berthing
2022-02-01 15:30       ` Emil Renner Berthing
2022-02-01 15:30       ` Emil Renner Berthing
2022-02-01 16:06     ` Marc Zyngier
2022-02-01 16:06       ` Marc Zyngier
2022-02-01 16:06       ` Marc Zyngier
2022-02-09 16:17   ` [irqchip: irq/irqchip-next] " irqchip-bot for Marc Zyngier
2022-02-10 11:09   ` irqchip-bot for Marc Zyngier
2022-02-01 12:03 ` [PATCH 12/12] genirq: Kill irq_chip::parent_device Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-01 12:03   ` Marc Zyngier
2022-02-09 16:17   ` [irqchip: irq/irqchip-next] " irqchip-bot for Marc Zyngier
2022-02-10 11:09   ` irqchip-bot for Marc Zyngier
2022-02-08 11:13 ` [PATCH 00/12] genirq: Move irqchip runtime PM over to irq domain Bartosz Golaszewski
2022-02-08 11:13   ` Bartosz Golaszewski
2022-02-08 11:13   ` Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=164442348103.16921.9094020077297342205.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=brgl@bgdev.pl \
    --cc=geert+renesas@glider.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.