diff mbox series

[2/6] irqchip: Make IRQCHIP_MATCH() type safe

Message ID 20200912125148.1271481-3-maz@kernel.org (mailing list archive)
State New, archived
Headers show
Series irqchip: Hybrid probing | expand

Commit Message

Marc Zyngier Sept. 12, 2020, 12:51 p.m. UTC
IRQCHIP_DECLARE() is backed by macros that perform some elementary
type checking on the probe function. Unfortunately, IRQCHIP_MATCH()
doesn't, risking difficult debugging sessions...

Rewrite IRQCHIP_MATCH() in terms of _OF_DECLARE_ELMT() restore
the missing type safety.

Signed-off-by: Marc Zyngier <maz@kernel.org>
---
 include/linux/irqchip.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bjorn Andersson Sept. 12, 2020, 11:20 p.m. UTC | #1
On Sat 12 Sep 07:51 CDT 2020, Marc Zyngier wrote:

> IRQCHIP_DECLARE() is backed by macros that perform some elementary
> type checking on the probe function. Unfortunately, IRQCHIP_MATCH()
> doesn't, risking difficult debugging sessions...
> 
> Rewrite IRQCHIP_MATCH() in terms of _OF_DECLARE_ELMT() restore
> the missing type safety.
> 

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> Signed-off-by: Marc Zyngier <maz@kernel.org>
> ---
>  include/linux/irqchip.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h
> index 67351aac65ef..f8f25e9f8200 100644
> --- a/include/linux/irqchip.h
> +++ b/include/linux/irqchip.h
> @@ -33,7 +33,7 @@ extern int platform_irqchip_probe(struct platform_device *pdev);
>  #define IRQCHIP_PLATFORM_DRIVER_BEGIN(drv_name) \
>  static const struct of_device_id drv_name##_irqchip_match_table[] = {
>  
> -#define IRQCHIP_MATCH(compat, fn) { .compatible = compat, .data = fn },
> +#define IRQCHIP_MATCH(compat, fn) _OF_DECLARE_ELMT(compat, fn, of_init_fn_2)
>  
>  #define IRQCHIP_PLATFORM_DRIVER_END(drv_name)				\
>  	{},								\
> -- 
> 2.28.0
>
diff mbox series

Patch

diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h
index 67351aac65ef..f8f25e9f8200 100644
--- a/include/linux/irqchip.h
+++ b/include/linux/irqchip.h
@@ -33,7 +33,7 @@  extern int platform_irqchip_probe(struct platform_device *pdev);
 #define IRQCHIP_PLATFORM_DRIVER_BEGIN(drv_name) \
 static const struct of_device_id drv_name##_irqchip_match_table[] = {
 
-#define IRQCHIP_MATCH(compat, fn) { .compatible = compat, .data = fn },
+#define IRQCHIP_MATCH(compat, fn) _OF_DECLARE_ELMT(compat, fn, of_init_fn_2)
 
 #define IRQCHIP_PLATFORM_DRIVER_END(drv_name)				\
 	{},								\