From: Stanimir Varbanov <svarbanov@suse.de>
To: Johan Hovold <johan@kernel.org>, Thomas Gleixner <tglx@linutronix.de>
Cc: Florian Fainelli <florian.fainelli@broadcom.com>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
Neil Armstrong <neil.armstrong@linaro.org>,
Kevin Hilman <khilman@baylibre.com>,
Jerome Brunet <jbrunet@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Changhuang Liang <changhuang.liang@starfivetech.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Magnus Damm <magnus.damm@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 11/11] irqchip: Pass platform device to platform drivers
Date: Tue, 14 Oct 2025 11:52:40 +0300 [thread overview]
Message-ID: <7618ec1b-6e3c-4d29-8435-cc5269bdb9df@suse.de> (raw)
In-Reply-To: <20251013094611.11745-12-johan@kernel.org>
Hi Johan,
On 10/13/25 12:46 PM, Johan Hovold wrote:
> The IRQCHIP_PLATFORM_DRIVER macros can be used to convert OF irqchip
> drivers to platform drivers but currently reuse the OF init callback
> prototype that only takes OF nodes as arguments. This forces drivers to
> do reverse lookups of their struct devices during probe if they need
> them for things like dev_printk() and device managed resources.
>
> Half of the drivers doing reverse lookups also currently fail to release
> the additional reference taken during the lookup, while other drivers
> have had the reference leak plugged in various ways (e.g. using
> non-intuitive cleanup constructs which still confuse static checkers).
>
> Switch to using a probe callback that takes a platform device as its
> first argument to simplify drivers and plug the remaining (mostly
> benign) reference leaks.
>
> Fixes: 32c6c054661a ("irqchip: Add Broadcom BCM2712 MSI-X interrupt controller")
> Fixes: 70afdab904d2 ("irqchip: Add IMX MU MSI controller driver")
> Fixes: a6199bb514d8 ("irqchip: Add Qualcomm MPM controller driver")
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> drivers/irqchip/irq-bcm2712-mip.c | 10 ++-----
> drivers/irqchip/irq-bcm7038-l1.c | 5 ++--
> drivers/irqchip/irq-bcm7120-l2.c | 20 ++++---------
> drivers/irqchip/irq-brcmstb-l2.c | 21 ++++++-------
> drivers/irqchip/irq-imx-mu-msi.c | 25 +++++++---------
> drivers/irqchip/irq-mchp-eic.c | 5 ++--
> drivers/irqchip/irq-meson-gpio.c | 5 ++--
> drivers/irqchip/irq-qcom-mpm.c | 6 ++--
> drivers/irqchip/irq-renesas-rzg2l.c | 35 +++++++---------------
> drivers/irqchip/irq-renesas-rzv2h.c | 32 ++++++--------------
> drivers/irqchip/irq-starfive-jh8100-intc.c | 5 ++--
> drivers/irqchip/irqchip.c | 6 ++--
> drivers/irqchip/qcom-pdc.c | 5 ++--
> include/linux/irqchip.h | 8 ++++-
> 14 files changed, 78 insertions(+), 110 deletions(-)
>
<snip>
>
> IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc)
> -IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init)
> +IRQCHIP_MATCH("qcom,pdc", qcom_pdc_probe)
> IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc)
> MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller");
> MODULE_LICENSE("GPL v2");
> diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h
> index d5e6024cb2a8..bc4ddacd6ddc 100644
> --- a/include/linux/irqchip.h
> +++ b/include/linux/irqchip.h
> @@ -17,12 +17,18 @@
> #include <linux/of_irq.h>
> #include <linux/platform_device.h>
>
> +typedef int (*platform_irq_probe_t)(struct platform_device *, struct device_node *);
> +
> /* Undefined on purpose */
> extern of_irq_init_cb_t typecheck_irq_init_cb;
This is not used anymore?
> +extern platform_irq_probe_t typecheck_irq_probe;
>
> #define typecheck_irq_init_cb(fn) \
> (__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
ditto
~Stan
>
> +#define typecheck_irq_probe(fn) \
> + (__typecheck(typecheck_irq_probe, &fn) ? fn : fn)
> +
> /*
> * This macro must be used by the different irqchip drivers to declare
> * the association between their DT compatible string and their
> @@ -42,7 +48,7 @@ extern int platform_irqchip_probe(struct platform_device *pdev);
> static const struct of_device_id drv_name##_irqchip_match_table[] = {
>
> #define IRQCHIP_MATCH(compat, fn) { .compatible = compat, \
> - .data = typecheck_irq_init_cb(fn), },
> + .data = typecheck_irq_probe(fn), },
>
>
> #define IRQCHIP_PLATFORM_DRIVER_END(drv_name, ...) \
next prev parent reply other threads:[~2025-10-14 8:52 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-13 9:46 [PATCH 00/11] " Johan Hovold
2025-10-13 9:46 ` [PATCH 01/11] irqchip/bcm2712-mip: Fix OF node reference imbalance Johan Hovold
2025-10-13 15:56 ` Florian Fainelli
2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold
2025-10-13 9:46 ` [PATCH 02/11] irqchip/bcm2712-mip: Fix section mismatch Johan Hovold
2025-10-13 15:56 ` Florian Fainelli
2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold
2025-10-13 9:46 ` [PATCH 03/11] irqchip/irq-bcm7038-l1: " Johan Hovold
2025-10-13 15:56 ` Florian Fainelli
2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold
2025-10-13 9:46 ` [PATCH 04/11] irqchip/irq-bcm7120-l2: " Johan Hovold
2025-10-13 15:57 ` Florian Fainelli
2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold
2025-10-13 9:46 ` [PATCH 05/11] irqchip/irq-brcmstb-l2: " Johan Hovold
2025-10-13 15:57 ` Florian Fainelli
2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold
2025-10-13 9:46 ` [PATCH 06/11] irqchip/imx-mu-msi: " Johan Hovold
2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold
2025-10-13 9:46 ` [PATCH 07/11] irqchip/renesas-rzg2l: " Johan Hovold
2025-10-13 13:19 ` Geert Uytterhoeven
2025-10-13 13:27 ` Johan Hovold
2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold
2025-10-13 9:46 ` [PATCH 08/11] irqchip/starfive-jh8100: " Johan Hovold
2025-10-14 1:05 ` 回复: " Changhuang Liang
2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold
2025-10-13 9:46 ` [PATCH 09/11] irqchip/qcom-irq-combiner: " Johan Hovold
2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold
2025-10-13 9:46 ` [PATCH 10/11] irqchip: Drop leftover brackets Johan Hovold
2025-10-13 13:20 ` Geert Uytterhoeven
2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold
2025-10-13 9:46 ` [PATCH 11/11] irqchip: Pass platform device to platform drivers Johan Hovold
2025-10-13 17:24 ` Florian Fainelli
2025-10-14 1:11 ` 回复: " Changhuang Liang
2025-10-14 8:52 ` Stanimir Varbanov [this message]
2025-10-14 9:04 ` Johan Hovold
2025-10-16 9:51 ` [tip: irq/drivers] " tip-bot2 for Johan Hovold
2025-10-16 15:46 ` tip-bot2 for Johan Hovold
2025-10-16 15:56 ` Johan Hovold
2025-10-16 16:19 ` Thomas Gleixner
2025-10-16 19:01 ` tip-bot2 for Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7618ec1b-6e3c-4d29-8435-cc5269bdb9df@suse.de \
--to=svarbanov@suse.de \
--cc=changhuang.liang@starfivetech.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=festevam@gmail.com \
--cc=florian.fainelli@broadcom.com \
--cc=geert+renesas@glider.be \
--cc=jbrunet@baylibre.com \
--cc=johan@kernel.org \
--cc=khilman@baylibre.com \
--cc=linux-kernel@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=neil.armstrong@linaro.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®