Re: [PATCH v2 04/25] platform: Add firmware-agnostic irq and affinity retrieval interface

Jonathan Cameron
2025-09-16T15:23:50Z

On Mon, 15 Sep 2025 09:56:41 +0100
Marc Zyngier <maz@kernel.org> wrote:

> Expand platform_get_irq_optional() to also return an affinity if
> available, renaming it to platform_get_irq_affinity() in the
> process.
>
> platform_get_irq_optional() is preserved with its current semantics
> by calling into the new helper with a NULL affinity pointer.
>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> ---
> drivers/base/platform.c | 60 +++++++++++++++++++++++++++------
> include/linux/platform_device.h | 2 ++
> 2 files changed, 52 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 09450349cf323..fad33d6b2349a 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c

> /**
> - * platform_get_irq_optional - get an optional IRQ for a device
> + * platform_get_irq_affinity - get an optional IRQ and its affnity for a device

affinity

> * @dev: platform device
> * @num: IRQ number index
> + * @affinity: optional cpumask pointer to get the affinity of a per-cpu IRQ
> *

> diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
> index 074754c23d330..ad66333ce85ce 100644
> --- a/include/linux/platform_device.h
> +++ b/include/linux/platform_device.h
> @@ -102,6 +102,8 @@ devm_platform_ioremap_resource_byname(struct platform_device *pdev,
>
> extern int platform_get_irq(struct platform_device *, unsigned int);
> extern int platform_get_irq_optional(struct platform_device *, unsigned int);
> +extern int platform_get_irq_affinity(struct platform_device *, unsigned int,
> + const struct cpumask **);
> extern int platform_irq_count(struct platform_device *);
> extern int devm_platform_get_irqs_affinity(struct platform_device *dev,
> struct irq_affinity *affd,