Skip to contentSkip to conversation

genirq: Don't return error on missing optional irq_request_resources()

PATCH Applied Antonio Borneo 2 participants 3 messages May 12, 2022 – Jul 7, 2022 IRQ

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 genirq: Don't return error on missing optional irq_request_resources()

Function irq_chip::irq_request_resources() is reported as optional in the declaration of struct irq_chip.
If the parent irq_chip does not implement it, we should ignore it and return.

Don't return error if the functions is missing.

---

As follow-up of discussion in
https://lore.kernel.org/lkml/[email protected]/
here is a proposal for changing the returned value.

A similar issue is present for the optional function irq_set_vcpu_affinity(), to be covered separately, if needed.

---
 kernel/irq/chip.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/irq/chip.c +2 -1
index 54af0deb239b..eb921485930f 100644
@@ -1513,7 +1513,8 @@ int irq_chip_request_resources_parent(struct irq_data *data)
 	if (data->chip->irq_request_resources)
 		return data->chip->irq_request_resources(data);
 
-	return -ENOSYS;
+	/* no error on missing optional irq_chip::irq_request_resources */
+	return 0;
 }
 EXPORT_SYMBOL_GPL(irq_chip_request_resources_parent);
 

base-commit: c5eb0a61238dd6faf37f58c9ce61c9980aaffd7a

Signature · 1 line
2.36.0
#1 lore raw
Quoted 8 lines · Antonio Borneo

Function irq_chip::irq_request_resources() is reported as optional in the declaration of struct irq_chip.
If the parent irq_chip does not implement it, we should ignore it and return.

Don't return error if the functions is missing.

Quoted 8 lines

---

As follow-up of discussion in
https://lore.kernel.org/lkml/[email protected]/
here is a proposal for changing the returned value.

A similar issue is present for the optional function irq_set_vcpu_affinity(), to be covered separately, if needed.

Gentle ping for this patch.
Does it match the expected behaviour for an optional function?

Thanks,
Antonio

Quoted 23 lines

---
 kernel/irq/chip.c | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/irq/chip.c +0 -0
index 54af0deb239b..eb921485930f 100644
@@ -1513,7 +1513,8 @@ int irq_chip_request_resources_parent(struct
 irq_data *data)
         if (data->chip->irq_request_resources)
                 return data->chip->irq_request_resources(data);


-       return -ENOSYS;
+       /* no error on missing optional irq_chip::irq_request_resources */
+       return 0;
 } EXPORT_SYMBOL_GPL(irq_chip_request_resources_parent);

base-commit: c5eb0a61238dd6faf37f58c9ce61c9980aaffd7a

#2 lore raw
In reply to Antonio Borneo
The following commit has been merged into the irq/irqchip-next branch of irqchip:

The following commit has been merged into the irq/irqchip-next branch of irqchip:

Commit-ID:     95001b756467ecc9f5973eb5e74e97699d9bbdf1
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/95001b756467ecc9f5973eb5e74e97699d9bbdf1
Author:        Antonio Borneo <[email protected]>
AuthorDate:    Thu, 12 May 2022 18:05:44 +02:00
Committer:     Marc Zyngier <[email protected]>
CommitterDate: Thu, 07 Jul 2022 09:04:13 +01:00

genirq: Don't return error on missing optional irq_request_resources()

Function irq_chip::irq_request_resources() is reported as optional in the declaration of struct irq_chip.
If the parent irq_chip does not implement it, we should ignore it and return.

Don't return error if the functions is missing.

---
 kernel/irq/chip.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/irq/chip.c +2 -1
index 886789d..c190405 100644
@@ -1516,7 +1516,8 @@ int irq_chip_request_resources_parent(struct irq_data *data)
 	if (data->chip->irq_request_resources)
 		return data->chip->irq_request_resources(data);
 
-	return -ENOSYS;
+	/* no error on missing optional irq_chip::irq_request_resources */
+	return 0;
 }
 EXPORT_SYMBOL_GPL(irq_chip_request_resources_parent);