[PATCH 4/5] irqchip: Constify some irq_desc_get_chip() usage

Christophe JAILLET posted 5 patches 1 year, 2 months ago
[PATCH 4/5] irqchip: Constify some irq_desc_get_chip() usage
Posted by Christophe JAILLET 1 year, 2 months ago
When irq_desc_get_chip() will return a const struct irq_chip, the const
qualifier will be needed for local variables that store the return value of
this function.

So start to add some of these const qualifiers.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only
---
 kernel/irq/chip.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index eca39c4dd094..d3acccf7e2e2 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -751,7 +751,7 @@ EXPORT_SYMBOL_GPL(handle_fasteoi_irq);
  */
 void handle_fasteoi_nmi(struct irq_desc *desc)
 {
-	struct irq_chip *chip = irq_desc_get_chip(desc);
+	const struct irq_chip *chip = irq_desc_get_chip(desc);
 	struct irqaction *action = desc->action;
 	unsigned int irq = irq_desc_get_irq(desc);
 	irqreturn_t res;
@@ -849,7 +849,7 @@ EXPORT_SYMBOL(handle_edge_irq);
  */
 void handle_edge_eoi_irq(struct irq_desc *desc)
 {
-	struct irq_chip *chip = irq_desc_get_chip(desc);
+	const struct irq_chip *chip = irq_desc_get_chip(desc);
 
 	raw_spin_lock(&desc->lock);
 
@@ -894,7 +894,7 @@ void handle_edge_eoi_irq(struct irq_desc *desc)
  */
 void handle_percpu_irq(struct irq_desc *desc)
 {
-	struct irq_chip *chip = irq_desc_get_chip(desc);
+	const struct irq_chip *chip = irq_desc_get_chip(desc);
 
 	/*
 	 * PER CPU interrupts are not serialized. Do not touch
@@ -924,7 +924,7 @@ void handle_percpu_irq(struct irq_desc *desc)
  */
 void handle_percpu_devid_irq(struct irq_desc *desc)
 {
-	struct irq_chip *chip = irq_desc_get_chip(desc);
+	const struct irq_chip *chip = irq_desc_get_chip(desc);
 	struct irqaction *action = desc->action;
 	unsigned int irq = irq_desc_get_irq(desc);
 	irqreturn_t res;
@@ -967,7 +967,7 @@ void handle_percpu_devid_irq(struct irq_desc *desc)
  */
 void handle_percpu_devid_fasteoi_nmi(struct irq_desc *desc)
 {
-	struct irq_chip *chip = irq_desc_get_chip(desc);
+	const struct irq_chip *chip = irq_desc_get_chip(desc);
 	struct irqaction *action = desc->action;
 	unsigned int irq = irq_desc_get_irq(desc);
 	irqreturn_t res;
-- 
2.47.0
Re: [PATCH 4/5] irqchip: Constify some irq_desc_get_chip() usage
Posted by Thomas Gleixner 1 year, 2 months ago
On Sun, Nov 17 2024 at 10:49, Christophe JAILLET wrote:
> When irq_desc_get_chip() will return a const struct irq_chip, the const
> qualifier will be needed for local variables that store the return value of
> this function.
>
> So start to add some of these const qualifiers.

Can you please create a coccinelle script which does a tree wide
conversion of all irq_desc_get_chip() and irq_data_get_irq_chip()
instances?

That script can be run at the end of the next merge window once instead
of having to chase 240+ places with individual patches.

Thanks,

        tglx