lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7618ec1b-6e3c-4d29-8435-cc5269bdb9df@suse.de>
Date: Tue, 14 Oct 2025 11:52:40 +0300
From: Stanimir Varbanov <svarbanov@...e.de>
To: Johan Hovold <johan@...nel.org>, Thomas Gleixner <tglx@...utronix.de>
Cc: Florian Fainelli <florian.fainelli@...adcom.com>,
 Shawn Guo <shawnguo@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>,
 Fabio Estevam <festevam@...il.com>, Claudiu Beznea
 <claudiu.beznea@...on.dev>, Neil Armstrong <neil.armstrong@...aro.org>,
 Kevin Hilman <khilman@...libre.com>, Jerome Brunet <jbrunet@...libre.com>,
 Martin Blumenstingl <martin.blumenstingl@...glemail.com>,
 Changhuang Liang <changhuang.liang@...rfivetech.com>,
 Geert Uytterhoeven <geert+renesas@...der.be>,
 Magnus Damm <magnus.damm@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 11/11] irqchip: Pass platform device to platform drivers

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@...nel.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, ...)			\


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ