irqchip/renesas-rzv2h: Cleanups
cover irqchip/renesas-rzv2h: Cleanups
Hi all,
This patch series contains some cleanups for the RZ/V2H interrupt controller driver. It has been compile-tested only.
Thanks for your comments!
Geert Uytterhoeven (3):
irqchip/renesas-rzv2h: Kill swint_idx[]
irqchip/renesas-rzv2h: Kill swint_names[]
irqchip/renesas-rzv2h: Kill icu_err string
drivers/irqchip/irq-renesas-rzv2h.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-)
Signature · 12 lines
2.43.0
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus TorvaldsPATCH 1/3 irqchip/renesas-rzv2h: Kill swint_idx[]
The array swint_idx[] just contains an identity mapping. Replace it by using the index directly, to simplify the code.
--- drivers/irqchip/irq-renesas-rzv2h.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/irqchip/irq-renesas-rzv2h.c +2 -3
@@ -745,7 +745,7 @@ static irqreturn_t rzv2h_icu_error_irq(int irq, void *data)static irqreturn_t rzv2h_icu_swint_irq (int irq,void *data) { -u8 cpu = *(u8 *)data; +unsigned int cpu = (uintptr_t )data;pr_info ("SWINT interrupt for CA55 core %u\n" , cpu);return IRQ_HANDLED ;
@@ -760,7 +760,6 @@ static int rzv2h_icu_setup_irqs(struct platform_device *pdev, struct irq_domain "int-ca55-2", "int-ca55-3", };static const char *icu_err ="icu-error-ca55" ; -static const u8 swint_idx[] = {0 ,1 ,2 ,3 };void __iomem *base = rzv2h_icu_data->base;struct device *dev = &pdev->dev;struct irq_fwspec fwspec;
@@ -780,7 +779,7 @@ static int rzv2h_icu_setup_irqs(struct platform_device *pdev, struct irq_domain } ret =devm_request_irq (dev, virq, rzv2h_icu_swint_irq,0 ,dev_name (dev), - (void *)&swint_idx[i]); + (void *)(uintptr_t )i);if (ret) {return dev_err_probe (dev, ret,"Failed to request %s IRQ\n" , rzv2h_swint_names[i]);
Signature · 1 line
2.43.0
RE: [PATCH 1/3] irqchip/renesas-rzv2h: Kill swint_idx[]
Hi Geert,
Thanks for the patch.
Quoted 9 lines
-----Original Message-----
From: Geert Uytterhoeven <[email protected]>
Sent: 03 April 2026 09:48
Subject: [PATCH 1/3] irqchip/renesas-rzv2h: Kill swint_idx[]The array swint_idx[] just contains an identity mapping. Replace it by using the index directly, to simplify the code.
Signed-off-by Geert Uytterhoeven <[email protected]>
Cheers,
Biju
Quoted 35 lines
--- drivers/irqchip/irq-renesas-rzv2h.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/irqchip/irq-renesas-rzv2h.c +2
-4@@ -745,7 +745,7 @@ static irqreturn_t rzv2h_icu_error_irq(int irq, void *data)static irqreturn_t rzv2h_icu_swint_irq (int irq,void *data) { -u8 cpu = *(u8 *)data; +unsigned int cpu = (uintptr_t )data;pr_info ("SWINT interrupt for CA55 core %u\n" , cpu);return IRQ_HANDLED ;@@ -760,7 +760,6 @@ static int rzv2h_icu_setup_irqs(struct platform_device *pdev, struct irq_domain "int-ca55-2", "int-ca55-3", };static const char *icu_err ="icu-error-ca55" ; -static const u8 swint_idx[] = {0 ,1 ,2 ,3 };void __iomem *base = rzv2h_icu_data->base;struct device *dev = &pdev->dev;struct irq_fwspec fwspec;@@ -780,7 +779,7 @@ static int rzv2h_icu_setup_irqs(struct platform_device *pdev, struct irq_domain } ret =devm_request_irq (dev, virq, rzv2h_icu_swint_irq,0 ,dev_name (dev), - (void *)&swint_idx[i]); + (void *)(uintptr_t )i);if (ret) {return dev_err_probe (dev, ret,"Failed to request %s IRQ\n" , rzv2h_swint_names[i]); --2.43.0
PATCH 2/3 irqchip/renesas-rzv2h: Kill swint_names[]
In reply to Geert UytterhoevenThe array swint_names[] just contains expansions of "int-ca55-%u". Replace it by formatting the strings where needed, to improve readability.
Despite the two error messages can no longer be shared with the ICU error cases, this reduces generated code size by 56 bytes.
---
--- drivers/irqchip/irq-renesas-rzv2h.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/irqchip/irq-renesas-rzv2h.c +4 -10
@@ -755,10 +755,6 @@ static int rzv2h_icu_setup_irqs(struct platform_device *pdev, struct irq_domain {const struct rzv2h_hw_info *hw_info = rzv2h_icu_data->info;bool irq_inject =IS_ENABLED (CONFIG_GENERIC_IRQ_INJECTION ); -static const char *const rzv2h_swint_names[] = { -"int-ca55-0" ,"int-ca55-1" , -"int-ca55-2" ,"int-ca55-3" , - };static const char *icu_err ="icu-error-ca55" ;void __iomem *base = rzv2h_icu_data->base;struct device *dev = &pdev->dev;
@@ -774,16 +770,14 @@ static int rzv2h_icu_setup_irqs(struct platform_device *pdev, struct irq_domain virq =irq_create_fwspec_mapping (&fwspec);if (!virq) { -return dev_err_probe (dev, -EINVAL ,"failed to create IRQ mapping for %s\n" , - rzv2h_swint_names[i]); +return dev_err_probe (dev, -EINVAL , +"failed to create int-ca55-%u IRQ mapping\n" , i); } ret =devm_request_irq (dev, virq, rzv2h_icu_swint_irq,0 ,dev_name (dev), (void *)(uintptr_t )i); -if (ret) { -return dev_err_probe (dev, ret,"Failed to request %s IRQ\n" , - rzv2h_swint_names[i]); - } +if (ret) +return dev_err_probe (dev, ret,"Failed to request int-ca55-%u IRQ\n" , i); }/* Unmask and clear all IP/CA55 error interrupts */
Signature · 1 line
2.43.0
RE: [PATCH 2/3] irqchip/renesas-rzv2h: Kill swint_names[]
Hi Geert,
Thanks for the patch
Quoted 5 lines
-----Original Message-----
From: Geert Uytterhoeven <[email protected]>
Sent: 03 April 2026 09:48
Subject: [PATCH 2/3] irqchip/renesas-rzv2h: Kill swint_names[]
Quoted 7 lines
The array swint_names[] just contains expansions of "int-ca55-%u". Replace it by formatting the strings where needed, to improve readability.
Despite the two error messages can no longer be shared with the ICU error cases, this reduces generated code size by 56 bytes.
Signed-off-by Geert Uytterhoeven <[email protected]>
Cheers,
Biju
Quoted 43 lines
---
--- drivers/irqchip/irq-renesas-rzv2h.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)drivers/irqchip/irq-renesas-rzv2h.c +5
-11@@ -755,10 +755,6 @@ static int rzv2h_icu_setup_irqs(struct platform_device *pdev, struct irq_domain {const struct rzv2h_hw_info *hw_info = rzv2h_icu_data->info;bool irq_inject =IS_ENABLED (CONFIG_GENERIC_IRQ_INJECTION ); -static const char *const rzv2h_swint_names[] = { -"int-ca55-0" ,"int-ca55-1" , -"int-ca55-2" ,"int-ca55-3" , - };static const char *icu_err ="icu-error-ca55" ;void __iomem *base = rzv2h_icu_data->base;struct device *dev = &pdev->dev;@@ -774,16 +770,14 @@ static int rzv2h_icu_setup_irqs(struct platform_device *pdev, struct irq_domain virq =irq_create_fwspec_mapping (&fwspec);if (!virq) { -return dev_err_probe (dev, -EINVAL ,"failed to create IRQ mapping for %s\n" , - rzv2h_swint_names[i]); +return dev_err_probe (dev, -EINVAL , +"failed to create int-ca55-%u IRQ mapping\n" , i); } ret =devm_request_irq (dev, virq, rzv2h_icu_swint_irq,0 ,dev_name (dev), (void *)(uintptr_t )i); -if (ret) { -return dev_err_probe (dev, ret,"Failed to request %s IRQ\n" , - rzv2h_swint_names[i]); - } +if (ret) +return dev_err_probe (dev, ret,"Failed to request int-ca55-%u +IRQ\n", i); }/* Unmask and clear all IP/CA55 error interrupts */ --2.43.0
PATCH 3/3 irqchip/renesas-rzv2h: Kill icu_err string
In reply to Geert UytterhoevenReplace the string variable icu_err by its expanded value where needed, to improve readability.
This reduces generated code size by 16 bytes.
--- drivers/irqchip/irq-renesas-rzv2h.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/irqchip/irq-renesas-rzv2h.c +4 -6
@@ -755,7 +755,6 @@ static int rzv2h_icu_setup_irqs(struct platform_device *pdev, struct irq_domain {const struct rzv2h_hw_info *hw_info = rzv2h_icu_data->info;bool irq_inject =IS_ENABLED (CONFIG_GENERIC_IRQ_INJECTION ); -static const char *icu_err ="icu-error-ca55" ;void __iomem *base = rzv2h_icu_data->base;struct device *dev = &pdev->dev;struct irq_fwspec fwspec;
@@ -800,14 +799,13 @@ static int rzv2h_icu_setup_irqs(struct platform_device *pdev, struct irq_domain fwspec.param[1 ] =IRQ_TYPE_LEVEL_HIGH ; virq =irq_create_fwspec_mapping (&fwspec); -if (!virq) { -return dev_err_probe (dev, -EINVAL ,"failed to create IRQ mapping for %s\n" , - icu_err); - } +if (!virq) +return dev_err_probe (dev, -EINVAL , +"failed to create icu-error-ca55 IRQ mapping\n" ); ret =devm_request_irq (dev, virq, rzv2h_icu_error_irq,0 ,dev_name (dev), rzv2h_icu_data);if (ret) -return dev_err_probe (dev, ret,"Failed to request %s IRQ\n" , icu_err); +return dev_err_probe (dev, ret,"Failed to request icu-error-ca55 IRQ\n" );return 0 ; }
Signature · 1 line
2.43.0