]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
irqchip: Pass platform device to platform drivers
authorJohan Hovold <johan@kernel.org>
Mon, 13 Oct 2025 09:46:11 +0000 (11:46 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 16 Oct 2025 16:17:27 +0000 (18:17 +0200)
The IRQCHIP_PLATFORM_DRIVER macros can be used to convert OF irqchip
drivers to platform drivers but currently reuse the OF init callback
prototype that only takes OF nodes as arguments. This forces drivers to
do reverse lookups of their struct devices during probe if they need
them for things like dev_printk() and device managed resources.

Half of the drivers doing reverse lookups also currently fail to release
the additional reference taken during the lookup, while other drivers
have had the reference leak plugged in various ways (e.g. using
non-intuitive cleanup constructs which still confuse static checkers).

Switch to using a probe callback that takes a platform device as its
first argument to simplify drivers and plug the remaining (mostly
benign) reference leaks.

Fixes: 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interrupt controller")
Fixes: 70afdab904d2 ("irqchip: Add IMX MU MSI controller driver")
Fixes: a6199bb514d8 ("irqchip: Add Qualcomm MPM controller driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Changhuang Liang <changhuang.liang@starfivetech.com>
14 files changed:
drivers/irqchip/irq-bcm2712-mip.c
drivers/irqchip/irq-bcm7038-l1.c
drivers/irqchip/irq-bcm7120-l2.c
drivers/irqchip/irq-brcmstb-l2.c
drivers/irqchip/irq-imx-mu-msi.c
drivers/irqchip/irq-mchp-eic.c
drivers/irqchip/irq-meson-gpio.c
drivers/irqchip/irq-qcom-mpm.c
drivers/irqchip/irq-renesas-rzg2l.c
drivers/irqchip/irq-renesas-rzv2h.c
drivers/irqchip/irq-starfive-jh8100-intc.c
drivers/irqchip/irqchip.c
drivers/irqchip/qcom-pdc.c
include/linux/irqchip.h

index 8466646e5a2da0119e8dc449f06fb88f683ea4be..4761974ad650a9e2d086b7399e2c098d1acad1ab 100644 (file)
@@ -232,16 +232,12 @@ err_put:
        return ret;
 }
 
-static int mip_of_msi_init(struct device_node *node, struct device_node *parent)
+static int mip_msi_probe(struct platform_device *pdev, struct device_node *parent)
 {
-       struct platform_device *pdev;
+       struct device_node *node = pdev->dev.of_node;
        struct mip_priv *mip;
        int ret;
 
-       pdev = of_find_device_by_node(node);
-       if (!pdev)
-               return -EPROBE_DEFER;
-
        mip = kzalloc(sizeof(*mip), GFP_KERNEL);
        if (!mip)
                return -ENOMEM;
@@ -284,7 +280,7 @@ err_priv:
 }
 
 IRQCHIP_PLATFORM_DRIVER_BEGIN(mip_msi)
-IRQCHIP_MATCH("brcm,bcm2712-mip", mip_of_msi_init)
+IRQCHIP_MATCH("brcm,bcm2712-mip", mip_msi_probe)
 IRQCHIP_PLATFORM_DRIVER_END(mip_msi)
 MODULE_DESCRIPTION("Broadcom BCM2712 MSI-X interrupt controller");
 MODULE_AUTHOR("Phil Elwell <phil@raspberrypi.com>");
index eda33bd5d080c3c9f8bd43e3f1b42760ee3b9955..821b288587cab40145273bd0135e14fbff84ec5b 100644 (file)
@@ -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");
index b6c85560c42eac16bfde8164ea679c0c29fb9563..518c9d4366a55a58eea458d270286f739cf4583c 100644 (file)
@@ -206,14 +206,14 @@ static int bcm7120_l2_intc_iomap_3380(struct device_node *dn, struct bcm7120_l2_
        return 0;
 }
 
-static int bcm7120_l2_intc_probe(struct device_node *dn, struct device_node *parent,
+static int bcm7120_l2_intc_probe(struct platform_device *pdev, struct device_node *parent,
                                 int (*iomap_regs_fn)(struct device_node *,
                                                      struct bcm7120_l2_intc_data *),
                                 const char *intc_name)
 {
        unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
+       struct device_node *dn = pdev->dev.of_node;
        struct bcm7120_l2_intc_data *data;
-       struct platform_device *pdev;
        struct irq_chip_generic *gc;
        struct irq_chip_type *ct;
        int ret = 0;
@@ -224,14 +224,7 @@ static int bcm7120_l2_intc_probe(struct device_node *dn, struct device_node *par
        if (!data)
                return -ENOMEM;
 
-       pdev = of_find_device_by_node(dn);
-       if (!pdev) {
-               ret = -ENODEV;
-               goto out_free_data;
-       }
-
        data->num_parent_irqs = platform_irq_count(pdev);
-       put_device(&pdev->dev);
        if (data->num_parent_irqs <= 0) {
                pr_err("invalid number of parent interrupts\n");
                ret = -ENOMEM;
@@ -331,20 +324,19 @@ out_unmap:
                if (data->map_base[idx])
                        iounmap(data->map_base[idx]);
        }
-out_free_data:
        kfree(data);
        return ret;
 }
 
-static int bcm7120_l2_intc_probe_7120(struct device_node *dn, struct device_node *parent)
+static int bcm7120_l2_intc_probe_7120(struct platform_device *pdev, struct device_node *parent)
 {
-       return bcm7120_l2_intc_probe(dn, parent, bcm7120_l2_intc_iomap_7120,
+       return bcm7120_l2_intc_probe(pdev, parent, bcm7120_l2_intc_iomap_7120,
                                     "BCM7120 L2");
 }
 
-static int bcm7120_l2_intc_probe_3380(struct device_node *dn, struct device_node *parent)
+static int bcm7120_l2_intc_probe_3380(struct platform_device *pdev, struct device_node *parent)
 {
-       return bcm7120_l2_intc_probe(dn, parent, bcm7120_l2_intc_iomap_3380,
+       return bcm7120_l2_intc_probe(pdev, parent, bcm7120_l2_intc_iomap_3380,
                                     "BCM3380 L2");
 }
 
index 53e67c6c01f7a7b274d501ee2791c6f193a6286f..bb7078d6524f9b5769c3281cb9d27505003fee36 100644 (file)
@@ -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");
index 41df168aa7da2e09c649b2acceee3f1408d40e2c..c598f2f52fc6f3413cb104e6841d8225723dd994 100644 (file)
@@ -296,10 +296,9 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = {
                  },
 };
 
-static int imx_mu_of_init(struct device_node *dn, struct device_node *parent,
-                         const struct imx_mu_dcfg *cfg)
+static int imx_mu_probe(struct platform_device *pdev, struct device_node *parent,
+                       const struct imx_mu_dcfg *cfg)
 {
-       struct platform_device *pdev = of_find_device_by_node(dn);
        struct device_link *pd_link_a;
        struct device_link *pd_link_b;
        struct imx_mu_msi *msi_data;
@@ -415,28 +414,27 @@ static const struct dev_pm_ops imx_mu_pm_ops = {
                           imx_mu_runtime_resume, NULL)
 };
 
-static int imx_mu_imx7ulp_of_init(struct device_node *dn, struct device_node *parent)
+static int imx_mu_imx7ulp_probe(struct platform_device *pdev, struct device_node *parent)
 {
-       return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx7ulp);
+       return imx_mu_probe(pdev, parent, &imx_mu_cfg_imx7ulp);
 }
 
-static int imx_mu_imx6sx_of_init(struct device_node *dn, struct device_node *parent)
+static int imx_mu_imx6sx_probe(struct platform_device *pdev, struct device_node *parent)
 {
-       return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx6sx);
+       return imx_mu_probe(pdev, parent, &imx_mu_cfg_imx6sx);
 }
 
-static int imx_mu_imx8ulp_of_init(struct device_node *dn, struct device_node *parent)
+static int imx_mu_imx8ulp_probe(struct platform_device *pdev, struct device_node *parent)
 {
-       return imx_mu_of_init(dn, parent, &imx_mu_cfg_imx8ulp);
+       return imx_mu_probe(pdev, parent, &imx_mu_cfg_imx8ulp);
 }
 
 IRQCHIP_PLATFORM_DRIVER_BEGIN(imx_mu_msi)
-IRQCHIP_MATCH("fsl,imx7ulp-mu-msi", imx_mu_imx7ulp_of_init)
-IRQCHIP_MATCH("fsl,imx6sx-mu-msi", imx_mu_imx6sx_of_init)
-IRQCHIP_MATCH("fsl,imx8ulp-mu-msi", imx_mu_imx8ulp_of_init)
+IRQCHIP_MATCH("fsl,imx7ulp-mu-msi", imx_mu_imx7ulp_probe)
+IRQCHIP_MATCH("fsl,imx6sx-mu-msi", imx_mu_imx6sx_probe)
+IRQCHIP_MATCH("fsl,imx8ulp-mu-msi", imx_mu_imx8ulp_probe)
 IRQCHIP_PLATFORM_DRIVER_END(imx_mu_msi, .pm = &imx_mu_pm_ops)
 
-
 MODULE_AUTHOR("Frank Li <Frank.Li@nxp.com>");
 MODULE_DESCRIPTION("Freescale MU MSI controller driver");
 MODULE_LICENSE("GPL");
index 516a3a0e359cc30cc39d903d6e60c0cf99981778..b513a899c0853739877d765cc7493ddf84d633d9 100644 (file)
@@ -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");
index 7d177626d64ba4514c34f7544fce73eb58a67d12..09ebf1d9c21b0366fce616c85a7ae052c5658747 100644 (file)
@@ -572,8 +572,9 @@ static int meson_gpio_irq_parse_dt(struct device_node *node, struct meson_gpio_i
        return 0;
 }
 
-static int meson_gpio_irq_of_init(struct device_node *node, struct device_node *parent)
+static int meson_gpio_irq_probe(struct platform_device *pdev, struct device_node *parent)
 {
+       struct device_node *node = pdev->dev.of_node;
        struct irq_domain *domain, *parent_domain;
        struct meson_gpio_irq_controller *ctl;
        int ret;
@@ -630,7 +631,7 @@ free_ctl:
 }
 
 IRQCHIP_PLATFORM_DRIVER_BEGIN(meson_gpio_intc)
-IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_of_init)
+IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_probe)
 IRQCHIP_PLATFORM_DRIVER_END(meson_gpio_intc)
 
 MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
index 8d569f7c5a7aaa25e71e84dd69ba9face964566d..83f31ea657b74a77ab58b3e85d75056ecb790483 100644 (file)
@@ -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");
index 12b6eb1503016e7a4756a794e216ab967d1dd8ea..1bf19deb02c4e936a99ed09474ed5a90014f462c 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #include <linux/bitfield.h>
-#include <linux/cleanup.h>
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/io.h>
@@ -528,18 +527,15 @@ static int rzg2l_irqc_parse_interrupts(struct rzg2l_irqc_priv *priv,
        return 0;
 }
 
-static int rzg2l_irqc_common_init(struct device_node *node, struct device_node *parent,
-                                 const struct irq_chip *irq_chip)
+static int rzg2l_irqc_common_probe(struct platform_device *pdev, struct device_node *parent,
+                                  const struct irq_chip *irq_chip)
 {
-       struct platform_device *pdev = of_find_device_by_node(node);
-       struct device *dev __free(put_device) = pdev ? &pdev->dev : NULL;
        struct irq_domain *irq_domain, *parent_domain;
+       struct device_node *node = pdev->dev.of_node;
+       struct device *dev = &pdev->dev;
        struct reset_control *resetn;
        int ret;
 
-       if (!pdev)
-               return -ENODEV;
-
        parent_domain = irq_find_host(parent);
        if (!parent_domain)
                return dev_err_probe(dev, -ENODEV, "cannot find parent domain\n");
@@ -583,33 +579,22 @@ static int rzg2l_irqc_common_init(struct device_node *node, struct device_node *
 
        register_syscore_ops(&rzg2l_irqc_syscore_ops);
 
-       /*
-        * Prevent the cleanup function from invoking put_device by assigning
-        * NULL to dev.
-        *
-        * make coccicheck will complain about missing put_device calls, but
-        * those are false positives, as dev will be automatically "put" via
-        * __free_put_device on the failing path.
-        * On the successful path we don't actually want to "put" dev.
-        */
-       dev = NULL;
-
        return 0;
 }
 
-static int rzg2l_irqc_init(struct device_node *node, struct device_node *parent)
+static int rzg2l_irqc_probe(struct platform_device *pdev, struct device_node *parent)
 {
-       return rzg2l_irqc_common_init(node, parent, &rzg2l_irqc_chip);
+       return rzg2l_irqc_common_probe(pdev, parent, &rzg2l_irqc_chip);
 }
 
-static int rzfive_irqc_init(struct device_node *node, struct device_node *parent)
+static int rzfive_irqc_probe(struct platform_device *pdev, struct device_node *parent)
 {
-       return rzg2l_irqc_common_init(node, parent, &rzfive_irqc_chip);
+       return rzg2l_irqc_common_probe(pdev, parent, &rzfive_irqc_chip);
 }
 
 IRQCHIP_PLATFORM_DRIVER_BEGIN(rzg2l_irqc)
-IRQCHIP_MATCH("renesas,rzg2l-irqc", rzg2l_irqc_init)
-IRQCHIP_MATCH("renesas,r9a07g043f-irqc", rzfive_irqc_init)
+IRQCHIP_MATCH("renesas,rzg2l-irqc", rzg2l_irqc_probe)
+IRQCHIP_MATCH("renesas,r9a07g043f-irqc", rzfive_irqc_probe)
 IRQCHIP_PLATFORM_DRIVER_END(rzg2l_irqc)
 MODULE_AUTHOR("Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>");
 MODULE_DESCRIPTION("Renesas RZ/G2L IRQC Driver");
index 9018d9c3911e3e9522a5f8da55cc98126b67c147..899a423b5da8ff8300d6097273952bcf02e279c1 100644 (file)
@@ -490,29 +490,15 @@ static int rzv2h_icu_parse_interrupts(struct rzv2h_icu_priv *priv, struct device
        return 0;
 }
 
-static void rzv2h_icu_put_device(void *data)
-{
-       put_device(data);
-}
-
-static int rzv2h_icu_init_common(struct device_node *node, struct device_node *parent,
-                                const struct rzv2h_hw_info *hw_info)
+static int rzv2h_icu_probe_common(struct platform_device *pdev, struct device_node *parent,
+                                 const struct rzv2h_hw_info *hw_info)
 {
        struct irq_domain *irq_domain, *parent_domain;
+       struct device_node *node = pdev->dev.of_node;
        struct rzv2h_icu_priv *rzv2h_icu_data;
-       struct platform_device *pdev;
        struct reset_control *resetn;
        int ret;
 
-       pdev = of_find_device_by_node(node);
-       if (!pdev)
-               return -ENODEV;
-
-       ret = devm_add_action_or_reset(&pdev->dev, rzv2h_icu_put_device,
-                                      &pdev->dev);
-       if (ret < 0)
-               return ret;
-
        parent_domain = irq_find_host(parent);
        if (!parent_domain) {
                dev_err(&pdev->dev, "cannot find parent domain\n");
@@ -618,19 +604,19 @@ static const struct rzv2h_hw_info rzv2h_hw_params = {
        .field_width    = 8,
 };
 
-static int rzg3e_icu_init(struct device_node *node, struct device_node *parent)
+static int rzg3e_icu_probe(struct platform_device *pdev, struct device_node *parent)
 {
-       return rzv2h_icu_init_common(node, parent, &rzg3e_hw_params);
+       return rzv2h_icu_probe_common(pdev, parent, &rzg3e_hw_params);
 }
 
-static int rzv2h_icu_init(struct device_node *node, struct device_node *parent)
+static int rzv2h_icu_probe(struct platform_device *pdev, struct device_node *parent)
 {
-       return rzv2h_icu_init_common(node, parent, &rzv2h_hw_params);
+       return rzv2h_icu_probe_common(pdev, parent, &rzv2h_hw_params);
 }
 
 IRQCHIP_PLATFORM_DRIVER_BEGIN(rzv2h_icu)
-IRQCHIP_MATCH("renesas,r9a09g047-icu", rzg3e_icu_init)
-IRQCHIP_MATCH("renesas,r9a09g057-icu", rzv2h_icu_init)
+IRQCHIP_MATCH("renesas,r9a09g047-icu", rzg3e_icu_probe)
+IRQCHIP_MATCH("renesas,r9a09g057-icu", rzv2h_icu_probe)
 IRQCHIP_PLATFORM_DRIVER_END(rzv2h_icu)
 MODULE_AUTHOR("Fabrizio Castro <fabrizio.castro.jz@renesas.com>");
 MODULE_DESCRIPTION("Renesas RZ/V2H(P) ICU Driver");
index 117f2c651ebd00e9c4585f88f3c196b5150fde48..705361b4ebe07d8972e0b8b37c4ddbb01b602b93 100644 (file)
@@ -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");
index 652d20d2b07f182b383001467a3b650dfd903faf..689c8e44890192a92e21cb91ddd8bddaf542227a 100644 (file)
@@ -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);
index 52d77546aacb9526a8856c9338965bd4ee7e63b7..518f7f0f3dab573d7289f261eebd25c04b4fedac 100644 (file)
@@ -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");
index d5e6024cb2a8c11763e191aa1457d02d7cc554e6..bc4ddacd6ddc17023c1e11b1a3a015290023daed 100644 (file)
 #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, ...)                     \