* [PATCH 00/11] irqchip: Pass platform device to platform drivers
@ 2025-10-13 9:46 Johan Hovold
2025-10-13 9:46 ` [PATCH 01/11] irqchip/bcm2712-mip: Fix OF node reference imbalance Johan Hovold
` (10 more replies)
0 siblings, 11 replies; 40+ messages in thread
From: Johan Hovold @ 2025-10-13 9:46 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam,
Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven,
Magnus Damm, linux-kernel, Johan Hovold
The IRQCHIP_PLATFORM_DRIVER macros can be used to convert OF irqchip
drivers to platform drivers but currently reuse the OF init callback
prototype that only takes OF nodes as arguments. This forces drivers to
do reverse lookups of their struct devices during probe if they need
them for things like dev_printk() and device managed resources.
Half of the drivers doing reverse lookups also currently fail to release
the additional reference taken during the lookup, while other drivers
have had the reference leak plugged in various ways (e.g. using
non-intuitive cleanup constructs which still confuse static checkers).
Switch to using a probe callback that takes a platform device as its
first argument to simplify drivers and plug the remaining (mostly
benign) reference leaks.
Included are also some related preparatory fixes for an OF node
reference imbalance and section mismatches due to misplaced __init
markers (in some cases left over from platform driver conversions).
Johan
Johan Hovold (11):
irqchip/bcm2712-mip: Fix OF node reference imbalance
irqchip/bcm2712-mip: Fix section mismatch
irqchip/irq-bcm7038-l1: Fix section mismatch
irqchip/irq-bcm7120-l2: Fix section mismatch
irqchip/irq-brcmstb-l2: Fix section mismatch
irqchip/imx-mu-msi: Fix section mismatch
irqchip/renesas-rzg2l: Fix section mismatch
irqchip/starfive-jh8100: Fix section mismatch
irqchip/qcom-irq-combiner: Fix section mismatch
irqchip: Drop leftover brackets
irqchip: Pass platform device to platform drivers
drivers/irqchip/irq-bcm2712-mip.c | 11 ++-----
drivers/irqchip/irq-bcm7038-l1.c | 12 +++----
drivers/irqchip/irq-bcm7120-l2.c | 28 +++++-----------
drivers/irqchip/irq-brcmstb-l2.c | 25 +++++++--------
drivers/irqchip/irq-imx-mu-msi.c | 28 +++++++---------
drivers/irqchip/irq-mchp-eic.c | 5 +--
drivers/irqchip/irq-meson-gpio.c | 5 +--
drivers/irqchip/irq-qcom-mpm.c | 6 ++--
drivers/irqchip/irq-renesas-rzg2l.c | 37 ++++++----------------
drivers/irqchip/irq-renesas-rzv2h.c | 32 ++++++-------------
drivers/irqchip/irq-starfive-jh8100-intc.c | 6 ++--
drivers/irqchip/irqchip.c | 10 +++---
drivers/irqchip/qcom-irq-combiner.c | 2 +-
drivers/irqchip/qcom-pdc.c | 5 +--
include/linux/irqchip.h | 8 ++++-
15 files changed, 85 insertions(+), 135 deletions(-)
--
2.49.1
^ permalink raw reply [flat|nested] 40+ messages in thread* [PATCH 01/11] irqchip/bcm2712-mip: Fix OF node reference imbalance 2025-10-13 9:46 [PATCH 00/11] irqchip: Pass platform device to platform drivers Johan Hovold @ 2025-10-13 9:46 ` Johan Hovold 2025-10-13 15:56 ` Florian Fainelli 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 02/11] irqchip/bcm2712-mip: Fix section mismatch Johan Hovold ` (9 subsequent siblings) 10 siblings, 2 replies; 40+ messages in thread From: Johan Hovold @ 2025-10-13 9:46 UTC (permalink / raw) To: Thomas Gleixner Cc: Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel, Johan Hovold, Stanimir Varbanov The init callback must not decrement the reference count of the provided irqchip OF node. This should not cause any trouble currently, but if the driver ever starts probe deferring it could lead to warnings about reference underflow and saturation. Fixes: 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interrupt controller") Cc: Stanimir Varbanov <svarbanov@suse.de> Signed-off-by: Johan Hovold <johan@kernel.org> --- drivers/irqchip/irq-bcm2712-mip.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/irqchip/irq-bcm2712-mip.c b/drivers/irqchip/irq-bcm2712-mip.c index 9bd7bc0bf6d5..256c2d59f717 100644 --- a/drivers/irqchip/irq-bcm2712-mip.c +++ b/drivers/irqchip/irq-bcm2712-mip.c @@ -239,7 +239,6 @@ static int __init mip_of_msi_init(struct device_node *node, struct device_node * int ret; pdev = of_find_device_by_node(node); - of_node_put(node); if (!pdev) return -EPROBE_DEFER; -- 2.49.1 ^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 01/11] irqchip/bcm2712-mip: Fix OF node reference imbalance 2025-10-13 9:46 ` [PATCH 01/11] irqchip/bcm2712-mip: Fix OF node reference imbalance Johan Hovold @ 2025-10-13 15:56 ` Florian Fainelli 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 1 sibling, 0 replies; 40+ messages in thread From: Florian Fainelli @ 2025-10-13 15:56 UTC (permalink / raw) To: Johan Hovold, Thomas Gleixner Cc: Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel, Stanimir Varbanov On 10/13/25 02:46, Johan Hovold wrote: > The init callback must not decrement the reference count of the provided > irqchip OF node. > > This should not cause any trouble currently, but if the driver ever > starts probe deferring it could lead to warnings about reference > underflow and saturation. > > Fixes: 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interrupt controller") > Cc: Stanimir Varbanov <svarbanov@suse.de> > Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> -- Florian ^ permalink raw reply [flat|nested] 40+ messages in thread
* [tip: irq/drivers] irqchip/bcm2712-mip: Fix OF node reference imbalance 2025-10-13 9:46 ` [PATCH 01/11] irqchip/bcm2712-mip: Fix OF node reference imbalance Johan Hovold 2025-10-13 15:56 ` Florian Fainelli @ 2025-10-16 9:51 ` tip-bot2 for Johan Hovold 1 sibling, 0 replies; 40+ messages in thread From: tip-bot2 for Johan Hovold @ 2025-10-16 9:51 UTC (permalink / raw) To: linux-tip-commits Cc: Johan Hovold, Thomas Gleixner, Florian Fainelli, x86, linux-kernel The following commit has been merged into the irq/drivers branch of tip: Commit-ID: 0435bcc4e5858c632c1b6d5afa637580d9779890 Gitweb: https://git.kernel.org/tip/0435bcc4e5858c632c1b6d5afa637580d9779890 Author: Johan Hovold <johan@kernel.org> AuthorDate: Mon, 13 Oct 2025 11:46:01 +02:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Thu, 16 Oct 2025 11:30:37 +02:00 irqchip/bcm2712-mip: Fix OF node reference imbalance The init callback must not decrement the reference count of the provided irqchip OF node. This should not cause any trouble currently, but if the driver ever starts probe deferring it could lead to warnings about reference underflow and saturation. Fixes: 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interrupt controller") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> --- drivers/irqchip/irq-bcm2712-mip.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/irqchip/irq-bcm2712-mip.c b/drivers/irqchip/irq-bcm2712-mip.c index 9bd7bc0..256c2d5 100644 --- a/drivers/irqchip/irq-bcm2712-mip.c +++ b/drivers/irqchip/irq-bcm2712-mip.c @@ -239,7 +239,6 @@ static int __init mip_of_msi_init(struct device_node *node, struct device_node * int ret; pdev = of_find_device_by_node(node); - of_node_put(node); if (!pdev) return -EPROBE_DEFER; ^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 02/11] irqchip/bcm2712-mip: Fix section mismatch 2025-10-13 9:46 [PATCH 00/11] irqchip: Pass platform device to platform drivers Johan Hovold 2025-10-13 9:46 ` [PATCH 01/11] irqchip/bcm2712-mip: Fix OF node reference imbalance Johan Hovold @ 2025-10-13 9:46 ` Johan Hovold 2025-10-13 15:56 ` Florian Fainelli 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 03/11] irqchip/irq-bcm7038-l1: " Johan Hovold ` (8 subsequent siblings) 10 siblings, 2 replies; 40+ messages in thread From: Johan Hovold @ 2025-10-13 9:46 UTC (permalink / raw) To: Thomas Gleixner Cc: Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel, Johan Hovold, Stanimir Varbanov Platform drivers can be probed after their init sections have been discarded so the irqchip init callback must not live in init. Fixes: 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interrupt controller") Cc: Stanimir Varbanov <svarbanov@suse.de> Signed-off-by: Johan Hovold <johan@kernel.org> --- drivers/irqchip/irq-bcm2712-mip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-bcm2712-mip.c b/drivers/irqchip/irq-bcm2712-mip.c index 256c2d59f717..8466646e5a2d 100644 --- a/drivers/irqchip/irq-bcm2712-mip.c +++ b/drivers/irqchip/irq-bcm2712-mip.c @@ -232,7 +232,7 @@ static int mip_parse_dt(struct mip_priv *mip, struct device_node *np) return ret; } -static int __init mip_of_msi_init(struct device_node *node, struct device_node *parent) +static int mip_of_msi_init(struct device_node *node, struct device_node *parent) { struct platform_device *pdev; struct mip_priv *mip; -- 2.49.1 ^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 02/11] irqchip/bcm2712-mip: Fix section mismatch 2025-10-13 9:46 ` [PATCH 02/11] irqchip/bcm2712-mip: Fix section mismatch Johan Hovold @ 2025-10-13 15:56 ` Florian Fainelli 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 1 sibling, 0 replies; 40+ messages in thread From: Florian Fainelli @ 2025-10-13 15:56 UTC (permalink / raw) To: Johan Hovold, Thomas Gleixner Cc: Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel, Stanimir Varbanov On 10/13/25 02:46, Johan Hovold wrote: > Platform drivers can be probed after their init sections have been > discarded so the irqchip init callback must not live in init. > > Fixes: 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interrupt controller") > Cc: Stanimir Varbanov <svarbanov@suse.de> > Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> -- Florian ^ permalink raw reply [flat|nested] 40+ messages in thread
* [tip: irq/drivers] irqchip/bcm2712-mip: Fix section mismatch 2025-10-13 9:46 ` [PATCH 02/11] irqchip/bcm2712-mip: Fix section mismatch Johan Hovold 2025-10-13 15:56 ` Florian Fainelli @ 2025-10-16 9:51 ` tip-bot2 for Johan Hovold 1 sibling, 0 replies; 40+ messages in thread From: tip-bot2 for Johan Hovold @ 2025-10-16 9:51 UTC (permalink / raw) To: linux-tip-commits Cc: Johan Hovold, Thomas Gleixner, Florian Fainelli, x86, linux-kernel The following commit has been merged into the irq/drivers branch of tip: Commit-ID: a8452d1d59d46066051e676d5daa472cd08cb304 Gitweb: https://git.kernel.org/tip/a8452d1d59d46066051e676d5daa472cd08cb304 Author: Johan Hovold <johan@kernel.org> AuthorDate: Mon, 13 Oct 2025 11:46:02 +02:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Thu, 16 Oct 2025 11:30:37 +02:00 irqchip/bcm2712-mip: Fix section mismatch Platform drivers can be probed after their init sections have been discarded so the irqchip init callback must not live in init. Fixes: 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interrupt controller") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> --- drivers/irqchip/irq-bcm2712-mip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-bcm2712-mip.c b/drivers/irqchip/irq-bcm2712-mip.c index 256c2d5..8466646 100644 --- a/drivers/irqchip/irq-bcm2712-mip.c +++ b/drivers/irqchip/irq-bcm2712-mip.c @@ -232,7 +232,7 @@ err_put: return ret; } -static int __init mip_of_msi_init(struct device_node *node, struct device_node *parent) +static int mip_of_msi_init(struct device_node *node, struct device_node *parent) { struct platform_device *pdev; struct mip_priv *mip; ^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 03/11] irqchip/irq-bcm7038-l1: Fix section mismatch 2025-10-13 9:46 [PATCH 00/11] irqchip: Pass platform device to platform drivers Johan Hovold 2025-10-13 9:46 ` [PATCH 01/11] irqchip/bcm2712-mip: Fix OF node reference imbalance Johan Hovold 2025-10-13 9:46 ` [PATCH 02/11] irqchip/bcm2712-mip: Fix section mismatch Johan Hovold @ 2025-10-13 9:46 ` Johan Hovold 2025-10-13 15:56 ` Florian Fainelli 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 04/11] irqchip/irq-bcm7120-l2: " Johan Hovold ` (7 subsequent siblings) 10 siblings, 2 replies; 40+ messages in thread From: Johan Hovold @ 2025-10-13 9:46 UTC (permalink / raw) To: Thomas Gleixner Cc: Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel, Johan Hovold, Florian Fainelli Platform drivers can be probed after their init sections have been discarded so the irqchip init callback must not live in init. Fixes: c057c799e379 ("irqchip/irq-bcm7038-l1: Switch to IRQCHIP_PLATFORM_DRIVER") Cc: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Johan Hovold <johan@kernel.org> --- drivers/irqchip/irq-bcm7038-l1.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c index 04fac0cc857f..e28be83872cb 100644 --- a/drivers/irqchip/irq-bcm7038-l1.c +++ b/drivers/irqchip/irq-bcm7038-l1.c @@ -219,9 +219,9 @@ static int bcm7038_l1_set_affinity(struct irq_data *d, } #endif -static int __init bcm7038_l1_init_one(struct device_node *dn, - unsigned int idx, - struct bcm7038_l1_chip *intc) +static int bcm7038_l1_init_one(struct device_node *dn, + unsigned int idx, + struct bcm7038_l1_chip *intc) { struct resource res; resource_size_t sz; @@ -395,8 +395,7 @@ static const struct irq_domain_ops bcm7038_l1_domain_ops = { .map = bcm7038_l1_map, }; -static int __init bcm7038_l1_of_init(struct device_node *dn, - struct device_node *parent) +static int bcm7038_l1_of_init(struct device_node *dn, struct device_node *parent) { struct bcm7038_l1_chip *intc; int idx, ret; -- 2.49.1 ^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 03/11] irqchip/irq-bcm7038-l1: Fix section mismatch 2025-10-13 9:46 ` [PATCH 03/11] irqchip/irq-bcm7038-l1: " Johan Hovold @ 2025-10-13 15:56 ` Florian Fainelli 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 1 sibling, 0 replies; 40+ messages in thread From: Florian Fainelli @ 2025-10-13 15:56 UTC (permalink / raw) To: Johan Hovold, Thomas Gleixner Cc: Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel, Florian Fainelli On 10/13/25 02:46, Johan Hovold wrote: > Platform drivers can be probed after their init sections have been > discarded so the irqchip init callback must not live in init. > > Fixes: c057c799e379 ("irqchip/irq-bcm7038-l1: Switch to IRQCHIP_PLATFORM_DRIVER") > Cc: Florian Fainelli <f.fainelli@gmail.com> > Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> -- Florian ^ permalink raw reply [flat|nested] 40+ messages in thread
* [tip: irq/drivers] irqchip/irq-bcm7038-l1: Fix section mismatch 2025-10-13 9:46 ` [PATCH 03/11] irqchip/irq-bcm7038-l1: " Johan Hovold 2025-10-13 15:56 ` Florian Fainelli @ 2025-10-16 9:51 ` tip-bot2 for Johan Hovold 1 sibling, 0 replies; 40+ messages in thread From: tip-bot2 for Johan Hovold @ 2025-10-16 9:51 UTC (permalink / raw) To: linux-tip-commits Cc: Johan Hovold, Thomas Gleixner, Florian Fainelli, x86, linux-kernel The following commit has been merged into the irq/drivers branch of tip: Commit-ID: e9db5332caaf4789ae3bafe72f61ad8e6e0c2d81 Gitweb: https://git.kernel.org/tip/e9db5332caaf4789ae3bafe72f61ad8e6e0c2d81 Author: Johan Hovold <johan@kernel.org> AuthorDate: Mon, 13 Oct 2025 11:46:03 +02:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Thu, 16 Oct 2025 11:30:37 +02:00 irqchip/irq-bcm7038-l1: Fix section mismatch Platform drivers can be probed after their init sections have been discarded so the irqchip init callback must not live in init. Fixes: c057c799e379 ("irqchip/irq-bcm7038-l1: Switch to IRQCHIP_PLATFORM_DRIVER") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> --- drivers/irqchip/irq-bcm7038-l1.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c index 04fac0c..eda33bd 100644 --- a/drivers/irqchip/irq-bcm7038-l1.c +++ b/drivers/irqchip/irq-bcm7038-l1.c @@ -219,9 +219,8 @@ static int bcm7038_l1_set_affinity(struct irq_data *d, } #endif -static int __init bcm7038_l1_init_one(struct device_node *dn, - unsigned int idx, - struct bcm7038_l1_chip *intc) +static int bcm7038_l1_init_one(struct device_node *dn, unsigned int idx, + struct bcm7038_l1_chip *intc) { struct resource res; resource_size_t sz; @@ -395,8 +394,7 @@ static const struct irq_domain_ops bcm7038_l1_domain_ops = { .map = bcm7038_l1_map, }; -static int __init bcm7038_l1_of_init(struct device_node *dn, - struct device_node *parent) +static int bcm7038_l1_of_init(struct device_node *dn, struct device_node *parent) { struct bcm7038_l1_chip *intc; int idx, ret; ^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 04/11] irqchip/irq-bcm7120-l2: Fix section mismatch 2025-10-13 9:46 [PATCH 00/11] irqchip: Pass platform device to platform drivers Johan Hovold ` (2 preceding siblings ...) 2025-10-13 9:46 ` [PATCH 03/11] irqchip/irq-bcm7038-l1: " Johan Hovold @ 2025-10-13 9:46 ` Johan Hovold 2025-10-13 15:57 ` Florian Fainelli 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 05/11] irqchip/irq-brcmstb-l2: " Johan Hovold ` (6 subsequent siblings) 10 siblings, 2 replies; 40+ messages in thread From: Johan Hovold @ 2025-10-13 9:46 UTC (permalink / raw) To: Thomas Gleixner Cc: Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel, Johan Hovold, Florian Fainelli Platform drivers can be probed after their init sections have been discarded so the irqchip init callbacks must not live in init. Fixes: 3ac268d5ed22 ("irqchip/irq-bcm7120-l2: Switch to IRQCHIP_PLATFORM_DRIVER") Cc: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Johan Hovold <johan@kernel.org> --- drivers/irqchip/irq-bcm7120-l2.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c index ff22c3104401..63ff68d33787 100644 --- a/drivers/irqchip/irq-bcm7120-l2.c +++ b/drivers/irqchip/irq-bcm7120-l2.c @@ -143,8 +143,7 @@ static int bcm7120_l2_intc_init_one(struct device_node *dn, return 0; } -static int __init bcm7120_l2_intc_iomap_7120(struct device_node *dn, - struct bcm7120_l2_intc_data *data) +static int bcm7120_l2_intc_iomap_7120(struct device_node *dn, struct bcm7120_l2_intc_data *data) { int ret; @@ -177,8 +176,7 @@ static int __init bcm7120_l2_intc_iomap_7120(struct device_node *dn, return 0; } -static int __init bcm7120_l2_intc_iomap_3380(struct device_node *dn, - struct bcm7120_l2_intc_data *data) +static int bcm7120_l2_intc_iomap_3380(struct device_node *dn, struct bcm7120_l2_intc_data *data) { unsigned int gc_idx; @@ -208,7 +206,7 @@ static int __init bcm7120_l2_intc_iomap_3380(struct device_node *dn, return 0; } -static int __init bcm7120_l2_intc_probe(struct device_node *dn, +static int bcm7120_l2_intc_probe(struct device_node *dn, struct device_node *parent, int (*iomap_regs_fn)(struct device_node *, struct bcm7120_l2_intc_data *), @@ -339,15 +337,13 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn, return ret; } -static int __init bcm7120_l2_intc_probe_7120(struct device_node *dn, - struct device_node *parent) +static int bcm7120_l2_intc_probe_7120(struct device_node *dn, struct device_node *parent) { return bcm7120_l2_intc_probe(dn, parent, bcm7120_l2_intc_iomap_7120, "BCM7120 L2"); } -static int __init bcm7120_l2_intc_probe_3380(struct device_node *dn, - struct device_node *parent) +static int bcm7120_l2_intc_probe_3380(struct device_node *dn, struct device_node *parent) { return bcm7120_l2_intc_probe(dn, parent, bcm7120_l2_intc_iomap_3380, "BCM3380 L2"); -- 2.49.1 ^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 04/11] irqchip/irq-bcm7120-l2: Fix section mismatch 2025-10-13 9:46 ` [PATCH 04/11] irqchip/irq-bcm7120-l2: " Johan Hovold @ 2025-10-13 15:57 ` Florian Fainelli 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 1 sibling, 0 replies; 40+ messages in thread From: Florian Fainelli @ 2025-10-13 15:57 UTC (permalink / raw) To: Johan Hovold, Thomas Gleixner Cc: Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel, Florian Fainelli On 10/13/25 02:46, Johan Hovold wrote: > Platform drivers can be probed after their init sections have been > discarded so the irqchip init callbacks must not live in init. > > Fixes: 3ac268d5ed22 ("irqchip/irq-bcm7120-l2: Switch to IRQCHIP_PLATFORM_DRIVER") > Cc: Florian Fainelli <f.fainelli@gmail.com> > Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> -- Florian ^ permalink raw reply [flat|nested] 40+ messages in thread
* [tip: irq/drivers] irqchip/irq-bcm7120-l2: Fix section mismatch 2025-10-13 9:46 ` [PATCH 04/11] irqchip/irq-bcm7120-l2: " Johan Hovold 2025-10-13 15:57 ` Florian Fainelli @ 2025-10-16 9:51 ` tip-bot2 for Johan Hovold 1 sibling, 0 replies; 40+ messages in thread From: tip-bot2 for Johan Hovold @ 2025-10-16 9:51 UTC (permalink / raw) To: linux-tip-commits Cc: Johan Hovold, Thomas Gleixner, Florian Fainelli, x86, linux-kernel The following commit has been merged into the irq/drivers branch of tip: Commit-ID: bfc0c5beab1fde843677923cf008f41d583c980a Gitweb: https://git.kernel.org/tip/bfc0c5beab1fde843677923cf008f41d583c980a Author: Johan Hovold <johan@kernel.org> AuthorDate: Mon, 13 Oct 2025 11:46:04 +02:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Thu, 16 Oct 2025 11:30:37 +02:00 irqchip/irq-bcm7120-l2: Fix section mismatch Platform drivers can be probed after their init sections have been discarded so the irqchip init callbacks must not live in init. Fixes: 3ac268d5ed22 ("irqchip/irq-bcm7120-l2: Switch to IRQCHIP_PLATFORM_DRIVER") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> --- drivers/irqchip/irq-bcm7120-l2.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c index ff22c31..b6c8556 100644 --- a/drivers/irqchip/irq-bcm7120-l2.c +++ b/drivers/irqchip/irq-bcm7120-l2.c @@ -143,8 +143,7 @@ static int bcm7120_l2_intc_init_one(struct device_node *dn, return 0; } -static int __init bcm7120_l2_intc_iomap_7120(struct device_node *dn, - struct bcm7120_l2_intc_data *data) +static int bcm7120_l2_intc_iomap_7120(struct device_node *dn, struct bcm7120_l2_intc_data *data) { int ret; @@ -177,8 +176,7 @@ static int __init bcm7120_l2_intc_iomap_7120(struct device_node *dn, return 0; } -static int __init bcm7120_l2_intc_iomap_3380(struct device_node *dn, - struct bcm7120_l2_intc_data *data) +static int bcm7120_l2_intc_iomap_3380(struct device_node *dn, struct bcm7120_l2_intc_data *data) { unsigned int gc_idx; @@ -208,10 +206,9 @@ static int __init bcm7120_l2_intc_iomap_3380(struct device_node *dn, return 0; } -static int __init bcm7120_l2_intc_probe(struct device_node *dn, - struct device_node *parent, +static int bcm7120_l2_intc_probe(struct device_node *dn, struct device_node *parent, int (*iomap_regs_fn)(struct device_node *, - struct bcm7120_l2_intc_data *), + struct bcm7120_l2_intc_data *), const char *intc_name) { unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; @@ -339,15 +336,13 @@ out_free_data: return ret; } -static int __init bcm7120_l2_intc_probe_7120(struct device_node *dn, - struct device_node *parent) +static int bcm7120_l2_intc_probe_7120(struct device_node *dn, struct device_node *parent) { return bcm7120_l2_intc_probe(dn, parent, bcm7120_l2_intc_iomap_7120, "BCM7120 L2"); } -static int __init bcm7120_l2_intc_probe_3380(struct device_node *dn, - struct device_node *parent) +static int bcm7120_l2_intc_probe_3380(struct device_node *dn, struct device_node *parent) { return bcm7120_l2_intc_probe(dn, parent, bcm7120_l2_intc_iomap_3380, "BCM3380 L2"); ^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 05/11] irqchip/irq-brcmstb-l2: Fix section mismatch 2025-10-13 9:46 [PATCH 00/11] irqchip: Pass platform device to platform drivers Johan Hovold ` (3 preceding siblings ...) 2025-10-13 9:46 ` [PATCH 04/11] irqchip/irq-bcm7120-l2: " Johan Hovold @ 2025-10-13 9:46 ` Johan Hovold 2025-10-13 15:57 ` Florian Fainelli 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 06/11] irqchip/imx-mu-msi: " Johan Hovold ` (5 subsequent siblings) 10 siblings, 2 replies; 40+ messages in thread From: Johan Hovold @ 2025-10-13 9:46 UTC (permalink / raw) To: Thomas Gleixner Cc: Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel, Johan Hovold, Florian Fainelli Platform drivers can be probed after their init sections have been discarded so the irqchip init callbacks must not live in init. Fixes: 51d9db5c8fbb ("irqchip/irq-brcmstb-l2: Switch to IRQCHIP_PLATFORM_DRIVER") Cc: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Johan Hovold <johan@kernel.org> --- drivers/irqchip/irq-brcmstb-l2.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/irqchip/irq-brcmstb-l2.c b/drivers/irqchip/irq-brcmstb-l2.c index 1bec5b2cd3f0..53e67c6c01f7 100644 --- a/drivers/irqchip/irq-brcmstb-l2.c +++ b/drivers/irqchip/irq-brcmstb-l2.c @@ -138,10 +138,8 @@ static void brcmstb_l2_intc_resume(struct irq_data *d) irq_reg_writel(gc, ~b->saved_mask, ct->regs.enable); } -static int __init brcmstb_l2_intc_of_init(struct device_node *np, - struct device_node *parent, - const struct brcmstb_intc_init_params - *init_params) +static int brcmstb_l2_intc_of_init(struct device_node *np, struct device_node *parent, + const struct brcmstb_intc_init_params *init_params) { unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; unsigned int set = 0; @@ -257,14 +255,12 @@ static int __init brcmstb_l2_intc_of_init(struct device_node *np, return ret; } -static int __init brcmstb_l2_edge_intc_of_init(struct device_node *np, - struct device_node *parent) +static int brcmstb_l2_edge_intc_of_init(struct device_node *np, struct device_node *parent) { return brcmstb_l2_intc_of_init(np, parent, &l2_edge_intc_init); } -static int __init brcmstb_l2_lvl_intc_of_init(struct device_node *np, - struct device_node *parent) +static int brcmstb_l2_lvl_intc_of_init(struct device_node *np, struct device_node *parent) { return brcmstb_l2_intc_of_init(np, parent, &l2_lvl_intc_init); } -- 2.49.1 ^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 05/11] irqchip/irq-brcmstb-l2: Fix section mismatch 2025-10-13 9:46 ` [PATCH 05/11] irqchip/irq-brcmstb-l2: " Johan Hovold @ 2025-10-13 15:57 ` Florian Fainelli 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 1 sibling, 0 replies; 40+ messages in thread From: Florian Fainelli @ 2025-10-13 15:57 UTC (permalink / raw) To: Johan Hovold, Thomas Gleixner Cc: Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel, Florian Fainelli On 10/13/25 02:46, Johan Hovold wrote: > Platform drivers can be probed after their init sections have been > discarded so the irqchip init callbacks must not live in init. > > Fixes: 51d9db5c8fbb ("irqchip/irq-brcmstb-l2: Switch to IRQCHIP_PLATFORM_DRIVER") > Cc: Florian Fainelli <f.fainelli@gmail.com> > Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> -- Florian ^ permalink raw reply [flat|nested] 40+ messages in thread
* [tip: irq/drivers] irqchip/irq-brcmstb-l2: Fix section mismatch 2025-10-13 9:46 ` [PATCH 05/11] irqchip/irq-brcmstb-l2: " Johan Hovold 2025-10-13 15:57 ` Florian Fainelli @ 2025-10-16 9:51 ` tip-bot2 for Johan Hovold 1 sibling, 0 replies; 40+ messages in thread From: tip-bot2 for Johan Hovold @ 2025-10-16 9:51 UTC (permalink / raw) To: linux-tip-commits Cc: Johan Hovold, Thomas Gleixner, Florian Fainelli, x86, linux-kernel The following commit has been merged into the irq/drivers branch of tip: Commit-ID: bbe1775924478e95372c2f896064ab6446000713 Gitweb: https://git.kernel.org/tip/bbe1775924478e95372c2f896064ab6446000713 Author: Johan Hovold <johan@kernel.org> AuthorDate: Mon, 13 Oct 2025 11:46:05 +02:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Thu, 16 Oct 2025 11:30:37 +02:00 irqchip/irq-brcmstb-l2: Fix section mismatch Platform drivers can be probed after their init sections have been discarded so the irqchip init callbacks must not live in init. Fixes: 51d9db5c8fbb ("irqchip/irq-brcmstb-l2: Switch to IRQCHIP_PLATFORM_DRIVER") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> --- drivers/irqchip/irq-brcmstb-l2.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/irqchip/irq-brcmstb-l2.c b/drivers/irqchip/irq-brcmstb-l2.c index 1bec5b2..53e67c6 100644 --- a/drivers/irqchip/irq-brcmstb-l2.c +++ b/drivers/irqchip/irq-brcmstb-l2.c @@ -138,10 +138,8 @@ static void brcmstb_l2_intc_resume(struct irq_data *d) irq_reg_writel(gc, ~b->saved_mask, ct->regs.enable); } -static int __init brcmstb_l2_intc_of_init(struct device_node *np, - struct device_node *parent, - const struct brcmstb_intc_init_params - *init_params) +static int brcmstb_l2_intc_of_init(struct device_node *np, struct device_node *parent, + const struct brcmstb_intc_init_params *init_params) { unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; unsigned int set = 0; @@ -257,14 +255,12 @@ out_free: return ret; } -static int __init brcmstb_l2_edge_intc_of_init(struct device_node *np, - struct device_node *parent) +static int brcmstb_l2_edge_intc_of_init(struct device_node *np, struct device_node *parent) { return brcmstb_l2_intc_of_init(np, parent, &l2_edge_intc_init); } -static int __init brcmstb_l2_lvl_intc_of_init(struct device_node *np, - struct device_node *parent) +static int brcmstb_l2_lvl_intc_of_init(struct device_node *np, struct device_node *parent) { return brcmstb_l2_intc_of_init(np, parent, &l2_lvl_intc_init); } ^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 06/11] irqchip/imx-mu-msi: Fix section mismatch 2025-10-13 9:46 [PATCH 00/11] irqchip: Pass platform device to platform drivers Johan Hovold ` (4 preceding siblings ...) 2025-10-13 9:46 ` [PATCH 05/11] irqchip/irq-brcmstb-l2: " Johan Hovold @ 2025-10-13 9:46 ` Johan Hovold 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 07/11] irqchip/renesas-rzg2l: " Johan Hovold ` (4 subsequent siblings) 10 siblings, 1 reply; 40+ messages in thread From: Johan Hovold @ 2025-10-13 9:46 UTC (permalink / raw) To: Thomas Gleixner Cc: Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel, Johan Hovold, Frank Li Platform drivers can be probed after their init sections have been discarded so the irqchip init callbacks must not live in init. Fixes: 70afdab904d2 ("irqchip: Add IMX MU MSI controller driver") Cc: Frank Li <Frank.Li@nxp.com> Signed-off-by: Johan Hovold <johan@kernel.org> --- drivers/irqchip/irq-imx-mu-msi.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/irqchip/irq-imx-mu-msi.c b/drivers/irqchip/irq-imx-mu-msi.c index d2a4e8a61a42..d247f77e5477 100644 --- a/drivers/irqchip/irq-imx-mu-msi.c +++ b/drivers/irqchip/irq-imx-mu-msi.c @@ -296,9 +296,9 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = { }, }; -static int __init imx_mu_of_init(struct device_node *dn, - struct device_node *parent, - const struct imx_mu_dcfg *cfg) +static int imx_mu_of_init(struct device_node *dn, + struct device_node *parent, + const struct imx_mu_dcfg *cfg) { struct platform_device *pdev = of_find_device_by_node(dn); struct device_link *pd_link_a; @@ -416,20 +416,17 @@ static const struct dev_pm_ops imx_mu_pm_ops = { imx_mu_runtime_resume, NULL) }; -static int __init imx_mu_imx7ulp_of_init(struct device_node *dn, - struct device_node *parent) +static int imx_mu_imx7ulp_of_init(struct device_node *dn, struct device_node *parent) { return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx7ulp); } -static int __init imx_mu_imx6sx_of_init(struct device_node *dn, - struct device_node *parent) +static int imx_mu_imx6sx_of_init(struct device_node *dn, struct device_node *parent) { return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx6sx); } -static int __init imx_mu_imx8ulp_of_init(struct device_node *dn, - struct device_node *parent) +static int imx_mu_imx8ulp_of_init(struct device_node *dn, struct device_node *parent) { return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx8ulp); } -- 2.49.1 ^ permalink raw reply related [flat|nested] 40+ messages in thread
* [tip: irq/drivers] irqchip/imx-mu-msi: Fix section mismatch 2025-10-13 9:46 ` [PATCH 06/11] irqchip/imx-mu-msi: " Johan Hovold @ 2025-10-16 9:51 ` tip-bot2 for Johan Hovold 0 siblings, 0 replies; 40+ messages in thread From: tip-bot2 for Johan Hovold @ 2025-10-16 9:51 UTC (permalink / raw) To: linux-tip-commits; +Cc: Johan Hovold, Thomas Gleixner, x86, linux-kernel The following commit has been merged into the irq/drivers branch of tip: Commit-ID: 64acfd8e680ff8992c101fe19aadb112ce551072 Gitweb: https://git.kernel.org/tip/64acfd8e680ff8992c101fe19aadb112ce551072 Author: Johan Hovold <johan@kernel.org> AuthorDate: Mon, 13 Oct 2025 11:46:06 +02:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Thu, 16 Oct 2025 11:30:38 +02:00 irqchip/imx-mu-msi: Fix section mismatch Platform drivers can be probed after their init sections have been discarded so the irqchip init callbacks must not live in init. Fixes: 70afdab904d2 ("irqchip: Add IMX MU MSI controller driver") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- drivers/irqchip/irq-imx-mu-msi.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/irqchip/irq-imx-mu-msi.c b/drivers/irqchip/irq-imx-mu-msi.c index d2a4e8a..41df168 100644 --- a/drivers/irqchip/irq-imx-mu-msi.c +++ b/drivers/irqchip/irq-imx-mu-msi.c @@ -296,9 +296,8 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = { }, }; -static int __init imx_mu_of_init(struct device_node *dn, - struct device_node *parent, - const struct imx_mu_dcfg *cfg) +static int imx_mu_of_init(struct device_node *dn, struct device_node *parent, + const struct imx_mu_dcfg *cfg) { struct platform_device *pdev = of_find_device_by_node(dn); struct device_link *pd_link_a; @@ -416,20 +415,17 @@ static const struct dev_pm_ops imx_mu_pm_ops = { imx_mu_runtime_resume, NULL) }; -static int __init imx_mu_imx7ulp_of_init(struct device_node *dn, - struct device_node *parent) +static int imx_mu_imx7ulp_of_init(struct device_node *dn, struct device_node *parent) { return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx7ulp); } -static int __init imx_mu_imx6sx_of_init(struct device_node *dn, - struct device_node *parent) +static int imx_mu_imx6sx_of_init(struct device_node *dn, struct device_node *parent) { return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx6sx); } -static int __init imx_mu_imx8ulp_of_init(struct device_node *dn, - struct device_node *parent) +static int imx_mu_imx8ulp_of_init(struct device_node *dn, struct device_node *parent) { return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx8ulp); } ^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 07/11] irqchip/renesas-rzg2l: Fix section mismatch 2025-10-13 9:46 [PATCH 00/11] irqchip: Pass platform device to platform drivers Johan Hovold ` (5 preceding siblings ...) 2025-10-13 9:46 ` [PATCH 06/11] irqchip/imx-mu-msi: " Johan Hovold @ 2025-10-13 9:46 ` Johan Hovold 2025-10-13 13:19 ` Geert Uytterhoeven 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 08/11] irqchip/starfive-jh8100: " Johan Hovold ` (3 subsequent siblings) 10 siblings, 2 replies; 40+ messages in thread From: Johan Hovold @ 2025-10-13 9:46 UTC (permalink / raw) To: Thomas Gleixner Cc: Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel, Johan Hovold, Lad Prabhakar Platform drivers can be probed after their init sections have been discarded so the irqchip init callbacks must not live in init. Fixes: 3fed09559cd8 ("irqchip: Add RZ/G2L IA55 Interrupt Controller driver")' Cc: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Signed-off-by: Johan Hovold <johan@kernel.org> --- drivers/irqchip/irq-renesas-rzg2l.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c index 2a54adeb4cc7..12b6eb150301 100644 --- a/drivers/irqchip/irq-renesas-rzg2l.c +++ b/drivers/irqchip/irq-renesas-rzg2l.c @@ -597,14 +597,12 @@ static int rzg2l_irqc_common_init(struct device_node *node, struct device_node * return 0; } -static int __init rzg2l_irqc_init(struct device_node *node, - struct device_node *parent) +static int rzg2l_irqc_init(struct device_node *node, struct device_node *parent) { return rzg2l_irqc_common_init(node, parent, &rzg2l_irqc_chip); } -static int __init rzfive_irqc_init(struct device_node *node, - struct device_node *parent) +static int rzfive_irqc_init(struct device_node *node, struct device_node *parent) { return rzg2l_irqc_common_init(node, parent, &rzfive_irqc_chip); } -- 2.49.1 ^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 07/11] irqchip/renesas-rzg2l: Fix section mismatch 2025-10-13 9:46 ` [PATCH 07/11] irqchip/renesas-rzg2l: " Johan Hovold @ 2025-10-13 13:19 ` Geert Uytterhoeven 2025-10-13 13:27 ` Johan Hovold 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 1 sibling, 1 reply; 40+ messages in thread From: Geert Uytterhoeven @ 2025-10-13 13:19 UTC (permalink / raw) To: Johan Hovold Cc: Thomas Gleixner, Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Magnus Damm, linux-kernel, Lad Prabhakar Hi Johan, On Mon, 13 Oct 2025 at 11:48, Johan Hovold <johan@kernel.org> wrote: > Platform drivers can be probed after their init sections have been > discarded so the irqchip init callbacks must not live in init. Thanks for your patch! > > Fixes: 3fed09559cd8 ("irqchip: Add RZ/G2L IA55 Interrupt Controller driver")' Unmatched trailing quote? This tag points to the wrong commit, the correct one is: Fixes: d011c022efe27579 ("irqchip/renesas-rzg2l: Add support for RZ/Five SoC") > Cc: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> > Signed-off-by: Johan Hovold <johan@kernel.org> For the actual change: Reviewed-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 ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 07/11] irqchip/renesas-rzg2l: Fix section mismatch 2025-10-13 13:19 ` Geert Uytterhoeven @ 2025-10-13 13:27 ` Johan Hovold 0 siblings, 0 replies; 40+ messages in thread From: Johan Hovold @ 2025-10-13 13:27 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Thomas Gleixner, Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Magnus Damm, linux-kernel, Lad Prabhakar Hi Geert, On Mon, Oct 13, 2025 at 03:19:46PM +0200, Geert Uytterhoeven wrote: > > Fixes: 3fed09559cd8 ("irqchip: Add RZ/G2L IA55 Interrupt Controller driver")' > > Unmatched trailing quote? > This tag points to the wrong commit, the correct one is: > > Fixes: d011c022efe27579 ("irqchip/renesas-rzg2l: Add support for > RZ/Five SoC") Indeed, thanks for catching that. > > Cc: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> > > Signed-off-by: Johan Hovold <johan@kernel.org> > > For the actual change: > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Johan ^ permalink raw reply [flat|nested] 40+ messages in thread
* [tip: irq/drivers] irqchip/renesas-rzg2l: Fix section mismatch 2025-10-13 9:46 ` [PATCH 07/11] irqchip/renesas-rzg2l: " Johan Hovold 2025-10-13 13:19 ` Geert Uytterhoeven @ 2025-10-16 9:51 ` tip-bot2 for Johan Hovold 1 sibling, 0 replies; 40+ messages in thread From: tip-bot2 for Johan Hovold @ 2025-10-16 9:51 UTC (permalink / raw) To: linux-tip-commits Cc: Johan Hovold, Thomas Gleixner, Geert Uytterhoeven, x86, linux-kernel The following commit has been merged into the irq/drivers branch of tip: Commit-ID: 5b338fbb2b5b21d61a9eaba14dcf43108de30258 Gitweb: https://git.kernel.org/tip/5b338fbb2b5b21d61a9eaba14dcf43108de30258 Author: Johan Hovold <johan@kernel.org> AuthorDate: Mon, 13 Oct 2025 11:46:07 +02:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Thu, 16 Oct 2025 11:30:38 +02:00 irqchip/renesas-rzg2l: Fix section mismatch Platform drivers can be probed after their init sections have been discarded so the irqchip init callbacks must not live in init. Fixes: d011c022efe27579 ("irqchip/renesas-rzg2l: Add support for RZ/Five SoC") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> --- drivers/irqchip/irq-renesas-rzg2l.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c index 2a54ade..12b6eb1 100644 --- a/drivers/irqchip/irq-renesas-rzg2l.c +++ b/drivers/irqchip/irq-renesas-rzg2l.c @@ -597,14 +597,12 @@ static int rzg2l_irqc_common_init(struct device_node *node, struct device_node * return 0; } -static int __init rzg2l_irqc_init(struct device_node *node, - struct device_node *parent) +static int rzg2l_irqc_init(struct device_node *node, struct device_node *parent) { return rzg2l_irqc_common_init(node, parent, &rzg2l_irqc_chip); } -static int __init rzfive_irqc_init(struct device_node *node, - struct device_node *parent) +static int rzfive_irqc_init(struct device_node *node, struct device_node *parent) { return rzg2l_irqc_common_init(node, parent, &rzfive_irqc_chip); } ^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 08/11] irqchip/starfive-jh8100: Fix section mismatch 2025-10-13 9:46 [PATCH 00/11] irqchip: Pass platform device to platform drivers Johan Hovold ` (6 preceding siblings ...) 2025-10-13 9:46 ` [PATCH 07/11] irqchip/renesas-rzg2l: " Johan Hovold @ 2025-10-13 9:46 ` Johan Hovold 2025-10-14 1:05 ` 回复: " Changhuang Liang 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 09/11] irqchip/qcom-irq-combiner: " Johan Hovold ` (2 subsequent siblings) 10 siblings, 2 replies; 40+ messages in thread From: Johan Hovold @ 2025-10-13 9:46 UTC (permalink / raw) To: Thomas Gleixner Cc: Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel, Johan Hovold Platform drivers can be probed after their init sections have been discarded so the irqchip init callback must not live in init. Fixes: e4e535036173 ("irqchip: Add StarFive external interrupt controller") Cc: Changhuang Liang <changhuang.liang@starfivetech.com> Signed-off-by: Johan Hovold <johan@kernel.org> --- drivers/irqchip/irq-starfive-jh8100-intc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-starfive-jh8100-intc.c b/drivers/irqchip/irq-starfive-jh8100-intc.c index 2460798ec158..117f2c651ebd 100644 --- a/drivers/irqchip/irq-starfive-jh8100-intc.c +++ b/drivers/irqchip/irq-starfive-jh8100-intc.c @@ -114,8 +114,7 @@ static void starfive_intc_irq_handler(struct irq_desc *desc) chained_irq_exit(chip, desc); } -static int __init starfive_intc_init(struct device_node *intc, - struct device_node *parent) +static int starfive_intc_init(struct device_node *intc, struct device_node *parent) { struct starfive_irq_chip *irqc; struct reset_control *rst; -- 2.49.1 ^ permalink raw reply related [flat|nested] 40+ messages in thread
* 回复: [PATCH 08/11] irqchip/starfive-jh8100: Fix section mismatch 2025-10-13 9:46 ` [PATCH 08/11] irqchip/starfive-jh8100: " Johan Hovold @ 2025-10-14 1:05 ` Changhuang Liang 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 1 sibling, 0 replies; 40+ messages in thread From: Changhuang Liang @ 2025-10-14 1:05 UTC (permalink / raw) To: Johan Hovold, Thomas Gleixner Cc: Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Geert Uytterhoeven, Magnus Damm, linux-kernel@vger.kernel.org Hi, Johan Thanks for the patch. > Platform drivers can be probed after their init sections have been discarded so > the irqchip init callback must not live in init. > > Fixes: e4e535036173 ("irqchip: Add StarFive external interrupt controller") > Cc: Changhuang Liang <changhuang.liang@starfivetech.com> > Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Changhuang Liang <changhuang.liang@starfivetech.com> > --- > drivers/irqchip/irq-starfive-jh8100-intc.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/irqchip/irq-starfive-jh8100-intc.c > b/drivers/irqchip/irq-starfive-jh8100-intc.c > index 2460798ec158..117f2c651ebd 100644 > --- a/drivers/irqchip/irq-starfive-jh8100-intc.c > +++ b/drivers/irqchip/irq-starfive-jh8100-intc.c > @@ -114,8 +114,7 @@ static void starfive_intc_irq_handler(struct irq_desc > *desc) > chained_irq_exit(chip, desc); > } > > -static int __init starfive_intc_init(struct device_node *intc, > - struct device_node *parent) > +static int starfive_intc_init(struct device_node *intc, struct > +device_node *parent) > { > struct starfive_irq_chip *irqc; > struct reset_control *rst; > -- > 2.49.1 ^ permalink raw reply [flat|nested] 40+ messages in thread
* [tip: irq/drivers] irqchip/starfive-jh8100: Fix section mismatch 2025-10-13 9:46 ` [PATCH 08/11] irqchip/starfive-jh8100: " Johan Hovold 2025-10-14 1:05 ` 回复: " Changhuang Liang @ 2025-10-16 9:51 ` tip-bot2 for Johan Hovold 1 sibling, 0 replies; 40+ messages in thread From: tip-bot2 for Johan Hovold @ 2025-10-16 9:51 UTC (permalink / raw) To: linux-tip-commits Cc: Johan Hovold, Thomas Gleixner, Changhuang Liang, x86, linux-kernel The following commit has been merged into the irq/drivers branch of tip: Commit-ID: f798bdb9aa81c425184f92e3d0b44d3b53d10da7 Gitweb: https://git.kernel.org/tip/f798bdb9aa81c425184f92e3d0b44d3b53d10da7 Author: Johan Hovold <johan@kernel.org> AuthorDate: Mon, 13 Oct 2025 11:46:08 +02:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Thu, 16 Oct 2025 11:30:38 +02:00 irqchip/starfive-jh8100: Fix section mismatch Platform drivers can be probed after their init sections have been discarded so the irqchip init callback must not live in init. Fixes: e4e535036173 ("irqchip: Add StarFive external interrupt controller") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Changhuang Liang <changhuang.liang@starfivetech.com> --- drivers/irqchip/irq-starfive-jh8100-intc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-starfive-jh8100-intc.c b/drivers/irqchip/irq-starfive-jh8100-intc.c index 2460798..117f2c6 100644 --- a/drivers/irqchip/irq-starfive-jh8100-intc.c +++ b/drivers/irqchip/irq-starfive-jh8100-intc.c @@ -114,8 +114,7 @@ static void starfive_intc_irq_handler(struct irq_desc *desc) chained_irq_exit(chip, desc); } -static int __init starfive_intc_init(struct device_node *intc, - struct device_node *parent) +static int starfive_intc_init(struct device_node *intc, struct device_node *parent) { struct starfive_irq_chip *irqc; struct reset_control *rst; ^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 09/11] irqchip/qcom-irq-combiner: Fix section mismatch 2025-10-13 9:46 [PATCH 00/11] irqchip: Pass platform device to platform drivers Johan Hovold ` (7 preceding siblings ...) 2025-10-13 9:46 ` [PATCH 08/11] irqchip/starfive-jh8100: " Johan Hovold @ 2025-10-13 9:46 ` Johan Hovold 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 10/11] irqchip: Drop leftover brackets Johan Hovold 2025-10-13 9:46 ` [PATCH 11/11] irqchip: Pass platform device to platform drivers Johan Hovold 10 siblings, 1 reply; 40+ messages in thread From: Johan Hovold @ 2025-10-13 9:46 UTC (permalink / raw) To: Thomas Gleixner Cc: Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel, Johan Hovold Platform drivers can be probed after their init sections have been discarded so the probe callback must not live in init. Fixes: f20cc9b00c7b ("irqchip/qcom: Add IRQ combiner driver") Signed-off-by: Johan Hovold <johan@kernel.org> --- drivers/irqchip/qcom-irq-combiner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/qcom-irq-combiner.c b/drivers/irqchip/qcom-irq-combiner.c index 18e696dc7f4d..9308088773be 100644 --- a/drivers/irqchip/qcom-irq-combiner.c +++ b/drivers/irqchip/qcom-irq-combiner.c @@ -222,7 +222,7 @@ static int get_registers(struct platform_device *pdev, struct combiner *comb) return 0; } -static int __init combiner_probe(struct platform_device *pdev) +static int combiner_probe(struct platform_device *pdev) { struct combiner *combiner; int nregs; -- 2.49.1 ^ permalink raw reply related [flat|nested] 40+ messages in thread
* [tip: irq/drivers] irqchip/qcom-irq-combiner: Fix section mismatch 2025-10-13 9:46 ` [PATCH 09/11] irqchip/qcom-irq-combiner: " Johan Hovold @ 2025-10-16 9:51 ` tip-bot2 for Johan Hovold 0 siblings, 0 replies; 40+ messages in thread From: tip-bot2 for Johan Hovold @ 2025-10-16 9:51 UTC (permalink / raw) To: linux-tip-commits; +Cc: Johan Hovold, Thomas Gleixner, x86, linux-kernel The following commit has been merged into the irq/drivers branch of tip: Commit-ID: 9b685058ca936752285c5520d351b828312ac965 Gitweb: https://git.kernel.org/tip/9b685058ca936752285c5520d351b828312ac965 Author: Johan Hovold <johan@kernel.org> AuthorDate: Mon, 13 Oct 2025 11:46:09 +02:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Thu, 16 Oct 2025 11:30:38 +02:00 irqchip/qcom-irq-combiner: Fix section mismatch Platform drivers can be probed after their init sections have been discarded so the probe callback must not live in init. Fixes: f20cc9b00c7b ("irqchip/qcom: Add IRQ combiner driver") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- drivers/irqchip/qcom-irq-combiner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/qcom-irq-combiner.c b/drivers/irqchip/qcom-irq-combiner.c index 18e696d..9308088 100644 --- a/drivers/irqchip/qcom-irq-combiner.c +++ b/drivers/irqchip/qcom-irq-combiner.c @@ -222,7 +222,7 @@ static int get_registers(struct platform_device *pdev, struct combiner *comb) return 0; } -static int __init combiner_probe(struct platform_device *pdev) +static int combiner_probe(struct platform_device *pdev) { struct combiner *combiner; int nregs; ^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 10/11] irqchip: Drop leftover brackets 2025-10-13 9:46 [PATCH 00/11] irqchip: Pass platform device to platform drivers Johan Hovold ` (8 preceding siblings ...) 2025-10-13 9:46 ` [PATCH 09/11] irqchip/qcom-irq-combiner: " Johan Hovold @ 2025-10-13 9:46 ` Johan Hovold 2025-10-13 13:20 ` Geert Uytterhoeven 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 11/11] irqchip: Pass platform device to platform drivers Johan Hovold 10 siblings, 2 replies; 40+ messages in thread From: Johan Hovold @ 2025-10-13 9:46 UTC (permalink / raw) To: Thomas Gleixner Cc: Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel, Johan Hovold Drop some unnecessary brackets in platform_irqchip_probe() mistakenly left by commit 9322d1915f9d ("irqchip: Plug a OF node reference leak in platform_irqchip_probe()"). Signed-off-by: Johan Hovold <johan@kernel.org> --- drivers/irqchip/irqchip.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c index 0ee7b6b71f5f..652d20d2b07f 100644 --- a/drivers/irqchip/irqchip.c +++ b/drivers/irqchip/irqchip.c @@ -38,9 +38,8 @@ int platform_irqchip_probe(struct platform_device *pdev) struct device_node *par_np __free(device_node) = of_irq_find_parent(np); of_irq_init_cb_t irq_init_cb = of_device_get_match_data(&pdev->dev); - if (!irq_init_cb) { + if (!irq_init_cb) return -EINVAL; - } if (par_np == np) par_np = NULL; @@ -53,9 +52,8 @@ int platform_irqchip_probe(struct platform_device *pdev) * interrupt controller. The actual initialization callback of this * interrupt controller can check for specific domains as necessary. */ - if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY)) { + if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY)) return -EPROBE_DEFER; - } return irq_init_cb(np, par_np); } -- 2.49.1 ^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 10/11] irqchip: Drop leftover brackets 2025-10-13 9:46 ` [PATCH 10/11] irqchip: Drop leftover brackets Johan Hovold @ 2025-10-13 13:20 ` Geert Uytterhoeven 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 1 sibling, 0 replies; 40+ messages in thread From: Geert Uytterhoeven @ 2025-10-13 13:20 UTC (permalink / raw) To: Johan Hovold Cc: Thomas Gleixner, Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Magnus Damm, linux-kernel On Mon, 13 Oct 2025 at 11:48, Johan Hovold <johan@kernel.org> wrote: > Drop some unnecessary brackets in platform_irqchip_probe() mistakenly > left by commit 9322d1915f9d ("irqchip: Plug a OF node reference leak in > platform_irqchip_probe()"). > > Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-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 ^ permalink raw reply [flat|nested] 40+ messages in thread
* [tip: irq/drivers] irqchip: Drop leftover brackets 2025-10-13 9:46 ` [PATCH 10/11] irqchip: Drop leftover brackets Johan Hovold 2025-10-13 13:20 ` Geert Uytterhoeven @ 2025-10-16 9:51 ` tip-bot2 for Johan Hovold 1 sibling, 0 replies; 40+ messages in thread From: tip-bot2 for Johan Hovold @ 2025-10-16 9:51 UTC (permalink / raw) To: linux-tip-commits Cc: Johan Hovold, Thomas Gleixner, Geert Uytterhoeven, x86, linux-kernel The following commit has been merged into the irq/drivers branch of tip: Commit-ID: 3540d99c03a88d4ebf65026f1f1926d3af658fb1 Gitweb: https://git.kernel.org/tip/3540d99c03a88d4ebf65026f1f1926d3af658fb1 Author: Johan Hovold <johan@kernel.org> AuthorDate: Mon, 13 Oct 2025 11:46:10 +02:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Thu, 16 Oct 2025 11:30:38 +02:00 irqchip: Drop leftover brackets Drop some unnecessary brackets in platform_irqchip_probe() mistakenly left by commit 9322d1915f9d ("irqchip: Plug a OF node reference leak in platform_irqchip_probe()"). Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> --- drivers/irqchip/irqchip.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c index 0ee7b6b..652d20d 100644 --- a/drivers/irqchip/irqchip.c +++ b/drivers/irqchip/irqchip.c @@ -38,9 +38,8 @@ int platform_irqchip_probe(struct platform_device *pdev) struct device_node *par_np __free(device_node) = of_irq_find_parent(np); of_irq_init_cb_t irq_init_cb = of_device_get_match_data(&pdev->dev); - if (!irq_init_cb) { + if (!irq_init_cb) return -EINVAL; - } if (par_np == np) par_np = NULL; @@ -53,9 +52,8 @@ int platform_irqchip_probe(struct platform_device *pdev) * interrupt controller. The actual initialization callback of this * interrupt controller can check for specific domains as necessary. */ - if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY)) { + if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY)) return -EPROBE_DEFER; - } return irq_init_cb(np, par_np); } ^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 11/11] irqchip: Pass platform device to platform drivers 2025-10-13 9:46 [PATCH 00/11] irqchip: Pass platform device to platform drivers Johan Hovold ` (9 preceding siblings ...) 2025-10-13 9:46 ` [PATCH 10/11] irqchip: Drop leftover brackets Johan Hovold @ 2025-10-13 9:46 ` Johan Hovold 2025-10-13 17:24 ` Florian Fainelli ` (5 more replies) 10 siblings, 6 replies; 40+ messages in thread From: Johan Hovold @ 2025-10-13 9:46 UTC (permalink / raw) To: Thomas Gleixner Cc: Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel, Johan Hovold The IRQCHIP_PLATFORM_DRIVER macros can be used to convert OF irqchip drivers to platform drivers but currently reuse the OF init callback prototype that only takes OF nodes as arguments. This forces drivers to do reverse lookups of their struct devices during probe if they need them for things like dev_printk() and device managed resources. Half of the drivers doing reverse lookups also currently fail to release the additional reference taken during the lookup, while other drivers have had the reference leak plugged in various ways (e.g. using non-intuitive cleanup constructs which still confuse static checkers). Switch to using a probe callback that takes a platform device as its first argument to simplify drivers and plug the remaining (mostly benign) reference leaks. Fixes: 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interrupt controller") Fixes: 70afdab904d2 ("irqchip: Add IMX MU MSI controller driver") Fixes: a6199bb514d8 ("irqchip: Add Qualcomm MPM controller driver") Signed-off-by: Johan Hovold <johan@kernel.org> --- drivers/irqchip/irq-bcm2712-mip.c | 10 ++----- drivers/irqchip/irq-bcm7038-l1.c | 5 ++-- drivers/irqchip/irq-bcm7120-l2.c | 20 ++++--------- drivers/irqchip/irq-brcmstb-l2.c | 21 ++++++------- drivers/irqchip/irq-imx-mu-msi.c | 25 +++++++--------- drivers/irqchip/irq-mchp-eic.c | 5 ++-- drivers/irqchip/irq-meson-gpio.c | 5 ++-- drivers/irqchip/irq-qcom-mpm.c | 6 ++-- drivers/irqchip/irq-renesas-rzg2l.c | 35 +++++++--------------- drivers/irqchip/irq-renesas-rzv2h.c | 32 ++++++-------------- drivers/irqchip/irq-starfive-jh8100-intc.c | 5 ++-- drivers/irqchip/irqchip.c | 6 ++-- drivers/irqchip/qcom-pdc.c | 5 ++-- include/linux/irqchip.h | 8 ++++- 14 files changed, 78 insertions(+), 110 deletions(-) diff --git a/drivers/irqchip/irq-bcm2712-mip.c b/drivers/irqchip/irq-bcm2712-mip.c index 8466646e5a2d..4761974ad650 100644 --- a/drivers/irqchip/irq-bcm2712-mip.c +++ b/drivers/irqchip/irq-bcm2712-mip.c @@ -232,16 +232,12 @@ static int mip_parse_dt(struct mip_priv *mip, struct device_node *np) return ret; } -static int mip_of_msi_init(struct device_node *node, struct device_node *parent) +static int mip_msi_probe(struct platform_device *pdev, struct device_node *parent) { - struct platform_device *pdev; + struct device_node *node = pdev->dev.of_node; struct mip_priv *mip; int ret; - pdev = of_find_device_by_node(node); - if (!pdev) - return -EPROBE_DEFER; - mip = kzalloc(sizeof(*mip), GFP_KERNEL); if (!mip) return -ENOMEM; @@ -284,7 +280,7 @@ static int mip_of_msi_init(struct device_node *node, struct device_node *parent) } IRQCHIP_PLATFORM_DRIVER_BEGIN(mip_msi) -IRQCHIP_MATCH("brcm,bcm2712-mip", mip_of_msi_init) +IRQCHIP_MATCH("brcm,bcm2712-mip", mip_msi_probe) IRQCHIP_PLATFORM_DRIVER_END(mip_msi) MODULE_DESCRIPTION("Broadcom BCM2712 MSI-X interrupt controller"); MODULE_AUTHOR("Phil Elwell <phil@raspberrypi.com>"); diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c index e28be83872cb..f9f725499dc3 100644 --- a/drivers/irqchip/irq-bcm7038-l1.c +++ b/drivers/irqchip/irq-bcm7038-l1.c @@ -395,8 +395,9 @@ static const struct irq_domain_ops bcm7038_l1_domain_ops = { .map = bcm7038_l1_map, }; -static int bcm7038_l1_of_init(struct device_node *dn, struct device_node *parent) +static int bcm7038_l1_probe(struct platform_device *pdev, struct device_node *parent) { + struct device_node *dn = pdev->dev.of_node; struct bcm7038_l1_chip *intc; int idx, ret; @@ -454,7 +455,7 @@ static int bcm7038_l1_of_init(struct device_node *dn, struct device_node *parent } IRQCHIP_PLATFORM_DRIVER_BEGIN(bcm7038_l1) -IRQCHIP_MATCH("brcm,bcm7038-l1-intc", bcm7038_l1_of_init) +IRQCHIP_MATCH("brcm,bcm7038-l1-intc", bcm7038_l1_probe) IRQCHIP_PLATFORM_DRIVER_END(bcm7038_l1) MODULE_DESCRIPTION("Broadcom STB 7038-style L1/L2 interrupt controller"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c index 63ff68d33787..5e87999de811 100644 --- a/drivers/irqchip/irq-bcm7120-l2.c +++ b/drivers/irqchip/irq-bcm7120-l2.c @@ -206,15 +206,15 @@ static int bcm7120_l2_intc_iomap_3380(struct device_node *dn, struct bcm7120_l2_ return 0; } -static int bcm7120_l2_intc_probe(struct device_node *dn, +static int bcm7120_l2_intc_probe(struct platform_device *pdev, struct device_node *parent, int (*iomap_regs_fn)(struct device_node *, struct bcm7120_l2_intc_data *), const char *intc_name) { unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; + struct device_node *dn = pdev->dev.of_node; struct bcm7120_l2_intc_data *data; - struct platform_device *pdev; struct irq_chip_generic *gc; struct irq_chip_type *ct; int ret = 0; @@ -225,14 +225,7 @@ static int bcm7120_l2_intc_probe(struct device_node *dn, if (!data) return -ENOMEM; - pdev = of_find_device_by_node(dn); - if (!pdev) { - ret = -ENODEV; - goto out_free_data; - } - data->num_parent_irqs = platform_irq_count(pdev); - put_device(&pdev->dev); if (data->num_parent_irqs <= 0) { pr_err("invalid number of parent interrupts\n"); ret = -ENOMEM; @@ -332,20 +325,19 @@ static int bcm7120_l2_intc_probe(struct device_node *dn, if (data->map_base[idx]) iounmap(data->map_base[idx]); } -out_free_data: kfree(data); return ret; } -static int bcm7120_l2_intc_probe_7120(struct device_node *dn, struct device_node *parent) +static int bcm7120_l2_intc_probe_7120(struct platform_device *pdev, struct device_node *parent) { - return bcm7120_l2_intc_probe(dn, parent, bcm7120_l2_intc_iomap_7120, + return bcm7120_l2_intc_probe(pdev, parent, bcm7120_l2_intc_iomap_7120, "BCM7120 L2"); } -static int bcm7120_l2_intc_probe_3380(struct device_node *dn, struct device_node *parent) +static int bcm7120_l2_intc_probe_3380(struct platform_device *pdev, struct device_node *parent) { - return bcm7120_l2_intc_probe(dn, parent, bcm7120_l2_intc_iomap_3380, + return bcm7120_l2_intc_probe(pdev, parent, bcm7120_l2_intc_iomap_3380, "BCM3380 L2"); } diff --git a/drivers/irqchip/irq-brcmstb-l2.c b/drivers/irqchip/irq-brcmstb-l2.c index 53e67c6c01f7..bb7078d6524f 100644 --- a/drivers/irqchip/irq-brcmstb-l2.c +++ b/drivers/irqchip/irq-brcmstb-l2.c @@ -138,11 +138,12 @@ static void brcmstb_l2_intc_resume(struct irq_data *d) irq_reg_writel(gc, ~b->saved_mask, ct->regs.enable); } -static int brcmstb_l2_intc_of_init(struct device_node *np, struct device_node *parent, - const struct brcmstb_intc_init_params *init_params) +static int brcmstb_l2_intc_probe(struct platform_device *pdev, struct device_node *parent, + const struct brcmstb_intc_init_params *init_params) { unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; unsigned int set = 0; + struct device_node *np = pdev->dev.of_node; struct brcmstb_l2_intc_data *data; struct irq_chip_type *ct; int ret; @@ -255,21 +256,21 @@ static int brcmstb_l2_intc_of_init(struct device_node *np, struct device_node *p return ret; } -static int brcmstb_l2_edge_intc_of_init(struct device_node *np, struct device_node *parent) +static int brcmstb_l2_edge_intc_probe(struct platform_device *pdev, struct device_node *parent) { - return brcmstb_l2_intc_of_init(np, parent, &l2_edge_intc_init); + return brcmstb_l2_intc_probe(pdev, parent, &l2_edge_intc_init); } -static int brcmstb_l2_lvl_intc_of_init(struct device_node *np, struct device_node *parent) +static int brcmstb_l2_lvl_intc_probe(struct platform_device *pdev, struct device_node *parent) { - return brcmstb_l2_intc_of_init(np, parent, &l2_lvl_intc_init); + return brcmstb_l2_intc_probe(pdev, parent, &l2_lvl_intc_init); } IRQCHIP_PLATFORM_DRIVER_BEGIN(brcmstb_l2) -IRQCHIP_MATCH("brcm,l2-intc", brcmstb_l2_edge_intc_of_init) -IRQCHIP_MATCH("brcm,hif-spi-l2-intc", brcmstb_l2_edge_intc_of_init) -IRQCHIP_MATCH("brcm,upg-aux-aon-l2-intc", brcmstb_l2_edge_intc_of_init) -IRQCHIP_MATCH("brcm,bcm7271-l2-intc", brcmstb_l2_lvl_intc_of_init) +IRQCHIP_MATCH("brcm,l2-intc", brcmstb_l2_edge_intc_probe) +IRQCHIP_MATCH("brcm,hif-spi-l2-intc", brcmstb_l2_edge_intc_probe) +IRQCHIP_MATCH("brcm,upg-aux-aon-l2-intc", brcmstb_l2_edge_intc_probe) +IRQCHIP_MATCH("brcm,bcm7271-l2-intc", brcmstb_l2_lvl_intc_probe) IRQCHIP_PLATFORM_DRIVER_END(brcmstb_l2) MODULE_DESCRIPTION("Broadcom STB generic L2 interrupt controller"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/irqchip/irq-imx-mu-msi.c b/drivers/irqchip/irq-imx-mu-msi.c index d247f77e5477..c598f2f52fc6 100644 --- a/drivers/irqchip/irq-imx-mu-msi.c +++ b/drivers/irqchip/irq-imx-mu-msi.c @@ -296,11 +296,9 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = { }, }; -static int imx_mu_of_init(struct device_node *dn, - struct device_node *parent, - const struct imx_mu_dcfg *cfg) +static int imx_mu_probe(struct platform_device *pdev, struct device_node *parent, + const struct imx_mu_dcfg *cfg) { - struct platform_device *pdev = of_find_device_by_node(dn); struct device_link *pd_link_a; struct device_link *pd_link_b; struct imx_mu_msi *msi_data; @@ -416,28 +414,27 @@ static const struct dev_pm_ops imx_mu_pm_ops = { imx_mu_runtime_resume, NULL) }; -static int imx_mu_imx7ulp_of_init(struct device_node *dn, struct device_node *parent) +static int imx_mu_imx7ulp_probe(struct platform_device *pdev, struct device_node *parent) { - return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx7ulp); + return imx_mu_probe(pdev, parent, &imx_mu_cfg_imx7ulp); } -static int imx_mu_imx6sx_of_init(struct device_node *dn, struct device_node *parent) +static int imx_mu_imx6sx_probe(struct platform_device *pdev, struct device_node *parent) { - return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx6sx); + return imx_mu_probe(pdev, parent, &imx_mu_cfg_imx6sx); } -static int imx_mu_imx8ulp_of_init(struct device_node *dn, struct device_node *parent) +static int imx_mu_imx8ulp_probe(struct platform_device *pdev, struct device_node *parent) { - return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx8ulp); + return imx_mu_probe(pdev, parent, &imx_mu_cfg_imx8ulp); } IRQCHIP_PLATFORM_DRIVER_BEGIN(imx_mu_msi) -IRQCHIP_MATCH("fsl,imx7ulp-mu-msi", imx_mu_imx7ulp_of_init) -IRQCHIP_MATCH("fsl,imx6sx-mu-msi", imx_mu_imx6sx_of_init) -IRQCHIP_MATCH("fsl,imx8ulp-mu-msi", imx_mu_imx8ulp_of_init) +IRQCHIP_MATCH("fsl,imx7ulp-mu-msi", imx_mu_imx7ulp_probe) +IRQCHIP_MATCH("fsl,imx6sx-mu-msi", imx_mu_imx6sx_probe) +IRQCHIP_MATCH("fsl,imx8ulp-mu-msi", imx_mu_imx8ulp_probe) IRQCHIP_PLATFORM_DRIVER_END(imx_mu_msi, .pm = &imx_mu_pm_ops) - MODULE_AUTHOR("Frank Li <Frank.Li@nxp.com>"); MODULE_DESCRIPTION("Freescale MU MSI controller driver"); MODULE_LICENSE("GPL"); diff --git a/drivers/irqchip/irq-mchp-eic.c b/drivers/irqchip/irq-mchp-eic.c index 516a3a0e359c..b513a899c085 100644 --- a/drivers/irqchip/irq-mchp-eic.c +++ b/drivers/irqchip/irq-mchp-eic.c @@ -199,8 +199,9 @@ static const struct irq_domain_ops mchp_eic_domain_ops = { .free = irq_domain_free_irqs_common, }; -static int mchp_eic_init(struct device_node *node, struct device_node *parent) +static int mchp_eic_probe(struct platform_device *pdev, struct device_node *parent) { + struct device_node *node = pdev->dev.of_node; struct irq_domain *parent_domain = NULL; int ret, i; @@ -273,7 +274,7 @@ static int mchp_eic_init(struct device_node *node, struct device_node *parent) } IRQCHIP_PLATFORM_DRIVER_BEGIN(mchp_eic) -IRQCHIP_MATCH("microchip,sama7g5-eic", mchp_eic_init) +IRQCHIP_MATCH("microchip,sama7g5-eic", mchp_eic_probe) IRQCHIP_PLATFORM_DRIVER_END(mchp_eic) MODULE_DESCRIPTION("Microchip External Interrupt Controller"); diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c index 8e84724e8d28..6c5e2ff0d1cf 100644 --- a/drivers/irqchip/irq-meson-gpio.c +++ b/drivers/irqchip/irq-meson-gpio.c @@ -572,8 +572,9 @@ static int meson_gpio_irq_parse_dt(struct device_node *node, struct meson_gpio_i return 0; } -static int meson_gpio_irq_of_init(struct device_node *node, struct device_node *parent) +static int meson_gpio_irq_probe(struct platform_device *pdev, struct device_node *parent) { + struct device_node *node = pdev->dev.of_node; struct irq_domain *domain, *parent_domain; struct meson_gpio_irq_controller *ctl; int ret; @@ -630,7 +631,7 @@ static int meson_gpio_irq_of_init(struct device_node *node, struct device_node * } IRQCHIP_PLATFORM_DRIVER_BEGIN(meson_gpio_intc) -IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_of_init) +IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_probe) IRQCHIP_PLATFORM_DRIVER_END(meson_gpio_intc) MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>"); diff --git a/drivers/irqchip/irq-qcom-mpm.c b/drivers/irqchip/irq-qcom-mpm.c index 8d569f7c5a7a..83f31ea657b7 100644 --- a/drivers/irqchip/irq-qcom-mpm.c +++ b/drivers/irqchip/irq-qcom-mpm.c @@ -320,9 +320,9 @@ static bool gic_hwirq_is_mapped(struct mpm_gic_map *maps, int cnt, u32 hwirq) return false; } -static int qcom_mpm_init(struct device_node *np, struct device_node *parent) +static int qcom_mpm_probe(struct platform_device *pdev, struct device_node *parent) { - struct platform_device *pdev = of_find_device_by_node(np); + struct device_node *np = pdev->dev.of_node; struct device *dev = &pdev->dev; struct irq_domain *parent_domain; struct generic_pm_domain *genpd; @@ -478,7 +478,7 @@ static int qcom_mpm_init(struct device_node *np, struct device_node *parent) } IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_mpm) -IRQCHIP_MATCH("qcom,mpm", qcom_mpm_init) +IRQCHIP_MATCH("qcom,mpm", qcom_mpm_probe) IRQCHIP_PLATFORM_DRIVER_END(qcom_mpm) MODULE_DESCRIPTION("Qualcomm Technologies, Inc. MSM Power Manager"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c index 12b6eb150301..1bf19deb02c4 100644 --- a/drivers/irqchip/irq-renesas-rzg2l.c +++ b/drivers/irqchip/irq-renesas-rzg2l.c @@ -8,7 +8,6 @@ */ #include <linux/bitfield.h> -#include <linux/cleanup.h> #include <linux/clk.h> #include <linux/err.h> #include <linux/io.h> @@ -528,18 +527,15 @@ static int rzg2l_irqc_parse_interrupts(struct rzg2l_irqc_priv *priv, return 0; } -static int rzg2l_irqc_common_init(struct device_node *node, struct device_node *parent, - const struct irq_chip *irq_chip) +static int rzg2l_irqc_common_probe(struct platform_device *pdev, struct device_node *parent, + const struct irq_chip *irq_chip) { - struct platform_device *pdev = of_find_device_by_node(node); - struct device *dev __free(put_device) = pdev ? &pdev->dev : NULL; struct irq_domain *irq_domain, *parent_domain; + struct device_node *node = pdev->dev.of_node; + struct device *dev = &pdev->dev; struct reset_control *resetn; int ret; - if (!pdev) - return -ENODEV; - parent_domain = irq_find_host(parent); if (!parent_domain) return dev_err_probe(dev, -ENODEV, "cannot find parent domain\n"); @@ -583,33 +579,22 @@ static int rzg2l_irqc_common_init(struct device_node *node, struct device_node * register_syscore_ops(&rzg2l_irqc_syscore_ops); - /* - * Prevent the cleanup function from invoking put_device by assigning - * NULL to dev. - * - * make coccicheck will complain about missing put_device calls, but - * those are false positives, as dev will be automatically "put" via - * __free_put_device on the failing path. - * On the successful path we don't actually want to "put" dev. - */ - dev = NULL; - return 0; } -static int rzg2l_irqc_init(struct device_node *node, struct device_node *parent) +static int rzg2l_irqc_probe(struct platform_device *pdev, struct device_node *parent) { - return rzg2l_irqc_common_init(node, parent, &rzg2l_irqc_chip); + return rzg2l_irqc_common_probe(pdev, parent, &rzg2l_irqc_chip); } -static int rzfive_irqc_init(struct device_node *node, struct device_node *parent) +static int rzfive_irqc_probe(struct platform_device *pdev, struct device_node *parent) { - return rzg2l_irqc_common_init(node, parent, &rzfive_irqc_chip); + return rzg2l_irqc_common_probe(pdev, parent, &rzfive_irqc_chip); } IRQCHIP_PLATFORM_DRIVER_BEGIN(rzg2l_irqc) -IRQCHIP_MATCH("renesas,rzg2l-irqc", rzg2l_irqc_init) -IRQCHIP_MATCH("renesas,r9a07g043f-irqc", rzfive_irqc_init) +IRQCHIP_MATCH("renesas,rzg2l-irqc", rzg2l_irqc_probe) +IRQCHIP_MATCH("renesas,r9a07g043f-irqc", rzfive_irqc_probe) IRQCHIP_PLATFORM_DRIVER_END(rzg2l_irqc) MODULE_AUTHOR("Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>"); MODULE_DESCRIPTION("Renesas RZ/G2L IRQC Driver"); diff --git a/drivers/irqchip/irq-renesas-rzv2h.c b/drivers/irqchip/irq-renesas-rzv2h.c index 9018d9c3911e..899a423b5da8 100644 --- a/drivers/irqchip/irq-renesas-rzv2h.c +++ b/drivers/irqchip/irq-renesas-rzv2h.c @@ -490,29 +490,15 @@ static int rzv2h_icu_parse_interrupts(struct rzv2h_icu_priv *priv, struct device return 0; } -static void rzv2h_icu_put_device(void *data) -{ - put_device(data); -} - -static int rzv2h_icu_init_common(struct device_node *node, struct device_node *parent, - const struct rzv2h_hw_info *hw_info) +static int rzv2h_icu_probe_common(struct platform_device *pdev, struct device_node *parent, + const struct rzv2h_hw_info *hw_info) { struct irq_domain *irq_domain, *parent_domain; + struct device_node *node = pdev->dev.of_node; struct rzv2h_icu_priv *rzv2h_icu_data; - struct platform_device *pdev; struct reset_control *resetn; int ret; - pdev = of_find_device_by_node(node); - if (!pdev) - return -ENODEV; - - ret = devm_add_action_or_reset(&pdev->dev, rzv2h_icu_put_device, - &pdev->dev); - if (ret < 0) - return ret; - parent_domain = irq_find_host(parent); if (!parent_domain) { dev_err(&pdev->dev, "cannot find parent domain\n"); @@ -618,19 +604,19 @@ static const struct rzv2h_hw_info rzv2h_hw_params = { .field_width = 8, }; -static int rzg3e_icu_init(struct device_node *node, struct device_node *parent) +static int rzg3e_icu_probe(struct platform_device *pdev, struct device_node *parent) { - return rzv2h_icu_init_common(node, parent, &rzg3e_hw_params); + return rzv2h_icu_probe_common(pdev, parent, &rzg3e_hw_params); } -static int rzv2h_icu_init(struct device_node *node, struct device_node *parent) +static int rzv2h_icu_probe(struct platform_device *pdev, struct device_node *parent) { - return rzv2h_icu_init_common(node, parent, &rzv2h_hw_params); + return rzv2h_icu_probe_common(pdev, parent, &rzv2h_hw_params); } IRQCHIP_PLATFORM_DRIVER_BEGIN(rzv2h_icu) -IRQCHIP_MATCH("renesas,r9a09g047-icu", rzg3e_icu_init) -IRQCHIP_MATCH("renesas,r9a09g057-icu", rzv2h_icu_init) +IRQCHIP_MATCH("renesas,r9a09g047-icu", rzg3e_icu_probe) +IRQCHIP_MATCH("renesas,r9a09g057-icu", rzv2h_icu_probe) IRQCHIP_PLATFORM_DRIVER_END(rzv2h_icu) MODULE_AUTHOR("Fabrizio Castro <fabrizio.castro.jz@renesas.com>"); MODULE_DESCRIPTION("Renesas RZ/V2H(P) ICU Driver"); diff --git a/drivers/irqchip/irq-starfive-jh8100-intc.c b/drivers/irqchip/irq-starfive-jh8100-intc.c index 117f2c651ebd..705361b4ebe0 100644 --- a/drivers/irqchip/irq-starfive-jh8100-intc.c +++ b/drivers/irqchip/irq-starfive-jh8100-intc.c @@ -114,8 +114,9 @@ static void starfive_intc_irq_handler(struct irq_desc *desc) chained_irq_exit(chip, desc); } -static int starfive_intc_init(struct device_node *intc, struct device_node *parent) +static int starfive_intc_probe(struct platform_device *pdev, struct device_node *parent) { + struct device_node *intc = pdev->dev.of_node; struct starfive_irq_chip *irqc; struct reset_control *rst; struct clk *clk; @@ -198,7 +199,7 @@ static int starfive_intc_init(struct device_node *intc, struct device_node *pare } IRQCHIP_PLATFORM_DRIVER_BEGIN(starfive_intc) -IRQCHIP_MATCH("starfive,jh8100-intc", starfive_intc_init) +IRQCHIP_MATCH("starfive,jh8100-intc", starfive_intc_probe) IRQCHIP_PLATFORM_DRIVER_END(starfive_intc) MODULE_DESCRIPTION("StarFive JH8100 External Interrupt Controller"); diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c index 652d20d2b07f..689c8e448901 100644 --- a/drivers/irqchip/irqchip.c +++ b/drivers/irqchip/irqchip.c @@ -36,9 +36,9 @@ int platform_irqchip_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct device_node *par_np __free(device_node) = of_irq_find_parent(np); - of_irq_init_cb_t irq_init_cb = of_device_get_match_data(&pdev->dev); + platform_irq_probe_t irq_probe = of_device_get_match_data(&pdev->dev); - if (!irq_init_cb) + if (!irq_probe) return -EINVAL; if (par_np == np) @@ -55,6 +55,6 @@ int platform_irqchip_probe(struct platform_device *pdev) if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY)) return -EPROBE_DEFER; - return irq_init_cb(np, par_np); + return irq_probe(pdev, par_np); } EXPORT_SYMBOL_GPL(platform_irqchip_probe); diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c index b0cdcdb7c505..d94beb786a67 100644 --- a/drivers/irqchip/qcom-pdc.c +++ b/drivers/irqchip/qcom-pdc.c @@ -469,10 +469,11 @@ static const struct of_device_id pdc_aux_gpio_matches[] = { { } }; -static int qcom_pdc_init(struct device_node *node, struct device_node *parent) +static int qcom_pdc_probe(struct platform_device *pdev, struct device_node *parent) { unsigned int flags = IRQ_DOMAIN_FLAG_QCOM_PDC_WAKEUP; struct irq_domain *parent_domain, *pdc_domain; + struct device_node *node = pdev->dev.of_node; resource_size_t res_size; struct resource res; int ret; @@ -558,7 +559,7 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent) } IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc) -IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init) +IRQCHIP_MATCH("qcom,pdc", qcom_pdc_probe) IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc) MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller"); MODULE_LICENSE("GPL v2"); diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h index d5e6024cb2a8..bc4ddacd6ddc 100644 --- a/include/linux/irqchip.h +++ b/include/linux/irqchip.h @@ -17,12 +17,18 @@ #include <linux/of_irq.h> #include <linux/platform_device.h> +typedef int (*platform_irq_probe_t)(struct platform_device *, struct device_node *); + /* Undefined on purpose */ extern of_irq_init_cb_t typecheck_irq_init_cb; +extern platform_irq_probe_t typecheck_irq_probe; #define typecheck_irq_init_cb(fn) \ (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn) +#define typecheck_irq_probe(fn) \ + (__typecheck(typecheck_irq_probe, &fn) ? fn : fn) + /* * This macro must be used by the different irqchip drivers to declare * the association between their DT compatible string and their @@ -42,7 +48,7 @@ extern int platform_irqchip_probe(struct platform_device *pdev); static const struct of_device_id drv_name##_irqchip_match_table[] = { #define IRQCHIP_MATCH(compat, fn) { .compatible = compat, \ - .data = typecheck_irq_init_cb(fn), }, + .data = typecheck_irq_probe(fn), }, #define IRQCHIP_PLATFORM_DRIVER_END(drv_name, ...) \ -- 2.49.1 ^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 11/11] irqchip: Pass platform device to platform drivers 2025-10-13 9:46 ` [PATCH 11/11] irqchip: Pass platform device to platform drivers Johan Hovold @ 2025-10-13 17:24 ` Florian Fainelli 2025-10-14 1:11 ` 回复: " Changhuang Liang ` (4 subsequent siblings) 5 siblings, 0 replies; 40+ messages in thread From: Florian Fainelli @ 2025-10-13 17:24 UTC (permalink / raw) To: Johan Hovold, Thomas Gleixner Cc: Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel On 10/13/25 02:46, Johan Hovold wrote: > The IRQCHIP_PLATFORM_DRIVER macros can be used to convert OF irqchip > drivers to platform drivers but currently reuse the OF init callback > prototype that only takes OF nodes as arguments. This forces drivers to > do reverse lookups of their struct devices during probe if they need > them for things like dev_printk() and device managed resources. > > Half of the drivers doing reverse lookups also currently fail to release > the additional reference taken during the lookup, while other drivers > have had the reference leak plugged in various ways (e.g. using > non-intuitive cleanup constructs which still confuse static checkers). > > Switch to using a probe callback that takes a platform device as its > first argument to simplify drivers and plug the remaining (mostly > benign) reference leaks. > > Fixes: 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interrupt controller") > Fixes: 70afdab904d2 ("irqchip: Add IMX MU MSI controller driver") > Fixes: a6199bb514d8 ("irqchip: Add Qualcomm MPM controller driver") > Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> -- Florian ^ permalink raw reply [flat|nested] 40+ messages in thread
* 回复: [PATCH 11/11] irqchip: Pass platform device to platform drivers 2025-10-13 9:46 ` [PATCH 11/11] irqchip: Pass platform device to platform drivers Johan Hovold 2025-10-13 17:24 ` Florian Fainelli @ 2025-10-14 1:11 ` Changhuang Liang 2025-10-14 8:52 ` Stanimir Varbanov ` (3 subsequent siblings) 5 siblings, 0 replies; 40+ messages in thread From: Changhuang Liang @ 2025-10-14 1:11 UTC (permalink / raw) To: Johan Hovold, Thomas Gleixner Cc: Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Geert Uytterhoeven, Magnus Damm, linux-kernel@vger.kernel.org Hi, Johan Thanks for the patch. > The IRQCHIP_PLATFORM_DRIVER macros can be used to convert OF irqchip > drivers to platform drivers but currently reuse the OF init callback prototype > that only takes OF nodes as arguments. This forces drivers to do reverse > lookups of their struct devices during probe if they need them for things like > dev_printk() and device managed resources. > > Half of the drivers doing reverse lookups also currently fail to release the > additional reference taken during the lookup, while other drivers have had the > reference leak plugged in various ways (e.g. using non-intuitive cleanup > constructs which still confuse static checkers). > > Switch to using a probe callback that takes a platform device as its first > argument to simplify drivers and plug the remaining (mostly > benign) reference leaks. > > Fixes: 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interrupt > controller") > Fixes: 70afdab904d2 ("irqchip: Add IMX MU MSI controller driver") > Fixes: a6199bb514d8 ("irqchip: Add Qualcomm MPM controller driver") > Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Changhuang Liang <changhuang.liang@starfivetech.com> ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 11/11] irqchip: Pass platform device to platform drivers 2025-10-13 9:46 ` [PATCH 11/11] irqchip: Pass platform device to platform drivers Johan Hovold 2025-10-13 17:24 ` Florian Fainelli 2025-10-14 1:11 ` 回复: " Changhuang Liang @ 2025-10-14 8:52 ` Stanimir Varbanov 2025-10-14 9:04 ` Johan Hovold 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold ` (2 subsequent siblings) 5 siblings, 1 reply; 40+ messages in thread From: Stanimir Varbanov @ 2025-10-14 8:52 UTC (permalink / raw) To: Johan Hovold, Thomas Gleixner Cc: Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel Hi Johan, On 10/13/25 12:46 PM, Johan Hovold wrote: > The IRQCHIP_PLATFORM_DRIVER macros can be used to convert OF irqchip > drivers to platform drivers but currently reuse the OF init callback > prototype that only takes OF nodes as arguments. This forces drivers to > do reverse lookups of their struct devices during probe if they need > them for things like dev_printk() and device managed resources. > > Half of the drivers doing reverse lookups also currently fail to release > the additional reference taken during the lookup, while other drivers > have had the reference leak plugged in various ways (e.g. using > non-intuitive cleanup constructs which still confuse static checkers). > > Switch to using a probe callback that takes a platform device as its > first argument to simplify drivers and plug the remaining (mostly > benign) reference leaks. > > Fixes: 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interrupt controller") > Fixes: 70afdab904d2 ("irqchip: Add IMX MU MSI controller driver") > Fixes: a6199bb514d8 ("irqchip: Add Qualcomm MPM controller driver") > Signed-off-by: Johan Hovold <johan@kernel.org> > --- > drivers/irqchip/irq-bcm2712-mip.c | 10 ++----- > drivers/irqchip/irq-bcm7038-l1.c | 5 ++-- > drivers/irqchip/irq-bcm7120-l2.c | 20 ++++--------- > drivers/irqchip/irq-brcmstb-l2.c | 21 ++++++------- > drivers/irqchip/irq-imx-mu-msi.c | 25 +++++++--------- > drivers/irqchip/irq-mchp-eic.c | 5 ++-- > drivers/irqchip/irq-meson-gpio.c | 5 ++-- > drivers/irqchip/irq-qcom-mpm.c | 6 ++-- > drivers/irqchip/irq-renesas-rzg2l.c | 35 +++++++--------------- > drivers/irqchip/irq-renesas-rzv2h.c | 32 ++++++-------------- > drivers/irqchip/irq-starfive-jh8100-intc.c | 5 ++-- > drivers/irqchip/irqchip.c | 6 ++-- > drivers/irqchip/qcom-pdc.c | 5 ++-- > include/linux/irqchip.h | 8 ++++- > 14 files changed, 78 insertions(+), 110 deletions(-) > <snip> > > IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc) > -IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init) > +IRQCHIP_MATCH("qcom,pdc", qcom_pdc_probe) > IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc) > MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller"); > MODULE_LICENSE("GPL v2"); > diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h > index d5e6024cb2a8..bc4ddacd6ddc 100644 > --- a/include/linux/irqchip.h > +++ b/include/linux/irqchip.h > @@ -17,12 +17,18 @@ > #include <linux/of_irq.h> > #include <linux/platform_device.h> > > +typedef int (*platform_irq_probe_t)(struct platform_device *, struct device_node *); > + > /* Undefined on purpose */ > extern of_irq_init_cb_t typecheck_irq_init_cb; This is not used anymore? > +extern platform_irq_probe_t typecheck_irq_probe; > > #define typecheck_irq_init_cb(fn) \ > (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn) ditto ~Stan > > +#define typecheck_irq_probe(fn) \ > + (__typecheck(typecheck_irq_probe, &fn) ? fn : fn) > + > /* > * This macro must be used by the different irqchip drivers to declare > * the association between their DT compatible string and their > @@ -42,7 +48,7 @@ extern int platform_irqchip_probe(struct platform_device *pdev); > static const struct of_device_id drv_name##_irqchip_match_table[] = { > > #define IRQCHIP_MATCH(compat, fn) { .compatible = compat, \ > - .data = typecheck_irq_init_cb(fn), }, > + .data = typecheck_irq_probe(fn), }, > > > #define IRQCHIP_PLATFORM_DRIVER_END(drv_name, ...) \ ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 11/11] irqchip: Pass platform device to platform drivers 2025-10-14 8:52 ` Stanimir Varbanov @ 2025-10-14 9:04 ` Johan Hovold 0 siblings, 0 replies; 40+ messages in thread From: Johan Hovold @ 2025-10-14 9:04 UTC (permalink / raw) To: Stanimir Varbanov Cc: Thomas Gleixner, Florian Fainelli, Shawn Guo, Sascha Hauer, Fabio Estevam, Claudiu Beznea, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Changhuang Liang, Geert Uytterhoeven, Magnus Damm, linux-kernel Hi Stan, On Tue, Oct 14, 2025 at 11:52:40AM +0300, Stanimir Varbanov wrote: > On 10/13/25 12:46 PM, Johan Hovold wrote: > > +typedef int (*platform_irq_probe_t)(struct platform_device *, struct device_node *); > > + > > /* Undefined on purpose */ > > extern of_irq_init_cb_t typecheck_irq_init_cb; > > This is not used anymore? > > > +extern platform_irq_probe_t typecheck_irq_probe; > > > > #define typecheck_irq_init_cb(fn) \ > > (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn) > > ditto These are still used by IRQCHIP_DECLARE() (i.e. non-platform OF irqchip drivers). Johan ^ permalink raw reply [flat|nested] 40+ messages in thread
* [tip: irq/drivers] irqchip: Pass platform device to platform drivers 2025-10-13 9:46 ` [PATCH 11/11] irqchip: Pass platform device to platform drivers Johan Hovold ` (2 preceding siblings ...) 2025-10-14 8:52 ` Stanimir Varbanov @ 2025-10-16 9:51 ` tip-bot2 for Johan Hovold 2025-10-16 15:46 ` tip-bot2 for Johan Hovold 2025-10-16 19:01 ` tip-bot2 for Johan Hovold 5 siblings, 0 replies; 40+ messages in thread From: tip-bot2 for Johan Hovold @ 2025-10-16 9:51 UTC (permalink / raw) To: linux-tip-commits Cc: Johan Hovold, Thomas Gleixner, Florian Fainelli, Changhuang Liang, x86, linux-kernel The following commit has been merged into the irq/drivers branch of tip: Commit-ID: 4265aed28d7de2a643b8e441bc25344f421f2f78 Gitweb: https://git.kernel.org/tip/4265aed28d7de2a643b8e441bc25344f421f2f78 Author: Johan Hovold <johan@kernel.org> AuthorDate: Mon, 13 Oct 2025 11:46:11 +02:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Thu, 16 Oct 2025 11:30:39 +02:00 irqchip: Pass platform device to platform drivers The IRQCHIP_PLATFORM_DRIVER macros can be used to convert OF irqchip drivers to platform drivers but currently reuse the OF init callback prototype that only takes OF nodes as arguments. This forces drivers to do reverse lookups of their struct devices during probe if they need them for things like dev_printk() and device managed resources. Half of the drivers doing reverse lookups also currently fail to release the additional reference taken during the lookup, while other drivers have had the reference leak plugged in various ways (e.g. using non-intuitive cleanup constructs which still confuse static checkers). Switch to using a probe callback that takes a platform device as its first argument to simplify drivers and plug the remaining (mostly benign) reference leaks. Fixes: 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interrupt controller") Fixes: 70afdab904d2 ("irqchip: Add IMX MU MSI controller driver") Fixes: a6199bb514d8 ("irqchip: Add Qualcomm MPM controller driver") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Changhuang Liang <changhuang.liang@starfivetech.com> --- drivers/irqchip/irq-bcm2712-mip.c | 10 +----- drivers/irqchip/irq-bcm7038-l1.c | 5 +-- drivers/irqchip/irq-bcm7120-l2.c | 20 +++--------- drivers/irqchip/irq-brcmstb-l2.c | 21 ++++++------- drivers/irqchip/irq-imx-mu-msi.c | 22 +++++-------- drivers/irqchip/irq-mchp-eic.c | 5 +-- drivers/irqchip/irq-meson-gpio.c | 5 +-- drivers/irqchip/irq-qcom-mpm.c | 6 ++-- drivers/irqchip/irq-renesas-rzg2l.c | 35 ++++++--------------- drivers/irqchip/irq-renesas-rzv2h.c | 32 +++++-------------- drivers/irqchip/irq-starfive-jh8100-intc.c | 5 +-- drivers/irqchip/irqchip.c | 6 ++-- drivers/irqchip/qcom-pdc.c | 5 +-- include/linux/irqchip.h | 8 ++++- 14 files changed, 77 insertions(+), 108 deletions(-) diff --git a/drivers/irqchip/irq-bcm2712-mip.c b/drivers/irqchip/irq-bcm2712-mip.c index 8466646..4761974 100644 --- a/drivers/irqchip/irq-bcm2712-mip.c +++ b/drivers/irqchip/irq-bcm2712-mip.c @@ -232,16 +232,12 @@ err_put: return ret; } -static int mip_of_msi_init(struct device_node *node, struct device_node *parent) +static int mip_msi_probe(struct platform_device *pdev, struct device_node *parent) { - struct platform_device *pdev; + struct device_node *node = pdev->dev.of_node; struct mip_priv *mip; int ret; - pdev = of_find_device_by_node(node); - if (!pdev) - return -EPROBE_DEFER; - mip = kzalloc(sizeof(*mip), GFP_KERNEL); if (!mip) return -ENOMEM; @@ -284,7 +280,7 @@ err_priv: } IRQCHIP_PLATFORM_DRIVER_BEGIN(mip_msi) -IRQCHIP_MATCH("brcm,bcm2712-mip", mip_of_msi_init) +IRQCHIP_MATCH("brcm,bcm2712-mip", mip_msi_probe) IRQCHIP_PLATFORM_DRIVER_END(mip_msi) MODULE_DESCRIPTION("Broadcom BCM2712 MSI-X interrupt controller"); MODULE_AUTHOR("Phil Elwell <phil@raspberrypi.com>"); diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c index eda33bd..821b288 100644 --- a/drivers/irqchip/irq-bcm7038-l1.c +++ b/drivers/irqchip/irq-bcm7038-l1.c @@ -394,8 +394,9 @@ static const struct irq_domain_ops bcm7038_l1_domain_ops = { .map = bcm7038_l1_map, }; -static int bcm7038_l1_of_init(struct device_node *dn, struct device_node *parent) +static int bcm7038_l1_probe(struct platform_device *pdev, struct device_node *parent) { + struct device_node *dn = pdev->dev.of_node; struct bcm7038_l1_chip *intc; int idx, ret; @@ -453,7 +454,7 @@ out_free: } IRQCHIP_PLATFORM_DRIVER_BEGIN(bcm7038_l1) -IRQCHIP_MATCH("brcm,bcm7038-l1-intc", bcm7038_l1_of_init) +IRQCHIP_MATCH("brcm,bcm7038-l1-intc", bcm7038_l1_probe) IRQCHIP_PLATFORM_DRIVER_END(bcm7038_l1) MODULE_DESCRIPTION("Broadcom STB 7038-style L1/L2 interrupt controller"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c index b6c8556..518c9d4 100644 --- a/drivers/irqchip/irq-bcm7120-l2.c +++ b/drivers/irqchip/irq-bcm7120-l2.c @@ -206,14 +206,14 @@ static int bcm7120_l2_intc_iomap_3380(struct device_node *dn, struct bcm7120_l2_ return 0; } -static int bcm7120_l2_intc_probe(struct device_node *dn, struct device_node *parent, +static int bcm7120_l2_intc_probe(struct platform_device *pdev, struct device_node *parent, int (*iomap_regs_fn)(struct device_node *, struct bcm7120_l2_intc_data *), const char *intc_name) { unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; + struct device_node *dn = pdev->dev.of_node; struct bcm7120_l2_intc_data *data; - struct platform_device *pdev; struct irq_chip_generic *gc; struct irq_chip_type *ct; int ret = 0; @@ -224,14 +224,7 @@ static int bcm7120_l2_intc_probe(struct device_node *dn, struct device_node *par if (!data) return -ENOMEM; - pdev = of_find_device_by_node(dn); - if (!pdev) { - ret = -ENODEV; - goto out_free_data; - } - data->num_parent_irqs = platform_irq_count(pdev); - put_device(&pdev->dev); if (data->num_parent_irqs <= 0) { pr_err("invalid number of parent interrupts\n"); ret = -ENOMEM; @@ -331,20 +324,19 @@ out_unmap: if (data->map_base[idx]) iounmap(data->map_base[idx]); } -out_free_data: kfree(data); return ret; } -static int bcm7120_l2_intc_probe_7120(struct device_node *dn, struct device_node *parent) +static int bcm7120_l2_intc_probe_7120(struct platform_device *pdev, struct device_node *parent) { - return bcm7120_l2_intc_probe(dn, parent, bcm7120_l2_intc_iomap_7120, + return bcm7120_l2_intc_probe(pdev, parent, bcm7120_l2_intc_iomap_7120, "BCM7120 L2"); } -static int bcm7120_l2_intc_probe_3380(struct device_node *dn, struct device_node *parent) +static int bcm7120_l2_intc_probe_3380(struct platform_device *pdev, struct device_node *parent) { - return bcm7120_l2_intc_probe(dn, parent, bcm7120_l2_intc_iomap_3380, + return bcm7120_l2_intc_probe(pdev, parent, bcm7120_l2_intc_iomap_3380, "BCM3380 L2"); } diff --git a/drivers/irqchip/irq-brcmstb-l2.c b/drivers/irqchip/irq-brcmstb-l2.c index 53e67c6..bb7078d 100644 --- a/drivers/irqchip/irq-brcmstb-l2.c +++ b/drivers/irqchip/irq-brcmstb-l2.c @@ -138,11 +138,12 @@ static void brcmstb_l2_intc_resume(struct irq_data *d) irq_reg_writel(gc, ~b->saved_mask, ct->regs.enable); } -static int brcmstb_l2_intc_of_init(struct device_node *np, struct device_node *parent, - const struct brcmstb_intc_init_params *init_params) +static int brcmstb_l2_intc_probe(struct platform_device *pdev, struct device_node *parent, + const struct brcmstb_intc_init_params *init_params) { unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; unsigned int set = 0; + struct device_node *np = pdev->dev.of_node; struct brcmstb_l2_intc_data *data; struct irq_chip_type *ct; int ret; @@ -255,21 +256,21 @@ out_free: return ret; } -static int brcmstb_l2_edge_intc_of_init(struct device_node *np, struct device_node *parent) +static int brcmstb_l2_edge_intc_probe(struct platform_device *pdev, struct device_node *parent) { - return brcmstb_l2_intc_of_init(np, parent, &l2_edge_intc_init); + return brcmstb_l2_intc_probe(pdev, parent, &l2_edge_intc_init); } -static int brcmstb_l2_lvl_intc_of_init(struct device_node *np, struct device_node *parent) +static int brcmstb_l2_lvl_intc_probe(struct platform_device *pdev, struct device_node *parent) { - return brcmstb_l2_intc_of_init(np, parent, &l2_lvl_intc_init); + return brcmstb_l2_intc_probe(pdev, parent, &l2_lvl_intc_init); } IRQCHIP_PLATFORM_DRIVER_BEGIN(brcmstb_l2) -IRQCHIP_MATCH("brcm,l2-intc", brcmstb_l2_edge_intc_of_init) -IRQCHIP_MATCH("brcm,hif-spi-l2-intc", brcmstb_l2_edge_intc_of_init) -IRQCHIP_MATCH("brcm,upg-aux-aon-l2-intc", brcmstb_l2_edge_intc_of_init) -IRQCHIP_MATCH("brcm,bcm7271-l2-intc", brcmstb_l2_lvl_intc_of_init) +IRQCHIP_MATCH("brcm,l2-intc", brcmstb_l2_edge_intc_probe) +IRQCHIP_MATCH("brcm,hif-spi-l2-intc", brcmstb_l2_edge_intc_probe) +IRQCHIP_MATCH("brcm,upg-aux-aon-l2-intc", brcmstb_l2_edge_intc_probe) +IRQCHIP_MATCH("brcm,bcm7271-l2-intc", brcmstb_l2_lvl_intc_probe) IRQCHIP_PLATFORM_DRIVER_END(brcmstb_l2) MODULE_DESCRIPTION("Broadcom STB generic L2 interrupt controller"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/irqchip/irq-imx-mu-msi.c b/drivers/irqchip/irq-imx-mu-msi.c index 41df168..45db578 100644 --- a/drivers/irqchip/irq-imx-mu-msi.c +++ b/drivers/irqchip/irq-imx-mu-msi.c @@ -296,10 +296,9 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = { }, }; -static int imx_mu_of_init(struct device_node *dn, struct device_node *parent, +static int imx_mu_of_init(struct platform_device *pdev, struct device_node *parent, const struct imx_mu_dcfg *cfg) { - struct platform_device *pdev = of_find_device_by_node(dn); struct device_link *pd_link_a; struct device_link *pd_link_b; struct imx_mu_msi *msi_data; @@ -415,28 +414,27 @@ static const struct dev_pm_ops imx_mu_pm_ops = { imx_mu_runtime_resume, NULL) }; -static int imx_mu_imx7ulp_of_init(struct device_node *dn, struct device_node *parent) +static int imx_mu_imx7ulp_probe(struct platform_device *pdev, struct device_node *parent) { - return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx7ulp); + return imx_mu_probe(pdev, parent, &imx_mu_cfg_imx7ulp); } -static int imx_mu_imx6sx_of_init(struct device_node *dn, struct device_node *parent) +static int imx_mu_imx6sx_probe(struct platform_device *pdev, struct device_node *parent) { - return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx6sx); + return imx_mu_probe(pdev, parent, &imx_mu_cfg_imx6sx); } -static int imx_mu_imx8ulp_of_init(struct device_node *dn, struct device_node *parent) +static int imx_mu_imx8ulp_probe(struct platform_device *pdev, struct device_node *parent) { - return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx8ulp); + return imx_mu_probe(pdev, parent, &imx_mu_cfg_imx8ulp); } IRQCHIP_PLATFORM_DRIVER_BEGIN(imx_mu_msi) -IRQCHIP_MATCH("fsl,imx7ulp-mu-msi", imx_mu_imx7ulp_of_init) -IRQCHIP_MATCH("fsl,imx6sx-mu-msi", imx_mu_imx6sx_of_init) -IRQCHIP_MATCH("fsl,imx8ulp-mu-msi", imx_mu_imx8ulp_of_init) +IRQCHIP_MATCH("fsl,imx7ulp-mu-msi", imx_mu_imx7ulp_probe) +IRQCHIP_MATCH("fsl,imx6sx-mu-msi", imx_mu_imx6sx_probe) +IRQCHIP_MATCH("fsl,imx8ulp-mu-msi", imx_mu_imx8ulp_probe) IRQCHIP_PLATFORM_DRIVER_END(imx_mu_msi, .pm = &imx_mu_pm_ops) - MODULE_AUTHOR("Frank Li <Frank.Li@nxp.com>"); MODULE_DESCRIPTION("Freescale MU MSI controller driver"); MODULE_LICENSE("GPL"); diff --git a/drivers/irqchip/irq-mchp-eic.c b/drivers/irqchip/irq-mchp-eic.c index 516a3a0..b513a89 100644 --- a/drivers/irqchip/irq-mchp-eic.c +++ b/drivers/irqchip/irq-mchp-eic.c @@ -199,8 +199,9 @@ static const struct irq_domain_ops mchp_eic_domain_ops = { .free = irq_domain_free_irqs_common, }; -static int mchp_eic_init(struct device_node *node, struct device_node *parent) +static int mchp_eic_probe(struct platform_device *pdev, struct device_node *parent) { + struct device_node *node = pdev->dev.of_node; struct irq_domain *parent_domain = NULL; int ret, i; @@ -273,7 +274,7 @@ free: } IRQCHIP_PLATFORM_DRIVER_BEGIN(mchp_eic) -IRQCHIP_MATCH("microchip,sama7g5-eic", mchp_eic_init) +IRQCHIP_MATCH("microchip,sama7g5-eic", mchp_eic_probe) IRQCHIP_PLATFORM_DRIVER_END(mchp_eic) MODULE_DESCRIPTION("Microchip External Interrupt Controller"); diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c index 7d17762..09ebf1d 100644 --- a/drivers/irqchip/irq-meson-gpio.c +++ b/drivers/irqchip/irq-meson-gpio.c @@ -572,8 +572,9 @@ static int meson_gpio_irq_parse_dt(struct device_node *node, struct meson_gpio_i return 0; } -static int meson_gpio_irq_of_init(struct device_node *node, struct device_node *parent) +static int meson_gpio_irq_probe(struct platform_device *pdev, struct device_node *parent) { + struct device_node *node = pdev->dev.of_node; struct irq_domain *domain, *parent_domain; struct meson_gpio_irq_controller *ctl; int ret; @@ -630,7 +631,7 @@ free_ctl: } IRQCHIP_PLATFORM_DRIVER_BEGIN(meson_gpio_intc) -IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_of_init) +IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_probe) IRQCHIP_PLATFORM_DRIVER_END(meson_gpio_intc) MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>"); diff --git a/drivers/irqchip/irq-qcom-mpm.c b/drivers/irqchip/irq-qcom-mpm.c index 8d569f7..83f31ea 100644 --- a/drivers/irqchip/irq-qcom-mpm.c +++ b/drivers/irqchip/irq-qcom-mpm.c @@ -320,9 +320,9 @@ static bool gic_hwirq_is_mapped(struct mpm_gic_map *maps, int cnt, u32 hwirq) return false; } -static int qcom_mpm_init(struct device_node *np, struct device_node *parent) +static int qcom_mpm_probe(struct platform_device *pdev, struct device_node *parent) { - struct platform_device *pdev = of_find_device_by_node(np); + struct device_node *np = pdev->dev.of_node; struct device *dev = &pdev->dev; struct irq_domain *parent_domain; struct generic_pm_domain *genpd; @@ -478,7 +478,7 @@ remove_genpd: } IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_mpm) -IRQCHIP_MATCH("qcom,mpm", qcom_mpm_init) +IRQCHIP_MATCH("qcom,mpm", qcom_mpm_probe) IRQCHIP_PLATFORM_DRIVER_END(qcom_mpm) MODULE_DESCRIPTION("Qualcomm Technologies, Inc. MSM Power Manager"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c index 12b6eb1..1bf19de 100644 --- a/drivers/irqchip/irq-renesas-rzg2l.c +++ b/drivers/irqchip/irq-renesas-rzg2l.c @@ -8,7 +8,6 @@ */ #include <linux/bitfield.h> -#include <linux/cleanup.h> #include <linux/clk.h> #include <linux/err.h> #include <linux/io.h> @@ -528,18 +527,15 @@ static int rzg2l_irqc_parse_interrupts(struct rzg2l_irqc_priv *priv, return 0; } -static int rzg2l_irqc_common_init(struct device_node *node, struct device_node *parent, - const struct irq_chip *irq_chip) +static int rzg2l_irqc_common_probe(struct platform_device *pdev, struct device_node *parent, + const struct irq_chip *irq_chip) { - struct platform_device *pdev = of_find_device_by_node(node); - struct device *dev __free(put_device) = pdev ? &pdev->dev : NULL; struct irq_domain *irq_domain, *parent_domain; + struct device_node *node = pdev->dev.of_node; + struct device *dev = &pdev->dev; struct reset_control *resetn; int ret; - if (!pdev) - return -ENODEV; - parent_domain = irq_find_host(parent); if (!parent_domain) return dev_err_probe(dev, -ENODEV, "cannot find parent domain\n"); @@ -583,33 +579,22 @@ static int rzg2l_irqc_common_init(struct device_node *node, struct device_node * register_syscore_ops(&rzg2l_irqc_syscore_ops); - /* - * Prevent the cleanup function from invoking put_device by assigning - * NULL to dev. - * - * make coccicheck will complain about missing put_device calls, but - * those are false positives, as dev will be automatically "put" via - * __free_put_device on the failing path. - * On the successful path we don't actually want to "put" dev. - */ - dev = NULL; - return 0; } -static int rzg2l_irqc_init(struct device_node *node, struct device_node *parent) +static int rzg2l_irqc_probe(struct platform_device *pdev, struct device_node *parent) { - return rzg2l_irqc_common_init(node, parent, &rzg2l_irqc_chip); + return rzg2l_irqc_common_probe(pdev, parent, &rzg2l_irqc_chip); } -static int rzfive_irqc_init(struct device_node *node, struct device_node *parent) +static int rzfive_irqc_probe(struct platform_device *pdev, struct device_node *parent) { - return rzg2l_irqc_common_init(node, parent, &rzfive_irqc_chip); + return rzg2l_irqc_common_probe(pdev, parent, &rzfive_irqc_chip); } IRQCHIP_PLATFORM_DRIVER_BEGIN(rzg2l_irqc) -IRQCHIP_MATCH("renesas,rzg2l-irqc", rzg2l_irqc_init) -IRQCHIP_MATCH("renesas,r9a07g043f-irqc", rzfive_irqc_init) +IRQCHIP_MATCH("renesas,rzg2l-irqc", rzg2l_irqc_probe) +IRQCHIP_MATCH("renesas,r9a07g043f-irqc", rzfive_irqc_probe) IRQCHIP_PLATFORM_DRIVER_END(rzg2l_irqc) MODULE_AUTHOR("Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>"); MODULE_DESCRIPTION("Renesas RZ/G2L IRQC Driver"); diff --git a/drivers/irqchip/irq-renesas-rzv2h.c b/drivers/irqchip/irq-renesas-rzv2h.c index 9018d9c..899a423 100644 --- a/drivers/irqchip/irq-renesas-rzv2h.c +++ b/drivers/irqchip/irq-renesas-rzv2h.c @@ -490,29 +490,15 @@ static int rzv2h_icu_parse_interrupts(struct rzv2h_icu_priv *priv, struct device return 0; } -static void rzv2h_icu_put_device(void *data) -{ - put_device(data); -} - -static int rzv2h_icu_init_common(struct device_node *node, struct device_node *parent, - const struct rzv2h_hw_info *hw_info) +static int rzv2h_icu_probe_common(struct platform_device *pdev, struct device_node *parent, + const struct rzv2h_hw_info *hw_info) { struct irq_domain *irq_domain, *parent_domain; + struct device_node *node = pdev->dev.of_node; struct rzv2h_icu_priv *rzv2h_icu_data; - struct platform_device *pdev; struct reset_control *resetn; int ret; - pdev = of_find_device_by_node(node); - if (!pdev) - return -ENODEV; - - ret = devm_add_action_or_reset(&pdev->dev, rzv2h_icu_put_device, - &pdev->dev); - if (ret < 0) - return ret; - parent_domain = irq_find_host(parent); if (!parent_domain) { dev_err(&pdev->dev, "cannot find parent domain\n"); @@ -618,19 +604,19 @@ static const struct rzv2h_hw_info rzv2h_hw_params = { .field_width = 8, }; -static int rzg3e_icu_init(struct device_node *node, struct device_node *parent) +static int rzg3e_icu_probe(struct platform_device *pdev, struct device_node *parent) { - return rzv2h_icu_init_common(node, parent, &rzg3e_hw_params); + return rzv2h_icu_probe_common(pdev, parent, &rzg3e_hw_params); } -static int rzv2h_icu_init(struct device_node *node, struct device_node *parent) +static int rzv2h_icu_probe(struct platform_device *pdev, struct device_node *parent) { - return rzv2h_icu_init_common(node, parent, &rzv2h_hw_params); + return rzv2h_icu_probe_common(pdev, parent, &rzv2h_hw_params); } IRQCHIP_PLATFORM_DRIVER_BEGIN(rzv2h_icu) -IRQCHIP_MATCH("renesas,r9a09g047-icu", rzg3e_icu_init) -IRQCHIP_MATCH("renesas,r9a09g057-icu", rzv2h_icu_init) +IRQCHIP_MATCH("renesas,r9a09g047-icu", rzg3e_icu_probe) +IRQCHIP_MATCH("renesas,r9a09g057-icu", rzv2h_icu_probe) IRQCHIP_PLATFORM_DRIVER_END(rzv2h_icu) MODULE_AUTHOR("Fabrizio Castro <fabrizio.castro.jz@renesas.com>"); MODULE_DESCRIPTION("Renesas RZ/V2H(P) ICU Driver"); diff --git a/drivers/irqchip/irq-starfive-jh8100-intc.c b/drivers/irqchip/irq-starfive-jh8100-intc.c index 117f2c6..705361b 100644 --- a/drivers/irqchip/irq-starfive-jh8100-intc.c +++ b/drivers/irqchip/irq-starfive-jh8100-intc.c @@ -114,8 +114,9 @@ static void starfive_intc_irq_handler(struct irq_desc *desc) chained_irq_exit(chip, desc); } -static int starfive_intc_init(struct device_node *intc, struct device_node *parent) +static int starfive_intc_probe(struct platform_device *pdev, struct device_node *parent) { + struct device_node *intc = pdev->dev.of_node; struct starfive_irq_chip *irqc; struct reset_control *rst; struct clk *clk; @@ -198,7 +199,7 @@ err_free: } IRQCHIP_PLATFORM_DRIVER_BEGIN(starfive_intc) -IRQCHIP_MATCH("starfive,jh8100-intc", starfive_intc_init) +IRQCHIP_MATCH("starfive,jh8100-intc", starfive_intc_probe) IRQCHIP_PLATFORM_DRIVER_END(starfive_intc) MODULE_DESCRIPTION("StarFive JH8100 External Interrupt Controller"); diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c index 652d20d..689c8e4 100644 --- a/drivers/irqchip/irqchip.c +++ b/drivers/irqchip/irqchip.c @@ -36,9 +36,9 @@ int platform_irqchip_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct device_node *par_np __free(device_node) = of_irq_find_parent(np); - of_irq_init_cb_t irq_init_cb = of_device_get_match_data(&pdev->dev); + platform_irq_probe_t irq_probe = of_device_get_match_data(&pdev->dev); - if (!irq_init_cb) + if (!irq_probe) return -EINVAL; if (par_np == np) @@ -55,6 +55,6 @@ int platform_irqchip_probe(struct platform_device *pdev) if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY)) return -EPROBE_DEFER; - return irq_init_cb(np, par_np); + return irq_probe(pdev, par_np); } EXPORT_SYMBOL_GPL(platform_irqchip_probe); diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c index 52d7754..518f7f0 100644 --- a/drivers/irqchip/qcom-pdc.c +++ b/drivers/irqchip/qcom-pdc.c @@ -350,9 +350,10 @@ static int pdc_setup_pin_mapping(struct device_node *np) #define QCOM_PDC_SIZE 0x30000 -static int qcom_pdc_init(struct device_node *node, struct device_node *parent) +static int qcom_pdc_probe(struct platform_device *pdev, struct device_node *parent) { struct irq_domain *parent_domain, *pdc_domain; + struct device_node *node = pdev->dev.of_node; resource_size_t res_size; struct resource res; int ret; @@ -428,7 +429,7 @@ fail: } IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc) -IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init) +IRQCHIP_MATCH("qcom,pdc", qcom_pdc_probe) IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc) MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller"); MODULE_LICENSE("GPL v2"); diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h index d5e6024..bc4ddac 100644 --- a/include/linux/irqchip.h +++ b/include/linux/irqchip.h @@ -17,12 +17,18 @@ #include <linux/of_irq.h> #include <linux/platform_device.h> +typedef int (*platform_irq_probe_t)(struct platform_device *, struct device_node *); + /* Undefined on purpose */ extern of_irq_init_cb_t typecheck_irq_init_cb; +extern platform_irq_probe_t typecheck_irq_probe; #define typecheck_irq_init_cb(fn) \ (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn) +#define typecheck_irq_probe(fn) \ + (__typecheck(typecheck_irq_probe, &fn) ? fn : fn) + /* * This macro must be used by the different irqchip drivers to declare * the association between their DT compatible string and their @@ -42,7 +48,7 @@ extern int platform_irqchip_probe(struct platform_device *pdev); static const struct of_device_id drv_name##_irqchip_match_table[] = { #define IRQCHIP_MATCH(compat, fn) { .compatible = compat, \ - .data = typecheck_irq_init_cb(fn), }, + .data = typecheck_irq_probe(fn), }, #define IRQCHIP_PLATFORM_DRIVER_END(drv_name, ...) \ ^ permalink raw reply related [flat|nested] 40+ messages in thread
* [tip: irq/drivers] irqchip: Pass platform device to platform drivers 2025-10-13 9:46 ` [PATCH 11/11] irqchip: Pass platform device to platform drivers Johan Hovold ` (3 preceding siblings ...) 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold @ 2025-10-16 15:46 ` tip-bot2 for Johan Hovold 2025-10-16 15:56 ` Johan Hovold 2025-10-16 19:01 ` tip-bot2 for Johan Hovold 5 siblings, 1 reply; 40+ messages in thread From: tip-bot2 for Johan Hovold @ 2025-10-16 15:46 UTC (permalink / raw) To: linux-tip-commits Cc: Johan Hovold, Thomas Gleixner, Florian Fainelli, Changhuang Liang, x86, linux-kernel The following commit has been merged into the irq/drivers branch of tip: Commit-ID: 9a1926893b68931e2d1dbadec9435a7efef92d76 Gitweb: https://git.kernel.org/tip/9a1926893b68931e2d1dbadec9435a7efef92d76 Author: Johan Hovold <johan@kernel.org> AuthorDate: Mon, 13 Oct 2025 11:46:11 +02:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Thu, 16 Oct 2025 17:26:34 +02:00 irqchip: Pass platform device to platform drivers The IRQCHIP_PLATFORM_DRIVER macros can be used to convert OF irqchip drivers to platform drivers but currently reuse the OF init callback prototype that only takes OF nodes as arguments. This forces drivers to do reverse lookups of their struct devices during probe if they need them for things like dev_printk() and device managed resources. Half of the drivers doing reverse lookups also currently fail to release the additional reference taken during the lookup, while other drivers have had the reference leak plugged in various ways (e.g. using non-intuitive cleanup constructs which still confuse static checkers). Switch to using a probe callback that takes a platform device as its first argument to simplify drivers and plug the remaining (mostly benign) reference leaks. Fixes: 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interrupt controller") Fixes: 70afdab904d2 ("irqchip: Add IMX MU MSI controller driver") Fixes: a6199bb514d8 ("irqchip: Add Qualcomm MPM controller driver") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Changhuang Liang <changhuang.liang@starfivetech.com> --- drivers/irqchip/irq-bcm2712-mip.c | 10 +----- drivers/irqchip/irq-bcm7038-l1.c | 5 +-- drivers/irqchip/irq-bcm7120-l2.c | 20 +++--------- drivers/irqchip/irq-brcmstb-l2.c | 21 ++++++------- drivers/irqchip/irq-imx-mu-msi.c | 24 ++++++-------- drivers/irqchip/irq-mchp-eic.c | 5 +-- drivers/irqchip/irq-meson-gpio.c | 5 +-- drivers/irqchip/irq-qcom-mpm.c | 6 ++-- drivers/irqchip/irq-renesas-rzg2l.c | 35 ++++++--------------- drivers/irqchip/irq-renesas-rzv2h.c | 32 +++++-------------- drivers/irqchip/irq-starfive-jh8100-intc.c | 5 +-- drivers/irqchip/irqchip.c | 6 ++-- drivers/irqchip/qcom-pdc.c | 5 +-- include/linux/irqchip.h | 8 ++++- 14 files changed, 78 insertions(+), 109 deletions(-) diff --git a/drivers/irqchip/irq-bcm2712-mip.c b/drivers/irqchip/irq-bcm2712-mip.c index 8466646..4761974 100644 --- a/drivers/irqchip/irq-bcm2712-mip.c +++ b/drivers/irqchip/irq-bcm2712-mip.c @@ -232,16 +232,12 @@ err_put: return ret; } -static int mip_of_msi_init(struct device_node *node, struct device_node *parent) +static int mip_msi_probe(struct platform_device *pdev, struct device_node *parent) { - struct platform_device *pdev; + struct device_node *node = pdev->dev.of_node; struct mip_priv *mip; int ret; - pdev = of_find_device_by_node(node); - if (!pdev) - return -EPROBE_DEFER; - mip = kzalloc(sizeof(*mip), GFP_KERNEL); if (!mip) return -ENOMEM; @@ -284,7 +280,7 @@ err_priv: } IRQCHIP_PLATFORM_DRIVER_BEGIN(mip_msi) -IRQCHIP_MATCH("brcm,bcm2712-mip", mip_of_msi_init) +IRQCHIP_MATCH("brcm,bcm2712-mip", mip_msi_probe) IRQCHIP_PLATFORM_DRIVER_END(mip_msi) MODULE_DESCRIPTION("Broadcom BCM2712 MSI-X interrupt controller"); MODULE_AUTHOR("Phil Elwell <phil@raspberrypi.com>"); diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c index eda33bd..821b288 100644 --- a/drivers/irqchip/irq-bcm7038-l1.c +++ b/drivers/irqchip/irq-bcm7038-l1.c @@ -394,8 +394,9 @@ static const struct irq_domain_ops bcm7038_l1_domain_ops = { .map = bcm7038_l1_map, }; -static int bcm7038_l1_of_init(struct device_node *dn, struct device_node *parent) +static int bcm7038_l1_probe(struct platform_device *pdev, struct device_node *parent) { + struct device_node *dn = pdev->dev.of_node; struct bcm7038_l1_chip *intc; int idx, ret; @@ -453,7 +454,7 @@ out_free: } IRQCHIP_PLATFORM_DRIVER_BEGIN(bcm7038_l1) -IRQCHIP_MATCH("brcm,bcm7038-l1-intc", bcm7038_l1_of_init) +IRQCHIP_MATCH("brcm,bcm7038-l1-intc", bcm7038_l1_probe) IRQCHIP_PLATFORM_DRIVER_END(bcm7038_l1) MODULE_DESCRIPTION("Broadcom STB 7038-style L1/L2 interrupt controller"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c index b6c8556..518c9d4 100644 --- a/drivers/irqchip/irq-bcm7120-l2.c +++ b/drivers/irqchip/irq-bcm7120-l2.c @@ -206,14 +206,14 @@ static int bcm7120_l2_intc_iomap_3380(struct device_node *dn, struct bcm7120_l2_ return 0; } -static int bcm7120_l2_intc_probe(struct device_node *dn, struct device_node *parent, +static int bcm7120_l2_intc_probe(struct platform_device *pdev, struct device_node *parent, int (*iomap_regs_fn)(struct device_node *, struct bcm7120_l2_intc_data *), const char *intc_name) { unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; + struct device_node *dn = pdev->dev.of_node; struct bcm7120_l2_intc_data *data; - struct platform_device *pdev; struct irq_chip_generic *gc; struct irq_chip_type *ct; int ret = 0; @@ -224,14 +224,7 @@ static int bcm7120_l2_intc_probe(struct device_node *dn, struct device_node *par if (!data) return -ENOMEM; - pdev = of_find_device_by_node(dn); - if (!pdev) { - ret = -ENODEV; - goto out_free_data; - } - data->num_parent_irqs = platform_irq_count(pdev); - put_device(&pdev->dev); if (data->num_parent_irqs <= 0) { pr_err("invalid number of parent interrupts\n"); ret = -ENOMEM; @@ -331,20 +324,19 @@ out_unmap: if (data->map_base[idx]) iounmap(data->map_base[idx]); } -out_free_data: kfree(data); return ret; } -static int bcm7120_l2_intc_probe_7120(struct device_node *dn, struct device_node *parent) +static int bcm7120_l2_intc_probe_7120(struct platform_device *pdev, struct device_node *parent) { - return bcm7120_l2_intc_probe(dn, parent, bcm7120_l2_intc_iomap_7120, + return bcm7120_l2_intc_probe(pdev, parent, bcm7120_l2_intc_iomap_7120, "BCM7120 L2"); } -static int bcm7120_l2_intc_probe_3380(struct device_node *dn, struct device_node *parent) +static int bcm7120_l2_intc_probe_3380(struct platform_device *pdev, struct device_node *parent) { - return bcm7120_l2_intc_probe(dn, parent, bcm7120_l2_intc_iomap_3380, + return bcm7120_l2_intc_probe(pdev, parent, bcm7120_l2_intc_iomap_3380, "BCM3380 L2"); } diff --git a/drivers/irqchip/irq-brcmstb-l2.c b/drivers/irqchip/irq-brcmstb-l2.c index 53e67c6..bb7078d 100644 --- a/drivers/irqchip/irq-brcmstb-l2.c +++ b/drivers/irqchip/irq-brcmstb-l2.c @@ -138,11 +138,12 @@ static void brcmstb_l2_intc_resume(struct irq_data *d) irq_reg_writel(gc, ~b->saved_mask, ct->regs.enable); } -static int brcmstb_l2_intc_of_init(struct device_node *np, struct device_node *parent, - const struct brcmstb_intc_init_params *init_params) +static int brcmstb_l2_intc_probe(struct platform_device *pdev, struct device_node *parent, + const struct brcmstb_intc_init_params *init_params) { unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; unsigned int set = 0; + struct device_node *np = pdev->dev.of_node; struct brcmstb_l2_intc_data *data; struct irq_chip_type *ct; int ret; @@ -255,21 +256,21 @@ out_free: return ret; } -static int brcmstb_l2_edge_intc_of_init(struct device_node *np, struct device_node *parent) +static int brcmstb_l2_edge_intc_probe(struct platform_device *pdev, struct device_node *parent) { - return brcmstb_l2_intc_of_init(np, parent, &l2_edge_intc_init); + return brcmstb_l2_intc_probe(pdev, parent, &l2_edge_intc_init); } -static int brcmstb_l2_lvl_intc_of_init(struct device_node *np, struct device_node *parent) +static int brcmstb_l2_lvl_intc_probe(struct platform_device *pdev, struct device_node *parent) { - return brcmstb_l2_intc_of_init(np, parent, &l2_lvl_intc_init); + return brcmstb_l2_intc_probe(pdev, parent, &l2_lvl_intc_init); } IRQCHIP_PLATFORM_DRIVER_BEGIN(brcmstb_l2) -IRQCHIP_MATCH("brcm,l2-intc", brcmstb_l2_edge_intc_of_init) -IRQCHIP_MATCH("brcm,hif-spi-l2-intc", brcmstb_l2_edge_intc_of_init) -IRQCHIP_MATCH("brcm,upg-aux-aon-l2-intc", brcmstb_l2_edge_intc_of_init) -IRQCHIP_MATCH("brcm,bcm7271-l2-intc", brcmstb_l2_lvl_intc_of_init) +IRQCHIP_MATCH("brcm,l2-intc", brcmstb_l2_edge_intc_probe) +IRQCHIP_MATCH("brcm,hif-spi-l2-intc", brcmstb_l2_edge_intc_probe) +IRQCHIP_MATCH("brcm,upg-aux-aon-l2-intc", brcmstb_l2_edge_intc_probe) +IRQCHIP_MATCH("brcm,bcm7271-l2-intc", brcmstb_l2_lvl_intc_probe) IRQCHIP_PLATFORM_DRIVER_END(brcmstb_l2) MODULE_DESCRIPTION("Broadcom STB generic L2 interrupt controller"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/irqchip/irq-imx-mu-msi.c b/drivers/irqchip/irq-imx-mu-msi.c index 41df168..2370ab6 100644 --- a/drivers/irqchip/irq-imx-mu-msi.c +++ b/drivers/irqchip/irq-imx-mu-msi.c @@ -296,10 +296,9 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = { }, }; -static int imx_mu_of_init(struct device_node *dn, struct device_node *parent, - const struct imx_mu_dcfg *cfg) +static int imx_mu_of_probe(struct platform_device *pdev, struct device_node *parent, + const struct imx_mu_dcfg *cfg) { - struct platform_device *pdev = of_find_device_by_node(dn); struct device_link *pd_link_a; struct device_link *pd_link_b; struct imx_mu_msi *msi_data; @@ -415,28 +414,27 @@ static const struct dev_pm_ops imx_mu_pm_ops = { imx_mu_runtime_resume, NULL) }; -static int imx_mu_imx7ulp_of_init(struct device_node *dn, struct device_node *parent) +static int imx_mu_imx7ulp_probe(struct platform_device *pdev, struct device_node *parent) { - return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx7ulp); + return imx_mu_probe(pdev, parent, &imx_mu_cfg_imx7ulp); } -static int imx_mu_imx6sx_of_init(struct device_node *dn, struct device_node *parent) +static int imx_mu_imx6sx_probe(struct platform_device *pdev, struct device_node *parent) { - return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx6sx); + return imx_mu_probe(pdev, parent, &imx_mu_cfg_imx6sx); } -static int imx_mu_imx8ulp_of_init(struct device_node *dn, struct device_node *parent) +static int imx_mu_imx8ulp_probe(struct platform_device *pdev, struct device_node *parent) { - return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx8ulp); + return imx_mu_probe(pdev, parent, &imx_mu_cfg_imx8ulp); } IRQCHIP_PLATFORM_DRIVER_BEGIN(imx_mu_msi) -IRQCHIP_MATCH("fsl,imx7ulp-mu-msi", imx_mu_imx7ulp_of_init) -IRQCHIP_MATCH("fsl,imx6sx-mu-msi", imx_mu_imx6sx_of_init) -IRQCHIP_MATCH("fsl,imx8ulp-mu-msi", imx_mu_imx8ulp_of_init) +IRQCHIP_MATCH("fsl,imx7ulp-mu-msi", imx_mu_imx7ulp_probe) +IRQCHIP_MATCH("fsl,imx6sx-mu-msi", imx_mu_imx6sx_probe) +IRQCHIP_MATCH("fsl,imx8ulp-mu-msi", imx_mu_imx8ulp_probe) IRQCHIP_PLATFORM_DRIVER_END(imx_mu_msi, .pm = &imx_mu_pm_ops) - MODULE_AUTHOR("Frank Li <Frank.Li@nxp.com>"); MODULE_DESCRIPTION("Freescale MU MSI controller driver"); MODULE_LICENSE("GPL"); diff --git a/drivers/irqchip/irq-mchp-eic.c b/drivers/irqchip/irq-mchp-eic.c index 516a3a0..b513a89 100644 --- a/drivers/irqchip/irq-mchp-eic.c +++ b/drivers/irqchip/irq-mchp-eic.c @@ -199,8 +199,9 @@ static const struct irq_domain_ops mchp_eic_domain_ops = { .free = irq_domain_free_irqs_common, }; -static int mchp_eic_init(struct device_node *node, struct device_node *parent) +static int mchp_eic_probe(struct platform_device *pdev, struct device_node *parent) { + struct device_node *node = pdev->dev.of_node; struct irq_domain *parent_domain = NULL; int ret, i; @@ -273,7 +274,7 @@ free: } IRQCHIP_PLATFORM_DRIVER_BEGIN(mchp_eic) -IRQCHIP_MATCH("microchip,sama7g5-eic", mchp_eic_init) +IRQCHIP_MATCH("microchip,sama7g5-eic", mchp_eic_probe) IRQCHIP_PLATFORM_DRIVER_END(mchp_eic) MODULE_DESCRIPTION("Microchip External Interrupt Controller"); diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c index 7d17762..09ebf1d 100644 --- a/drivers/irqchip/irq-meson-gpio.c +++ b/drivers/irqchip/irq-meson-gpio.c @@ -572,8 +572,9 @@ static int meson_gpio_irq_parse_dt(struct device_node *node, struct meson_gpio_i return 0; } -static int meson_gpio_irq_of_init(struct device_node *node, struct device_node *parent) +static int meson_gpio_irq_probe(struct platform_device *pdev, struct device_node *parent) { + struct device_node *node = pdev->dev.of_node; struct irq_domain *domain, *parent_domain; struct meson_gpio_irq_controller *ctl; int ret; @@ -630,7 +631,7 @@ free_ctl: } IRQCHIP_PLATFORM_DRIVER_BEGIN(meson_gpio_intc) -IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_of_init) +IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_probe) IRQCHIP_PLATFORM_DRIVER_END(meson_gpio_intc) MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>"); diff --git a/drivers/irqchip/irq-qcom-mpm.c b/drivers/irqchip/irq-qcom-mpm.c index 8d569f7..83f31ea 100644 --- a/drivers/irqchip/irq-qcom-mpm.c +++ b/drivers/irqchip/irq-qcom-mpm.c @@ -320,9 +320,9 @@ static bool gic_hwirq_is_mapped(struct mpm_gic_map *maps, int cnt, u32 hwirq) return false; } -static int qcom_mpm_init(struct device_node *np, struct device_node *parent) +static int qcom_mpm_probe(struct platform_device *pdev, struct device_node *parent) { - struct platform_device *pdev = of_find_device_by_node(np); + struct device_node *np = pdev->dev.of_node; struct device *dev = &pdev->dev; struct irq_domain *parent_domain; struct generic_pm_domain *genpd; @@ -478,7 +478,7 @@ remove_genpd: } IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_mpm) -IRQCHIP_MATCH("qcom,mpm", qcom_mpm_init) +IRQCHIP_MATCH("qcom,mpm", qcom_mpm_probe) IRQCHIP_PLATFORM_DRIVER_END(qcom_mpm) MODULE_DESCRIPTION("Qualcomm Technologies, Inc. MSM Power Manager"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c index 12b6eb1..1bf19de 100644 --- a/drivers/irqchip/irq-renesas-rzg2l.c +++ b/drivers/irqchip/irq-renesas-rzg2l.c @@ -8,7 +8,6 @@ */ #include <linux/bitfield.h> -#include <linux/cleanup.h> #include <linux/clk.h> #include <linux/err.h> #include <linux/io.h> @@ -528,18 +527,15 @@ static int rzg2l_irqc_parse_interrupts(struct rzg2l_irqc_priv *priv, return 0; } -static int rzg2l_irqc_common_init(struct device_node *node, struct device_node *parent, - const struct irq_chip *irq_chip) +static int rzg2l_irqc_common_probe(struct platform_device *pdev, struct device_node *parent, + const struct irq_chip *irq_chip) { - struct platform_device *pdev = of_find_device_by_node(node); - struct device *dev __free(put_device) = pdev ? &pdev->dev : NULL; struct irq_domain *irq_domain, *parent_domain; + struct device_node *node = pdev->dev.of_node; + struct device *dev = &pdev->dev; struct reset_control *resetn; int ret; - if (!pdev) - return -ENODEV; - parent_domain = irq_find_host(parent); if (!parent_domain) return dev_err_probe(dev, -ENODEV, "cannot find parent domain\n"); @@ -583,33 +579,22 @@ static int rzg2l_irqc_common_init(struct device_node *node, struct device_node * register_syscore_ops(&rzg2l_irqc_syscore_ops); - /* - * Prevent the cleanup function from invoking put_device by assigning - * NULL to dev. - * - * make coccicheck will complain about missing put_device calls, but - * those are false positives, as dev will be automatically "put" via - * __free_put_device on the failing path. - * On the successful path we don't actually want to "put" dev. - */ - dev = NULL; - return 0; } -static int rzg2l_irqc_init(struct device_node *node, struct device_node *parent) +static int rzg2l_irqc_probe(struct platform_device *pdev, struct device_node *parent) { - return rzg2l_irqc_common_init(node, parent, &rzg2l_irqc_chip); + return rzg2l_irqc_common_probe(pdev, parent, &rzg2l_irqc_chip); } -static int rzfive_irqc_init(struct device_node *node, struct device_node *parent) +static int rzfive_irqc_probe(struct platform_device *pdev, struct device_node *parent) { - return rzg2l_irqc_common_init(node, parent, &rzfive_irqc_chip); + return rzg2l_irqc_common_probe(pdev, parent, &rzfive_irqc_chip); } IRQCHIP_PLATFORM_DRIVER_BEGIN(rzg2l_irqc) -IRQCHIP_MATCH("renesas,rzg2l-irqc", rzg2l_irqc_init) -IRQCHIP_MATCH("renesas,r9a07g043f-irqc", rzfive_irqc_init) +IRQCHIP_MATCH("renesas,rzg2l-irqc", rzg2l_irqc_probe) +IRQCHIP_MATCH("renesas,r9a07g043f-irqc", rzfive_irqc_probe) IRQCHIP_PLATFORM_DRIVER_END(rzg2l_irqc) MODULE_AUTHOR("Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>"); MODULE_DESCRIPTION("Renesas RZ/G2L IRQC Driver"); diff --git a/drivers/irqchip/irq-renesas-rzv2h.c b/drivers/irqchip/irq-renesas-rzv2h.c index 9018d9c..899a423 100644 --- a/drivers/irqchip/irq-renesas-rzv2h.c +++ b/drivers/irqchip/irq-renesas-rzv2h.c @@ -490,29 +490,15 @@ static int rzv2h_icu_parse_interrupts(struct rzv2h_icu_priv *priv, struct device return 0; } -static void rzv2h_icu_put_device(void *data) -{ - put_device(data); -} - -static int rzv2h_icu_init_common(struct device_node *node, struct device_node *parent, - const struct rzv2h_hw_info *hw_info) +static int rzv2h_icu_probe_common(struct platform_device *pdev, struct device_node *parent, + const struct rzv2h_hw_info *hw_info) { struct irq_domain *irq_domain, *parent_domain; + struct device_node *node = pdev->dev.of_node; struct rzv2h_icu_priv *rzv2h_icu_data; - struct platform_device *pdev; struct reset_control *resetn; int ret; - pdev = of_find_device_by_node(node); - if (!pdev) - return -ENODEV; - - ret = devm_add_action_or_reset(&pdev->dev, rzv2h_icu_put_device, - &pdev->dev); - if (ret < 0) - return ret; - parent_domain = irq_find_host(parent); if (!parent_domain) { dev_err(&pdev->dev, "cannot find parent domain\n"); @@ -618,19 +604,19 @@ static const struct rzv2h_hw_info rzv2h_hw_params = { .field_width = 8, }; -static int rzg3e_icu_init(struct device_node *node, struct device_node *parent) +static int rzg3e_icu_probe(struct platform_device *pdev, struct device_node *parent) { - return rzv2h_icu_init_common(node, parent, &rzg3e_hw_params); + return rzv2h_icu_probe_common(pdev, parent, &rzg3e_hw_params); } -static int rzv2h_icu_init(struct device_node *node, struct device_node *parent) +static int rzv2h_icu_probe(struct platform_device *pdev, struct device_node *parent) { - return rzv2h_icu_init_common(node, parent, &rzv2h_hw_params); + return rzv2h_icu_probe_common(pdev, parent, &rzv2h_hw_params); } IRQCHIP_PLATFORM_DRIVER_BEGIN(rzv2h_icu) -IRQCHIP_MATCH("renesas,r9a09g047-icu", rzg3e_icu_init) -IRQCHIP_MATCH("renesas,r9a09g057-icu", rzv2h_icu_init) +IRQCHIP_MATCH("renesas,r9a09g047-icu", rzg3e_icu_probe) +IRQCHIP_MATCH("renesas,r9a09g057-icu", rzv2h_icu_probe) IRQCHIP_PLATFORM_DRIVER_END(rzv2h_icu) MODULE_AUTHOR("Fabrizio Castro <fabrizio.castro.jz@renesas.com>"); MODULE_DESCRIPTION("Renesas RZ/V2H(P) ICU Driver"); diff --git a/drivers/irqchip/irq-starfive-jh8100-intc.c b/drivers/irqchip/irq-starfive-jh8100-intc.c index 117f2c6..705361b 100644 --- a/drivers/irqchip/irq-starfive-jh8100-intc.c +++ b/drivers/irqchip/irq-starfive-jh8100-intc.c @@ -114,8 +114,9 @@ static void starfive_intc_irq_handler(struct irq_desc *desc) chained_irq_exit(chip, desc); } -static int starfive_intc_init(struct device_node *intc, struct device_node *parent) +static int starfive_intc_probe(struct platform_device *pdev, struct device_node *parent) { + struct device_node *intc = pdev->dev.of_node; struct starfive_irq_chip *irqc; struct reset_control *rst; struct clk *clk; @@ -198,7 +199,7 @@ err_free: } IRQCHIP_PLATFORM_DRIVER_BEGIN(starfive_intc) -IRQCHIP_MATCH("starfive,jh8100-intc", starfive_intc_init) +IRQCHIP_MATCH("starfive,jh8100-intc", starfive_intc_probe) IRQCHIP_PLATFORM_DRIVER_END(starfive_intc) MODULE_DESCRIPTION("StarFive JH8100 External Interrupt Controller"); diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c index 652d20d..689c8e4 100644 --- a/drivers/irqchip/irqchip.c +++ b/drivers/irqchip/irqchip.c @@ -36,9 +36,9 @@ int platform_irqchip_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct device_node *par_np __free(device_node) = of_irq_find_parent(np); - of_irq_init_cb_t irq_init_cb = of_device_get_match_data(&pdev->dev); + platform_irq_probe_t irq_probe = of_device_get_match_data(&pdev->dev); - if (!irq_init_cb) + if (!irq_probe) return -EINVAL; if (par_np == np) @@ -55,6 +55,6 @@ int platform_irqchip_probe(struct platform_device *pdev) if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY)) return -EPROBE_DEFER; - return irq_init_cb(np, par_np); + return irq_probe(pdev, par_np); } EXPORT_SYMBOL_GPL(platform_irqchip_probe); diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c index 52d7754..518f7f0 100644 --- a/drivers/irqchip/qcom-pdc.c +++ b/drivers/irqchip/qcom-pdc.c @@ -350,9 +350,10 @@ static int pdc_setup_pin_mapping(struct device_node *np) #define QCOM_PDC_SIZE 0x30000 -static int qcom_pdc_init(struct device_node *node, struct device_node *parent) +static int qcom_pdc_probe(struct platform_device *pdev, struct device_node *parent) { struct irq_domain *parent_domain, *pdc_domain; + struct device_node *node = pdev->dev.of_node; resource_size_t res_size; struct resource res; int ret; @@ -428,7 +429,7 @@ fail: } IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc) -IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init) +IRQCHIP_MATCH("qcom,pdc", qcom_pdc_probe) IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc) MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller"); MODULE_LICENSE("GPL v2"); diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h index d5e6024..bc4ddac 100644 --- a/include/linux/irqchip.h +++ b/include/linux/irqchip.h @@ -17,12 +17,18 @@ #include <linux/of_irq.h> #include <linux/platform_device.h> +typedef int (*platform_irq_probe_t)(struct platform_device *, struct device_node *); + /* Undefined on purpose */ extern of_irq_init_cb_t typecheck_irq_init_cb; +extern platform_irq_probe_t typecheck_irq_probe; #define typecheck_irq_init_cb(fn) \ (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn) +#define typecheck_irq_probe(fn) \ + (__typecheck(typecheck_irq_probe, &fn) ? fn : fn) + /* * This macro must be used by the different irqchip drivers to declare * the association between their DT compatible string and their @@ -42,7 +48,7 @@ extern int platform_irqchip_probe(struct platform_device *pdev); static const struct of_device_id drv_name##_irqchip_match_table[] = { #define IRQCHIP_MATCH(compat, fn) { .compatible = compat, \ - .data = typecheck_irq_init_cb(fn), }, + .data = typecheck_irq_probe(fn), }, #define IRQCHIP_PLATFORM_DRIVER_END(drv_name, ...) \ ^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [tip: irq/drivers] irqchip: Pass platform device to platform drivers 2025-10-16 15:46 ` tip-bot2 for Johan Hovold @ 2025-10-16 15:56 ` Johan Hovold 2025-10-16 16:19 ` Thomas Gleixner 0 siblings, 1 reply; 40+ messages in thread From: Johan Hovold @ 2025-10-16 15:56 UTC (permalink / raw) To: linux-kernel, Thomas Gleixner Cc: linux-tip-commits, Florian Fainelli, Changhuang Liang, x86 On Thu, Oct 16, 2025 at 03:46:41PM -0000, tip-bot2 for Johan Hovold wrote: > The following commit has been merged into the irq/drivers branch of tip: > > Commit-ID: 9a1926893b68931e2d1dbadec9435a7efef92d76 > Gitweb: https://git.kernel.org/tip/9a1926893b68931e2d1dbadec9435a7efef92d76 > Author: Johan Hovold <johan@kernel.org> > AuthorDate: Mon, 13 Oct 2025 11:46:11 +02:00 > Committer: Thomas Gleixner <tglx@linutronix.de> > CommitterDate: Thu, 16 Oct 2025 17:26:34 +02:00 > > irqchip: Pass platform device to platform drivers > diff --git a/drivers/irqchip/irq-imx-mu-msi.c b/drivers/irqchip/irq-imx-mu-msi.c > index 41df168..2370ab6 100644 > --- a/drivers/irqchip/irq-imx-mu-msi.c > +++ b/drivers/irqchip/irq-imx-mu-msi.c > @@ -296,10 +296,9 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = { > }, > }; > > -static int imx_mu_of_init(struct device_node *dn, struct device_node *parent, > - const struct imx_mu_dcfg *cfg) > +static int imx_mu_of_probe(struct platform_device *pdev, struct device_node *parent, > + const struct imx_mu_dcfg *cfg) There's still an editing mistake here; the new name should just be 'imx_mu_probe'. Johan ^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [tip: irq/drivers] irqchip: Pass platform device to platform drivers 2025-10-16 15:56 ` Johan Hovold @ 2025-10-16 16:19 ` Thomas Gleixner 0 siblings, 0 replies; 40+ messages in thread From: Thomas Gleixner @ 2025-10-16 16:19 UTC (permalink / raw) To: Johan Hovold, linux-kernel Cc: linux-tip-commits, Florian Fainelli, Changhuang Liang, x86 On Thu, Oct 16 2025 at 17:56, Johan Hovold wrote: > On Thu, Oct 16, 2025 at 03:46:41PM -0000, tip-bot2 for Johan Hovold wrote: >> The following commit has been merged into the irq/drivers branch of tip: >> @@ -296,10 +296,9 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = { >> }, >> }; >> >> -static int imx_mu_of_init(struct device_node *dn, struct device_node *parent, >> - const struct imx_mu_dcfg *cfg) >> +static int imx_mu_of_probe(struct platform_device *pdev, struct device_node *parent, >> + const struct imx_mu_dcfg *cfg) > > There's still an editing mistake here; the new name should just be > 'imx_mu_probe'. Not my day today. Even enabling the correct config knob is too complicated it seems.... ^ permalink raw reply [flat|nested] 40+ messages in thread
* [tip: irq/drivers] irqchip: Pass platform device to platform drivers 2025-10-13 9:46 ` [PATCH 11/11] irqchip: Pass platform device to platform drivers Johan Hovold ` (4 preceding siblings ...) 2025-10-16 15:46 ` tip-bot2 for Johan Hovold @ 2025-10-16 19:01 ` tip-bot2 for Johan Hovold 5 siblings, 0 replies; 40+ messages in thread From: tip-bot2 for Johan Hovold @ 2025-10-16 19:01 UTC (permalink / raw) To: linux-tip-commits Cc: Johan Hovold, Thomas Gleixner, Florian Fainelli, Changhuang Liang, x86, linux-kernel The following commit has been merged into the irq/drivers branch of tip: Commit-ID: 1e3e330c07076a0582385bbea029c9cc918fa30d Gitweb: https://git.kernel.org/tip/1e3e330c07076a0582385bbea029c9cc918fa30d Author: Johan Hovold <johan@kernel.org> AuthorDate: Mon, 13 Oct 2025 11:46:11 +02:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Thu, 16 Oct 2025 18:17:27 +02:00 irqchip: Pass platform device to platform drivers The IRQCHIP_PLATFORM_DRIVER macros can be used to convert OF irqchip drivers to platform drivers but currently reuse the OF init callback prototype that only takes OF nodes as arguments. This forces drivers to do reverse lookups of their struct devices during probe if they need them for things like dev_printk() and device managed resources. Half of the drivers doing reverse lookups also currently fail to release the additional reference taken during the lookup, while other drivers have had the reference leak plugged in various ways (e.g. using non-intuitive cleanup constructs which still confuse static checkers). Switch to using a probe callback that takes a platform device as its first argument to simplify drivers and plug the remaining (mostly benign) reference leaks. Fixes: 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interrupt controller") Fixes: 70afdab904d2 ("irqchip: Add IMX MU MSI controller driver") Fixes: a6199bb514d8 ("irqchip: Add Qualcomm MPM controller driver") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Changhuang Liang <changhuang.liang@starfivetech.com> --- drivers/irqchip/irq-bcm2712-mip.c | 10 +----- drivers/irqchip/irq-bcm7038-l1.c | 5 +-- drivers/irqchip/irq-bcm7120-l2.c | 20 +++--------- drivers/irqchip/irq-brcmstb-l2.c | 21 ++++++------- drivers/irqchip/irq-imx-mu-msi.c | 24 ++++++-------- drivers/irqchip/irq-mchp-eic.c | 5 +-- drivers/irqchip/irq-meson-gpio.c | 5 +-- drivers/irqchip/irq-qcom-mpm.c | 6 ++-- drivers/irqchip/irq-renesas-rzg2l.c | 35 ++++++--------------- drivers/irqchip/irq-renesas-rzv2h.c | 32 +++++-------------- drivers/irqchip/irq-starfive-jh8100-intc.c | 5 +-- drivers/irqchip/irqchip.c | 6 ++-- drivers/irqchip/qcom-pdc.c | 5 +-- include/linux/irqchip.h | 8 ++++- 14 files changed, 78 insertions(+), 109 deletions(-) diff --git a/drivers/irqchip/irq-bcm2712-mip.c b/drivers/irqchip/irq-bcm2712-mip.c index 8466646..4761974 100644 --- a/drivers/irqchip/irq-bcm2712-mip.c +++ b/drivers/irqchip/irq-bcm2712-mip.c @@ -232,16 +232,12 @@ err_put: return ret; } -static int mip_of_msi_init(struct device_node *node, struct device_node *parent) +static int mip_msi_probe(struct platform_device *pdev, struct device_node *parent) { - struct platform_device *pdev; + struct device_node *node = pdev->dev.of_node; struct mip_priv *mip; int ret; - pdev = of_find_device_by_node(node); - if (!pdev) - return -EPROBE_DEFER; - mip = kzalloc(sizeof(*mip), GFP_KERNEL); if (!mip) return -ENOMEM; @@ -284,7 +280,7 @@ err_priv: } IRQCHIP_PLATFORM_DRIVER_BEGIN(mip_msi) -IRQCHIP_MATCH("brcm,bcm2712-mip", mip_of_msi_init) +IRQCHIP_MATCH("brcm,bcm2712-mip", mip_msi_probe) IRQCHIP_PLATFORM_DRIVER_END(mip_msi) MODULE_DESCRIPTION("Broadcom BCM2712 MSI-X interrupt controller"); MODULE_AUTHOR("Phil Elwell <phil@raspberrypi.com>"); diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c index eda33bd..821b288 100644 --- a/drivers/irqchip/irq-bcm7038-l1.c +++ b/drivers/irqchip/irq-bcm7038-l1.c @@ -394,8 +394,9 @@ static const struct irq_domain_ops bcm7038_l1_domain_ops = { .map = bcm7038_l1_map, }; -static int bcm7038_l1_of_init(struct device_node *dn, struct device_node *parent) +static int bcm7038_l1_probe(struct platform_device *pdev, struct device_node *parent) { + struct device_node *dn = pdev->dev.of_node; struct bcm7038_l1_chip *intc; int idx, ret; @@ -453,7 +454,7 @@ out_free: } IRQCHIP_PLATFORM_DRIVER_BEGIN(bcm7038_l1) -IRQCHIP_MATCH("brcm,bcm7038-l1-intc", bcm7038_l1_of_init) +IRQCHIP_MATCH("brcm,bcm7038-l1-intc", bcm7038_l1_probe) IRQCHIP_PLATFORM_DRIVER_END(bcm7038_l1) MODULE_DESCRIPTION("Broadcom STB 7038-style L1/L2 interrupt controller"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c index b6c8556..518c9d4 100644 --- a/drivers/irqchip/irq-bcm7120-l2.c +++ b/drivers/irqchip/irq-bcm7120-l2.c @@ -206,14 +206,14 @@ static int bcm7120_l2_intc_iomap_3380(struct device_node *dn, struct bcm7120_l2_ return 0; } -static int bcm7120_l2_intc_probe(struct device_node *dn, struct device_node *parent, +static int bcm7120_l2_intc_probe(struct platform_device *pdev, struct device_node *parent, int (*iomap_regs_fn)(struct device_node *, struct bcm7120_l2_intc_data *), const char *intc_name) { unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; + struct device_node *dn = pdev->dev.of_node; struct bcm7120_l2_intc_data *data; - struct platform_device *pdev; struct irq_chip_generic *gc; struct irq_chip_type *ct; int ret = 0; @@ -224,14 +224,7 @@ static int bcm7120_l2_intc_probe(struct device_node *dn, struct device_node *par if (!data) return -ENOMEM; - pdev = of_find_device_by_node(dn); - if (!pdev) { - ret = -ENODEV; - goto out_free_data; - } - data->num_parent_irqs = platform_irq_count(pdev); - put_device(&pdev->dev); if (data->num_parent_irqs <= 0) { pr_err("invalid number of parent interrupts\n"); ret = -ENOMEM; @@ -331,20 +324,19 @@ out_unmap: if (data->map_base[idx]) iounmap(data->map_base[idx]); } -out_free_data: kfree(data); return ret; } -static int bcm7120_l2_intc_probe_7120(struct device_node *dn, struct device_node *parent) +static int bcm7120_l2_intc_probe_7120(struct platform_device *pdev, struct device_node *parent) { - return bcm7120_l2_intc_probe(dn, parent, bcm7120_l2_intc_iomap_7120, + return bcm7120_l2_intc_probe(pdev, parent, bcm7120_l2_intc_iomap_7120, "BCM7120 L2"); } -static int bcm7120_l2_intc_probe_3380(struct device_node *dn, struct device_node *parent) +static int bcm7120_l2_intc_probe_3380(struct platform_device *pdev, struct device_node *parent) { - return bcm7120_l2_intc_probe(dn, parent, bcm7120_l2_intc_iomap_3380, + return bcm7120_l2_intc_probe(pdev, parent, bcm7120_l2_intc_iomap_3380, "BCM3380 L2"); } diff --git a/drivers/irqchip/irq-brcmstb-l2.c b/drivers/irqchip/irq-brcmstb-l2.c index 53e67c6..bb7078d 100644 --- a/drivers/irqchip/irq-brcmstb-l2.c +++ b/drivers/irqchip/irq-brcmstb-l2.c @@ -138,11 +138,12 @@ static void brcmstb_l2_intc_resume(struct irq_data *d) irq_reg_writel(gc, ~b->saved_mask, ct->regs.enable); } -static int brcmstb_l2_intc_of_init(struct device_node *np, struct device_node *parent, - const struct brcmstb_intc_init_params *init_params) +static int brcmstb_l2_intc_probe(struct platform_device *pdev, struct device_node *parent, + const struct brcmstb_intc_init_params *init_params) { unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; unsigned int set = 0; + struct device_node *np = pdev->dev.of_node; struct brcmstb_l2_intc_data *data; struct irq_chip_type *ct; int ret; @@ -255,21 +256,21 @@ out_free: return ret; } -static int brcmstb_l2_edge_intc_of_init(struct device_node *np, struct device_node *parent) +static int brcmstb_l2_edge_intc_probe(struct platform_device *pdev, struct device_node *parent) { - return brcmstb_l2_intc_of_init(np, parent, &l2_edge_intc_init); + return brcmstb_l2_intc_probe(pdev, parent, &l2_edge_intc_init); } -static int brcmstb_l2_lvl_intc_of_init(struct device_node *np, struct device_node *parent) +static int brcmstb_l2_lvl_intc_probe(struct platform_device *pdev, struct device_node *parent) { - return brcmstb_l2_intc_of_init(np, parent, &l2_lvl_intc_init); + return brcmstb_l2_intc_probe(pdev, parent, &l2_lvl_intc_init); } IRQCHIP_PLATFORM_DRIVER_BEGIN(brcmstb_l2) -IRQCHIP_MATCH("brcm,l2-intc", brcmstb_l2_edge_intc_of_init) -IRQCHIP_MATCH("brcm,hif-spi-l2-intc", brcmstb_l2_edge_intc_of_init) -IRQCHIP_MATCH("brcm,upg-aux-aon-l2-intc", brcmstb_l2_edge_intc_of_init) -IRQCHIP_MATCH("brcm,bcm7271-l2-intc", brcmstb_l2_lvl_intc_of_init) +IRQCHIP_MATCH("brcm,l2-intc", brcmstb_l2_edge_intc_probe) +IRQCHIP_MATCH("brcm,hif-spi-l2-intc", brcmstb_l2_edge_intc_probe) +IRQCHIP_MATCH("brcm,upg-aux-aon-l2-intc", brcmstb_l2_edge_intc_probe) +IRQCHIP_MATCH("brcm,bcm7271-l2-intc", brcmstb_l2_lvl_intc_probe) IRQCHIP_PLATFORM_DRIVER_END(brcmstb_l2) MODULE_DESCRIPTION("Broadcom STB generic L2 interrupt controller"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/irqchip/irq-imx-mu-msi.c b/drivers/irqchip/irq-imx-mu-msi.c index 41df168..c598f2f 100644 --- a/drivers/irqchip/irq-imx-mu-msi.c +++ b/drivers/irqchip/irq-imx-mu-msi.c @@ -296,10 +296,9 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = { }, }; -static int imx_mu_of_init(struct device_node *dn, struct device_node *parent, - const struct imx_mu_dcfg *cfg) +static int imx_mu_probe(struct platform_device *pdev, struct device_node *parent, + const struct imx_mu_dcfg *cfg) { - struct platform_device *pdev = of_find_device_by_node(dn); struct device_link *pd_link_a; struct device_link *pd_link_b; struct imx_mu_msi *msi_data; @@ -415,28 +414,27 @@ static const struct dev_pm_ops imx_mu_pm_ops = { imx_mu_runtime_resume, NULL) }; -static int imx_mu_imx7ulp_of_init(struct device_node *dn, struct device_node *parent) +static int imx_mu_imx7ulp_probe(struct platform_device *pdev, struct device_node *parent) { - return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx7ulp); + return imx_mu_probe(pdev, parent, &imx_mu_cfg_imx7ulp); } -static int imx_mu_imx6sx_of_init(struct device_node *dn, struct device_node *parent) +static int imx_mu_imx6sx_probe(struct platform_device *pdev, struct device_node *parent) { - return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx6sx); + return imx_mu_probe(pdev, parent, &imx_mu_cfg_imx6sx); } -static int imx_mu_imx8ulp_of_init(struct device_node *dn, struct device_node *parent) +static int imx_mu_imx8ulp_probe(struct platform_device *pdev, struct device_node *parent) { - return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx8ulp); + return imx_mu_probe(pdev, parent, &imx_mu_cfg_imx8ulp); } IRQCHIP_PLATFORM_DRIVER_BEGIN(imx_mu_msi) -IRQCHIP_MATCH("fsl,imx7ulp-mu-msi", imx_mu_imx7ulp_of_init) -IRQCHIP_MATCH("fsl,imx6sx-mu-msi", imx_mu_imx6sx_of_init) -IRQCHIP_MATCH("fsl,imx8ulp-mu-msi", imx_mu_imx8ulp_of_init) +IRQCHIP_MATCH("fsl,imx7ulp-mu-msi", imx_mu_imx7ulp_probe) +IRQCHIP_MATCH("fsl,imx6sx-mu-msi", imx_mu_imx6sx_probe) +IRQCHIP_MATCH("fsl,imx8ulp-mu-msi", imx_mu_imx8ulp_probe) IRQCHIP_PLATFORM_DRIVER_END(imx_mu_msi, .pm = &imx_mu_pm_ops) - MODULE_AUTHOR("Frank Li <Frank.Li@nxp.com>"); MODULE_DESCRIPTION("Freescale MU MSI controller driver"); MODULE_LICENSE("GPL"); diff --git a/drivers/irqchip/irq-mchp-eic.c b/drivers/irqchip/irq-mchp-eic.c index 516a3a0..b513a89 100644 --- a/drivers/irqchip/irq-mchp-eic.c +++ b/drivers/irqchip/irq-mchp-eic.c @@ -199,8 +199,9 @@ static const struct irq_domain_ops mchp_eic_domain_ops = { .free = irq_domain_free_irqs_common, }; -static int mchp_eic_init(struct device_node *node, struct device_node *parent) +static int mchp_eic_probe(struct platform_device *pdev, struct device_node *parent) { + struct device_node *node = pdev->dev.of_node; struct irq_domain *parent_domain = NULL; int ret, i; @@ -273,7 +274,7 @@ free: } IRQCHIP_PLATFORM_DRIVER_BEGIN(mchp_eic) -IRQCHIP_MATCH("microchip,sama7g5-eic", mchp_eic_init) +IRQCHIP_MATCH("microchip,sama7g5-eic", mchp_eic_probe) IRQCHIP_PLATFORM_DRIVER_END(mchp_eic) MODULE_DESCRIPTION("Microchip External Interrupt Controller"); diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c index 7d17762..09ebf1d 100644 --- a/drivers/irqchip/irq-meson-gpio.c +++ b/drivers/irqchip/irq-meson-gpio.c @@ -572,8 +572,9 @@ static int meson_gpio_irq_parse_dt(struct device_node *node, struct meson_gpio_i return 0; } -static int meson_gpio_irq_of_init(struct device_node *node, struct device_node *parent) +static int meson_gpio_irq_probe(struct platform_device *pdev, struct device_node *parent) { + struct device_node *node = pdev->dev.of_node; struct irq_domain *domain, *parent_domain; struct meson_gpio_irq_controller *ctl; int ret; @@ -630,7 +631,7 @@ free_ctl: } IRQCHIP_PLATFORM_DRIVER_BEGIN(meson_gpio_intc) -IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_of_init) +IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_probe) IRQCHIP_PLATFORM_DRIVER_END(meson_gpio_intc) MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>"); diff --git a/drivers/irqchip/irq-qcom-mpm.c b/drivers/irqchip/irq-qcom-mpm.c index 8d569f7..83f31ea 100644 --- a/drivers/irqchip/irq-qcom-mpm.c +++ b/drivers/irqchip/irq-qcom-mpm.c @@ -320,9 +320,9 @@ static bool gic_hwirq_is_mapped(struct mpm_gic_map *maps, int cnt, u32 hwirq) return false; } -static int qcom_mpm_init(struct device_node *np, struct device_node *parent) +static int qcom_mpm_probe(struct platform_device *pdev, struct device_node *parent) { - struct platform_device *pdev = of_find_device_by_node(np); + struct device_node *np = pdev->dev.of_node; struct device *dev = &pdev->dev; struct irq_domain *parent_domain; struct generic_pm_domain *genpd; @@ -478,7 +478,7 @@ remove_genpd: } IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_mpm) -IRQCHIP_MATCH("qcom,mpm", qcom_mpm_init) +IRQCHIP_MATCH("qcom,mpm", qcom_mpm_probe) IRQCHIP_PLATFORM_DRIVER_END(qcom_mpm) MODULE_DESCRIPTION("Qualcomm Technologies, Inc. MSM Power Manager"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c index 12b6eb1..1bf19de 100644 --- a/drivers/irqchip/irq-renesas-rzg2l.c +++ b/drivers/irqchip/irq-renesas-rzg2l.c @@ -8,7 +8,6 @@ */ #include <linux/bitfield.h> -#include <linux/cleanup.h> #include <linux/clk.h> #include <linux/err.h> #include <linux/io.h> @@ -528,18 +527,15 @@ static int rzg2l_irqc_parse_interrupts(struct rzg2l_irqc_priv *priv, return 0; } -static int rzg2l_irqc_common_init(struct device_node *node, struct device_node *parent, - const struct irq_chip *irq_chip) +static int rzg2l_irqc_common_probe(struct platform_device *pdev, struct device_node *parent, + const struct irq_chip *irq_chip) { - struct platform_device *pdev = of_find_device_by_node(node); - struct device *dev __free(put_device) = pdev ? &pdev->dev : NULL; struct irq_domain *irq_domain, *parent_domain; + struct device_node *node = pdev->dev.of_node; + struct device *dev = &pdev->dev; struct reset_control *resetn; int ret; - if (!pdev) - return -ENODEV; - parent_domain = irq_find_host(parent); if (!parent_domain) return dev_err_probe(dev, -ENODEV, "cannot find parent domain\n"); @@ -583,33 +579,22 @@ static int rzg2l_irqc_common_init(struct device_node *node, struct device_node * register_syscore_ops(&rzg2l_irqc_syscore_ops); - /* - * Prevent the cleanup function from invoking put_device by assigning - * NULL to dev. - * - * make coccicheck will complain about missing put_device calls, but - * those are false positives, as dev will be automatically "put" via - * __free_put_device on the failing path. - * On the successful path we don't actually want to "put" dev. - */ - dev = NULL; - return 0; } -static int rzg2l_irqc_init(struct device_node *node, struct device_node *parent) +static int rzg2l_irqc_probe(struct platform_device *pdev, struct device_node *parent) { - return rzg2l_irqc_common_init(node, parent, &rzg2l_irqc_chip); + return rzg2l_irqc_common_probe(pdev, parent, &rzg2l_irqc_chip); } -static int rzfive_irqc_init(struct device_node *node, struct device_node *parent) +static int rzfive_irqc_probe(struct platform_device *pdev, struct device_node *parent) { - return rzg2l_irqc_common_init(node, parent, &rzfive_irqc_chip); + return rzg2l_irqc_common_probe(pdev, parent, &rzfive_irqc_chip); } IRQCHIP_PLATFORM_DRIVER_BEGIN(rzg2l_irqc) -IRQCHIP_MATCH("renesas,rzg2l-irqc", rzg2l_irqc_init) -IRQCHIP_MATCH("renesas,r9a07g043f-irqc", rzfive_irqc_init) +IRQCHIP_MATCH("renesas,rzg2l-irqc", rzg2l_irqc_probe) +IRQCHIP_MATCH("renesas,r9a07g043f-irqc", rzfive_irqc_probe) IRQCHIP_PLATFORM_DRIVER_END(rzg2l_irqc) MODULE_AUTHOR("Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>"); MODULE_DESCRIPTION("Renesas RZ/G2L IRQC Driver"); diff --git a/drivers/irqchip/irq-renesas-rzv2h.c b/drivers/irqchip/irq-renesas-rzv2h.c index 9018d9c..899a423 100644 --- a/drivers/irqchip/irq-renesas-rzv2h.c +++ b/drivers/irqchip/irq-renesas-rzv2h.c @@ -490,29 +490,15 @@ static int rzv2h_icu_parse_interrupts(struct rzv2h_icu_priv *priv, struct device return 0; } -static void rzv2h_icu_put_device(void *data) -{ - put_device(data); -} - -static int rzv2h_icu_init_common(struct device_node *node, struct device_node *parent, - const struct rzv2h_hw_info *hw_info) +static int rzv2h_icu_probe_common(struct platform_device *pdev, struct device_node *parent, + const struct rzv2h_hw_info *hw_info) { struct irq_domain *irq_domain, *parent_domain; + struct device_node *node = pdev->dev.of_node; struct rzv2h_icu_priv *rzv2h_icu_data; - struct platform_device *pdev; struct reset_control *resetn; int ret; - pdev = of_find_device_by_node(node); - if (!pdev) - return -ENODEV; - - ret = devm_add_action_or_reset(&pdev->dev, rzv2h_icu_put_device, - &pdev->dev); - if (ret < 0) - return ret; - parent_domain = irq_find_host(parent); if (!parent_domain) { dev_err(&pdev->dev, "cannot find parent domain\n"); @@ -618,19 +604,19 @@ static const struct rzv2h_hw_info rzv2h_hw_params = { .field_width = 8, }; -static int rzg3e_icu_init(struct device_node *node, struct device_node *parent) +static int rzg3e_icu_probe(struct platform_device *pdev, struct device_node *parent) { - return rzv2h_icu_init_common(node, parent, &rzg3e_hw_params); + return rzv2h_icu_probe_common(pdev, parent, &rzg3e_hw_params); } -static int rzv2h_icu_init(struct device_node *node, struct device_node *parent) +static int rzv2h_icu_probe(struct platform_device *pdev, struct device_node *parent) { - return rzv2h_icu_init_common(node, parent, &rzv2h_hw_params); + return rzv2h_icu_probe_common(pdev, parent, &rzv2h_hw_params); } IRQCHIP_PLATFORM_DRIVER_BEGIN(rzv2h_icu) -IRQCHIP_MATCH("renesas,r9a09g047-icu", rzg3e_icu_init) -IRQCHIP_MATCH("renesas,r9a09g057-icu", rzv2h_icu_init) +IRQCHIP_MATCH("renesas,r9a09g047-icu", rzg3e_icu_probe) +IRQCHIP_MATCH("renesas,r9a09g057-icu", rzv2h_icu_probe) IRQCHIP_PLATFORM_DRIVER_END(rzv2h_icu) MODULE_AUTHOR("Fabrizio Castro <fabrizio.castro.jz@renesas.com>"); MODULE_DESCRIPTION("Renesas RZ/V2H(P) ICU Driver"); diff --git a/drivers/irqchip/irq-starfive-jh8100-intc.c b/drivers/irqchip/irq-starfive-jh8100-intc.c index 117f2c6..705361b 100644 --- a/drivers/irqchip/irq-starfive-jh8100-intc.c +++ b/drivers/irqchip/irq-starfive-jh8100-intc.c @@ -114,8 +114,9 @@ static void starfive_intc_irq_handler(struct irq_desc *desc) chained_irq_exit(chip, desc); } -static int starfive_intc_init(struct device_node *intc, struct device_node *parent) +static int starfive_intc_probe(struct platform_device *pdev, struct device_node *parent) { + struct device_node *intc = pdev->dev.of_node; struct starfive_irq_chip *irqc; struct reset_control *rst; struct clk *clk; @@ -198,7 +199,7 @@ err_free: } IRQCHIP_PLATFORM_DRIVER_BEGIN(starfive_intc) -IRQCHIP_MATCH("starfive,jh8100-intc", starfive_intc_init) +IRQCHIP_MATCH("starfive,jh8100-intc", starfive_intc_probe) IRQCHIP_PLATFORM_DRIVER_END(starfive_intc) MODULE_DESCRIPTION("StarFive JH8100 External Interrupt Controller"); diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c index 652d20d..689c8e4 100644 --- a/drivers/irqchip/irqchip.c +++ b/drivers/irqchip/irqchip.c @@ -36,9 +36,9 @@ int platform_irqchip_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct device_node *par_np __free(device_node) = of_irq_find_parent(np); - of_irq_init_cb_t irq_init_cb = of_device_get_match_data(&pdev->dev); + platform_irq_probe_t irq_probe = of_device_get_match_data(&pdev->dev); - if (!irq_init_cb) + if (!irq_probe) return -EINVAL; if (par_np == np) @@ -55,6 +55,6 @@ int platform_irqchip_probe(struct platform_device *pdev) if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY)) return -EPROBE_DEFER; - return irq_init_cb(np, par_np); + return irq_probe(pdev, par_np); } EXPORT_SYMBOL_GPL(platform_irqchip_probe); diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c index 52d7754..518f7f0 100644 --- a/drivers/irqchip/qcom-pdc.c +++ b/drivers/irqchip/qcom-pdc.c @@ -350,9 +350,10 @@ static int pdc_setup_pin_mapping(struct device_node *np) #define QCOM_PDC_SIZE 0x30000 -static int qcom_pdc_init(struct device_node *node, struct device_node *parent) +static int qcom_pdc_probe(struct platform_device *pdev, struct device_node *parent) { struct irq_domain *parent_domain, *pdc_domain; + struct device_node *node = pdev->dev.of_node; resource_size_t res_size; struct resource res; int ret; @@ -428,7 +429,7 @@ fail: } IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc) -IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init) +IRQCHIP_MATCH("qcom,pdc", qcom_pdc_probe) IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc) MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller"); MODULE_LICENSE("GPL v2"); diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h index d5e6024..bc4ddac 100644 --- a/include/linux/irqchip.h +++ b/include/linux/irqchip.h @@ -17,12 +17,18 @@ #include <linux/of_irq.h> #include <linux/platform_device.h> +typedef int (*platform_irq_probe_t)(struct platform_device *, struct device_node *); + /* Undefined on purpose */ extern of_irq_init_cb_t typecheck_irq_init_cb; +extern platform_irq_probe_t typecheck_irq_probe; #define typecheck_irq_init_cb(fn) \ (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn) +#define typecheck_irq_probe(fn) \ + (__typecheck(typecheck_irq_probe, &fn) ? fn : fn) + /* * This macro must be used by the different irqchip drivers to declare * the association between their DT compatible string and their @@ -42,7 +48,7 @@ extern int platform_irqchip_probe(struct platform_device *pdev); static const struct of_device_id drv_name##_irqchip_match_table[] = { #define IRQCHIP_MATCH(compat, fn) { .compatible = compat, \ - .data = typecheck_irq_init_cb(fn), }, + .data = typecheck_irq_probe(fn), }, #define IRQCHIP_PLATFORM_DRIVER_END(drv_name, ...) \ ^ permalink raw reply related [flat|nested] 40+ messages in thread
end of thread, other threads:[~2025-10-16 19:01 UTC | newest] Thread overview: 40+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-10-13 9:46 [PATCH 00/11] irqchip: Pass platform device to platform drivers Johan Hovold 2025-10-13 9:46 ` [PATCH 01/11] irqchip/bcm2712-mip: Fix OF node reference imbalance Johan Hovold 2025-10-13 15:56 ` Florian Fainelli 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 02/11] irqchip/bcm2712-mip: Fix section mismatch Johan Hovold 2025-10-13 15:56 ` Florian Fainelli 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 03/11] irqchip/irq-bcm7038-l1: " Johan Hovold 2025-10-13 15:56 ` Florian Fainelli 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 04/11] irqchip/irq-bcm7120-l2: " Johan Hovold 2025-10-13 15:57 ` Florian Fainelli 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 05/11] irqchip/irq-brcmstb-l2: " Johan Hovold 2025-10-13 15:57 ` Florian Fainelli 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 06/11] irqchip/imx-mu-msi: " Johan Hovold 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 07/11] irqchip/renesas-rzg2l: " Johan Hovold 2025-10-13 13:19 ` Geert Uytterhoeven 2025-10-13 13:27 ` Johan Hovold 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 08/11] irqchip/starfive-jh8100: " Johan Hovold 2025-10-14 1:05 ` 回复: " Changhuang Liang 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 09/11] irqchip/qcom-irq-combiner: " Johan Hovold 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 10/11] irqchip: Drop leftover brackets Johan Hovold 2025-10-13 13:20 ` Geert Uytterhoeven 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-13 9:46 ` [PATCH 11/11] irqchip: Pass platform device to platform drivers Johan Hovold 2025-10-13 17:24 ` Florian Fainelli 2025-10-14 1:11 ` 回复: " Changhuang Liang 2025-10-14 8:52 ` Stanimir Varbanov 2025-10-14 9:04 ` Johan Hovold 2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold 2025-10-16 15:46 ` tip-bot2 for Johan Hovold 2025-10-16 15:56 ` Johan Hovold 2025-10-16 16:19 ` Thomas Gleixner 2025-10-16 19:01 ` tip-bot2 for Johan Hovold
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox