irqchip: Pass platform device to platform drivers
Subsystems (8)
cover 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.
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(-)
Signature · 1 line
2.49.1
PATCH 1/11 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.
--- drivers/irqchip/irq-bcm2712-mip.c | 1 - 1 file changed, 1 deletion(-)
drivers/irqchip/irq-bcm2712-mip.c +0 -1
@@ -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 ;
Signature · 1 line
2.49.1
Re: [PATCH 01/11] irqchip/bcm2712-mip: Fix OF node reference imbalance
Quoted 10 lines · Johan Hovold
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 <[email protected]>Signed-off-by Johan Hovold <[email protected]>
Signature · 1 line
Florian
[tip: irq/drivers] irqchip/bcm2712-mip: Fix OF node reference imbalance
In reply to Johan HovoldThe following commit has been merged into the irq/drivers branch of tip:
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 <[email protected]> AuthorDate: Mon, 13 Oct 2025 11:46:01 +02:00 Committer: Thomas Gleixner <[email protected]> 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.
--- drivers/irqchip/irq-bcm2712-mip.c | 1 - 1 file changed, 1 deletion(-)
drivers/irqchip/irq-bcm2712-mip.c +0 -1
@@ -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 ;
PATCH 2/11 irqchip/bcm2712-mip: Fix section mismatch
In reply to Johan HovoldPlatform drivers can be probed after their init sections have been discarded so the irqchip init callback must not live in init.
--- drivers/irqchip/irq-bcm2712-mip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-bcm2712-mip.c +1 -1
@@ -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;
Signature · 1 line
2.49.1
Re: [PATCH 02/11] irqchip/bcm2712-mip: Fix section mismatch
Quoted 6 lines · 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 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interrupt controller")Cc Stanimir Varbanov <[email protected]>Signed-off-by Johan Hovold <[email protected]>
Signature · 1 line
Florian
[tip: irq/drivers] irqchip/bcm2712-mip: Fix section mismatch
In reply to Johan HovoldThe following commit has been merged into the irq/drivers branch of tip:
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 <[email protected]> AuthorDate: Mon, 13 Oct 2025 11:46:02 +02:00 Committer: Thomas Gleixner <[email protected]> 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.
--- drivers/irqchip/irq-bcm2712-mip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-bcm2712-mip.c +1 -1
@@ -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;
PATCH 3/11 irqchip/irq-bcm7038-l1: Fix section mismatch
In reply to Johan HovoldPlatform drivers can be probed after their init sections have been discarded so the irqchip init callback must not live in init.
--- drivers/irqchip/irq-bcm7038-l1.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/irqchip/irq-bcm7038-l1.c +4 -5
@@ -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;
Signature · 1 line
2.49.1
Re: [PATCH 03/11] irqchip/irq-bcm7038-l1: Fix section mismatch
Quoted 6 lines · 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 c057c799e379 ("irqchip/irq-bcm7038-l1: Switch to IRQCHIP_PLATFORM_DRIVER")Cc Florian Fainelli <[email protected]>Signed-off-by Johan Hovold <[email protected]>
Signature · 1 line
Florian
[tip: irq/drivers] irqchip/irq-bcm7038-l1: Fix section mismatch
In reply to Johan HovoldThe following commit has been merged into the irq/drivers branch of tip:
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 <[email protected]> AuthorDate: Mon, 13 Oct 2025 11:46:03 +02:00 Committer: Thomas Gleixner <[email protected]> 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.
--- drivers/irqchip/irq-bcm7038-l1.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/irqchip/irq-bcm7038-l1.c +3 -5
@@ -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;
PATCH 4/11 irqchip/irq-bcm7120-l2: Fix section mismatch
In reply to Johan HovoldPlatform drivers can be probed after their init sections have been discarded so the irqchip init callbacks must not live in init.
--- drivers/irqchip/irq-bcm7120-l2.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/irqchip/irq-bcm7120-l2.c +5 -9
@@ -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" );
Signature · 1 line
2.49.1
Re: [PATCH 04/11] irqchip/irq-bcm7120-l2: Fix section mismatch
Quoted 6 lines · Johan Hovold
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 <[email protected]>Signed-off-by Johan Hovold <[email protected]>
Signature · 1 line
Florian
[tip: irq/drivers] irqchip/irq-bcm7120-l2: Fix section mismatch
In reply to Johan HovoldThe following commit has been merged into the irq/drivers branch of tip:
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 <[email protected]> AuthorDate: Mon, 13 Oct 2025 11:46:04 +02:00 Committer: Thomas Gleixner <[email protected]> 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.
--- drivers/irqchip/irq-bcm7120-l2.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/irqchip/irq-bcm7120-l2.c +6 -11
@@ -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" );
PATCH 5/11 irqchip/irq-brcmstb-l2: Fix section mismatch
In reply to Johan HovoldPlatform drivers can be probed after their init sections have been discarded so the irqchip init callbacks must not live in init.
--- drivers/irqchip/irq-brcmstb-l2.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/irqchip/irq-brcmstb-l2.c +4 -8
@@ -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); }
Signature · 1 line
2.49.1
Re: [PATCH 05/11] irqchip/irq-brcmstb-l2: Fix section mismatch
Quoted 6 lines · Johan Hovold
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 <[email protected]>Signed-off-by Johan Hovold <[email protected]>
Signature · 1 line
Florian
[tip: irq/drivers] irqchip/irq-brcmstb-l2: Fix section mismatch
In reply to Johan HovoldThe following commit has been merged into the irq/drivers branch of tip:
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 <[email protected]> AuthorDate: Mon, 13 Oct 2025 11:46:05 +02:00 Committer: Thomas Gleixner <[email protected]> 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.
--- drivers/irqchip/irq-brcmstb-l2.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/irqchip/irq-brcmstb-l2.c +4 -8
@@ -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); }
PATCH 6/11 irqchip/imx-mu-msi: Fix section mismatch
In reply to Johan HovoldPlatform drivers can be probed after their init sections have been discarded so the irqchip init callbacks must not live in init.
--- drivers/irqchip/irq-imx-mu-msi.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/irqchip/irq-imx-mu-msi.c +6 -9
@@ -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); }
Signature · 1 line
2.49.1
[tip: irq/drivers] irqchip/imx-mu-msi: Fix section mismatch
The following commit has been merged into the irq/drivers branch of tip:
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 <[email protected]> AuthorDate: Mon, 13 Oct 2025 11:46:06 +02:00 Committer: Thomas Gleixner <[email protected]> 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.
--- drivers/irqchip/irq-imx-mu-msi.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/irqchip/irq-imx-mu-msi.c +5 -9
@@ -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); }
PATCH 7/11 irqchip/renesas-rzg2l: Fix section mismatch
In reply to Johan HovoldPlatform drivers can be probed after their init sections have been discarded so the irqchip init callbacks must not live in init.
--- drivers/irqchip/irq-renesas-rzg2l.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/irqchip/irq-renesas-rzg2l.c +2 -4
@@ -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); }
Signature · 1 line
2.49.1
Re: [PATCH 07/11] irqchip/renesas-rzg2l: Fix section mismatch
Hi Johan,
Quoted 2 lines · Johan Hovold
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!
Quoted 2 lines
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 forRZ/Five SoC")
Quoted 2 lines
Cc Lad Prabhakar <[email protected]>Signed-off-by Johan Hovold <[email protected]>
For the actual change:
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
Re: [PATCH 07/11] irqchip/renesas-rzg2l: Fix section mismatch
Hi Geert,
Quoted 7 lines · Geert Uytterhoeven
Quoted 1 line
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 forRZ/Five SoC")
Indeed, thanks for catching that.
Quoted 5 lines
Quoted 2 lines
Cc Lad Prabhakar <[email protected]>Signed-off-by Johan Hovold <[email protected]>For the actual change:
Reviewed-by Geert Uytterhoeven <[email protected]>
Johan
[tip: irq/drivers] irqchip/renesas-rzg2l: Fix section mismatch
In reply to Johan HovoldThe following commit has been merged into the irq/drivers branch of tip:
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 <[email protected]> AuthorDate: Mon, 13 Oct 2025 11:46:07 +02:00 Committer: Thomas Gleixner <[email protected]> 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.
--- drivers/irqchip/irq-renesas-rzg2l.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/irqchip/irq-renesas-rzg2l.c +2 -4
@@ -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); }
PATCH 8/11 irqchip/starfive-jh8100: Fix section mismatch
In reply to Johan HovoldPlatform drivers can be probed after their init sections have been discarded so the irqchip init callback must not live in init.
--- drivers/irqchip/irq-starfive-jh8100-intc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/irqchip/irq-starfive-jh8100-intc.c +1 -2
@@ -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;
Signature · 1 line
2.49.1
回复: [PATCH 08/11] irqchip/starfive-jh8100: Fix section mismatch
Hi, Johan
Thanks for the patch.
Quoted 6 lines
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 <[email protected]>Signed-off-by Johan Hovold <[email protected]>
Quoted 23 lines
--- drivers/irqchip/irq-starfive-jh8100-intc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/irqchip/irq-starfive-jh8100-intc.c +2
-3@@ -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
[tip: irq/drivers] irqchip/starfive-jh8100: Fix section mismatch
In reply to Johan HovoldThe following commit has been merged into the irq/drivers branch of tip:
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 <[email protected]> AuthorDate: Mon, 13 Oct 2025 11:46:08 +02:00 Committer: Thomas Gleixner <[email protected]> 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.
--- drivers/irqchip/irq-starfive-jh8100-intc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/irqchip/irq-starfive-jh8100-intc.c +1 -2
@@ -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;
PATCH 9/11 irqchip/qcom-irq-combiner: Fix section mismatch
In reply to Johan HovoldPlatform drivers can be probed after their init sections have been discarded so the probe callback must not live in init.
--- drivers/irqchip/qcom-irq-combiner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/qcom-irq-combiner.c +1 -1
@@ -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;
Signature · 1 line
2.49.1
[tip: irq/drivers] irqchip/qcom-irq-combiner: Fix section mismatch
The following commit has been merged into the irq/drivers branch of tip:
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 <[email protected]> AuthorDate: Mon, 13 Oct 2025 11:46:09 +02:00 Committer: Thomas Gleixner <[email protected]> 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.
--- drivers/irqchip/qcom-irq-combiner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/qcom-irq-combiner.c +1 -1
@@ -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;
PATCH 10/11 irqchip: Drop leftover brackets
In reply to Johan HovoldDrop some unnecessary brackets in platform_irqchip_probe() mistakenly left by commit 9322d1915f9d ("irqchip: Plug a OF node reference leak in platform_irqchip_probe()").
--- drivers/irqchip/irqchip.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/irqchip/irqchip.c +2 -4
@@ -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); }
Signature · 1 line
2.49.1
Re: [PATCH 10/11] irqchip: Drop leftover brackets
Quoted 5 lines · Johan Hovold
Drop some unnecessary brackets in
platform_irqchip_probe()mistakenly left by commit9322d1915f9d("irqchip: Plug a OF node reference leak inplatform_irqchip_probe()").Signed-off-by Johan Hovold <[email protected]>
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
[tip: irq/drivers] irqchip: Drop leftover brackets
In reply to Johan HovoldThe following commit has been merged into the irq/drivers branch of tip:
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 <[email protected]> AuthorDate: Mon, 13 Oct 2025 11:46:10 +02:00 Committer: Thomas Gleixner <[email protected]> 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()").
--- drivers/irqchip/irqchip.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/irqchip/irqchip.c +2 -4
@@ -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); }
PATCH 11/11 irqchip: Pass platform device to platform drivers
In reply to Johan HovoldThe 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.
--- 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(-)
drivers/irqchip/irq-bcm2712-mip.c +3 -7
@@ -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 <[email protected]>" );
drivers/irqchip/irq-bcm7038-l1.c +3 -2
@@ -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" );
drivers/irqchip/irq-bcm7120-l2.c +6 -14
@@ -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" ); }
drivers/irqchip/irq-brcmstb-l2.c +11 -10
@@ -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 *preturn 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" );
drivers/irqchip/irq-imx-mu-msi.c +11 -14
@@ -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 <[email protected]>" );MODULE_DESCRIPTION ("Freescale MU MSI controller driver" );MODULE_LICENSE ("GPL" );
drivers/irqchip/irq-mchp-eic.c +3 -2
@@ -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");
drivers/irqchip/irq-meson-gpio.c +3 -2
@@ -572,8 +572,9 @@ static int meson_gpio_irq_parse_dt(struct device_node *node, struct meson_gpio_ireturn 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 <[email protected]>");
drivers/irqchip/irq-qcom-mpm.c +3 -3
@@ -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" );
drivers/irqchip/irq-renesas-rzg2l.c +10 -25
@@ -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 <[email protected]>");MODULE_DESCRIPTION ("Renesas RZ/G2L IRQC Driver" );
drivers/irqchip/irq-renesas-rzv2h.c +9 -23
@@ -490,29 +490,15 @@ static int rzv2h_icu_parse_interrupts(struct rzv2h_icu_priv *priv, struct devicereturn 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 <[email protected]>");MODULE_DESCRIPTION ("Renesas RZ/V2H(P) ICU Driver" );
drivers/irqchip/irq-starfive-jh8100-intc.c +3 -2
@@ -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");
drivers/irqchip/irqchip.c +3 -3
@@ -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);
drivers/irqchip/qcom-pdc.c +3 -2
@@ -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" );
include/linux/irqchip.h +7 -1
@@ -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, ...) \
Signature · 1 line
2.49.1
Quoted 11 lines · Johan Hovold
The
IRQCHIP_PLATFORM_DRIVERmacros 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 likedev_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).
Quoted 8 lines
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 <[email protected]>
Signature · 1 line
Florian
Hi, Johan
Thanks for the patch.
Quoted 15 lines
The
IRQCHIP_PLATFORM_DRIVERmacros 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 likedev_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.
Quoted 5 lines
Fixes 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interruptcontroller")
Fixes 70afdab904d2 ("irqchip: Add IMX MU MSI controller driver")Fixes a6199bb514d8 ("irqchip: Add Qualcomm MPM controller driver")Signed-off-by Johan Hovold <[email protected]>
Hi Johan,
Quoted 36 lines · Johan Hovold
The
IRQCHIP_PLATFORM_DRIVERmacros 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 likedev_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 <[email protected]>--- 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>
Quoted 12 lines
IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc)drivers/irqchip/qcom-pdc.c +1
-1-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" );include/linux/irqchip.h +0
-0
include/linux/irqchip.h line 23
Quoted 7 lines
include/linux/irqchip.h +2
-0@@ -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?
include/linux/irqchip.h line 27
Quoted 4 lines
include/linux/irqchip.h +1
-0+extern platform_irq_probe_t typecheck_irq_probe;#define typecheck_irq_init_cb (fn) \ (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
ditto
~Stan
Quoted 16 lines
include/linux/irqchip.h +4
-1+#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, ...) \
Hi Stan,
Quoted 9 lines · Stanimir Varbanov
include/linux/irqchip.h line 23
Quoted 4 lines · Johan Hovold
include/linux/irqchip.h +2
-0+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?
Quoted 6 lines
include/linux/irqchip.h line 27
Quoted 4 lines
include/linux/irqchip.h +1
-0+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
The following commit has been merged into the irq/drivers branch of tip:
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 <[email protected]> AuthorDate: Mon, 13 Oct 2025 11:46:11 +02:00 Committer: Thomas Gleixner <[email protected]> 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.
--- 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(-)
drivers/irqchip/irq-bcm2712-mip.c +3 -7
@@ -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 <[email protected]>" );
drivers/irqchip/irq-bcm7038-l1.c +3 -2
@@ -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" );
drivers/irqchip/irq-bcm7120-l2.c +6 -14
@@ -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 *parif (!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" ); }
drivers/irqchip/irq-brcmstb-l2.c +11 -10
@@ -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" );
drivers/irqchip/irq-imx-mu-msi.c +10 -12
@@ -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 <[email protected]>" );MODULE_DESCRIPTION ("Freescale MU MSI controller driver" );MODULE_LICENSE ("GPL" );
drivers/irqchip/irq-mchp-eic.c +3 -2
@@ -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");
drivers/irqchip/irq-meson-gpio.c +3 -2
@@ -572,8 +572,9 @@ static int meson_gpio_irq_parse_dt(struct device_node *node, struct meson_gpio_ireturn 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 <[email protected]>");
drivers/irqchip/irq-qcom-mpm.c +3 -3
@@ -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" );
drivers/irqchip/irq-renesas-rzg2l.c +10 -25
@@ -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 <[email protected]>");MODULE_DESCRIPTION ("Renesas RZ/G2L IRQC Driver" );
drivers/irqchip/irq-renesas-rzv2h.c +9 -23
@@ -490,29 +490,15 @@ static int rzv2h_icu_parse_interrupts(struct rzv2h_icu_priv *priv, struct devicereturn 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 <[email protected]>");MODULE_DESCRIPTION ("Renesas RZ/V2H(P) ICU Driver" );
drivers/irqchip/irq-starfive-jh8100-intc.c +3 -2
@@ -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");
drivers/irqchip/irqchip.c +3 -3
@@ -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);
drivers/irqchip/qcom-pdc.c +3 -2
@@ -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" );
include/linux/irqchip.h +7 -1
@@ -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, ...) \
The following commit has been merged into the irq/drivers branch of tip:
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 <[email protected]> AuthorDate: Mon, 13 Oct 2025 11:46:11 +02:00 Committer: Thomas Gleixner <[email protected]> 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.
--- 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(-)
drivers/irqchip/irq-bcm2712-mip.c +3 -7
@@ -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 <[email protected]>" );
drivers/irqchip/irq-bcm7038-l1.c +3 -2
@@ -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" );
drivers/irqchip/irq-bcm7120-l2.c +6 -14
@@ -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 *parif (!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" ); }
drivers/irqchip/irq-brcmstb-l2.c +11 -10
@@ -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" );
drivers/irqchip/irq-imx-mu-msi.c +11 -13
@@ -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 <[email protected]>" );MODULE_DESCRIPTION ("Freescale MU MSI controller driver" );MODULE_LICENSE ("GPL" );
drivers/irqchip/irq-mchp-eic.c +3 -2
@@ -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");
drivers/irqchip/irq-meson-gpio.c +3 -2
@@ -572,8 +572,9 @@ static int meson_gpio_irq_parse_dt(struct device_node *node, struct meson_gpio_ireturn 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 <[email protected]>");
drivers/irqchip/irq-qcom-mpm.c +3 -3
@@ -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" );
drivers/irqchip/irq-renesas-rzg2l.c +10 -25
@@ -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 <[email protected]>");MODULE_DESCRIPTION ("Renesas RZ/G2L IRQC Driver" );
drivers/irqchip/irq-renesas-rzv2h.c +9 -23
@@ -490,29 +490,15 @@ static int rzv2h_icu_parse_interrupts(struct rzv2h_icu_priv *priv, struct devicereturn 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 <[email protected]>");MODULE_DESCRIPTION ("Renesas RZ/V2H(P) ICU Driver" );
drivers/irqchip/irq-starfive-jh8100-intc.c +3 -2
@@ -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");
drivers/irqchip/irqchip.c +3 -3
@@ -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);
drivers/irqchip/qcom-pdc.c +3 -2
@@ -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" );
include/linux/irqchip.h +7 -1
@@ -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, ...) \
Quoted 16 lines · 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 <[email protected]> AuthorDate: Mon, 13 Oct 2025 11:46:11 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Thu, 16 Oct 2025 17:26:34 +02:00irqchip: Pass platform device to platform drivers
drivers/irqchip/irq-imx-mu-msi.c +0
-0
drivers/irqchip/irq-imx-mu-msi.c static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = { · line 300
Quoted 7 lines
drivers/irqchip/irq-imx-mu-msi.c +2
-2@@ -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
Quoted 6 lines · Johan Hovold
Quoted 5 lines · 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:
(quoted diff) +0
-0@@ -296,10 +296,9 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = { }, };
Quoted 7 lines
drivers/irqchip/irq-imx-mu-msi.c static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = { · line 300
Quoted 4 lines
drivers/irqchip/irq-imx-mu-msi.c +2
-2-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....
The following commit has been merged into the irq/drivers branch of tip:
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 <[email protected]> AuthorDate: Mon, 13 Oct 2025 11:46:11 +02:00 Committer: Thomas Gleixner <[email protected]> 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.
--- 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(-)
drivers/irqchip/irq-bcm2712-mip.c +3 -7
@@ -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 <[email protected]>" );
drivers/irqchip/irq-bcm7038-l1.c +3 -2
@@ -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" );
drivers/irqchip/irq-bcm7120-l2.c +6 -14
@@ -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 *parif (!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" ); }
drivers/irqchip/irq-brcmstb-l2.c +11 -10
@@ -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" );
drivers/irqchip/irq-imx-mu-msi.c +11 -13
@@ -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 <[email protected]>" );MODULE_DESCRIPTION ("Freescale MU MSI controller driver" );MODULE_LICENSE ("GPL" );
drivers/irqchip/irq-mchp-eic.c +3 -2
@@ -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");
drivers/irqchip/irq-meson-gpio.c +3 -2
@@ -572,8 +572,9 @@ static int meson_gpio_irq_parse_dt(struct device_node *node, struct meson_gpio_ireturn 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 <[email protected]>");
drivers/irqchip/irq-qcom-mpm.c +3 -3
@@ -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" );
drivers/irqchip/irq-renesas-rzg2l.c +10 -25
@@ -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 <[email protected]>");MODULE_DESCRIPTION ("Renesas RZ/G2L IRQC Driver" );
drivers/irqchip/irq-renesas-rzv2h.c +9 -23
@@ -490,29 +490,15 @@ static int rzv2h_icu_parse_interrupts(struct rzv2h_icu_priv *priv, struct devicereturn 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 <[email protected]>");MODULE_DESCRIPTION ("Renesas RZ/V2H(P) ICU Driver" );
drivers/irqchip/irq-starfive-jh8100-intc.c +3 -2
@@ -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");
drivers/irqchip/irqchip.c +3 -3
@@ -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);
drivers/irqchip/qcom-pdc.c +3 -2
@@ -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" );
include/linux/irqchip.h +7 -1
@@ -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, ...) \