[PATCH] kernel/irq/manage.c: print irq name when unbalanced irq enable.

From: Bumwoo Lee
Date: Wed Feb 15 2023 - 02:33:26 EST


To make easy for debugging,
let's print desc->name at the time of the problem.

[3-32714.6377] Unbalanced enable for IRQ 69 (2800000.sdp_dvde)

Signed-off-by: Bumwoo Lee <bw365.lee@xxxxxxxxxxx>
---
kernel/irq/manage.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 8ce75495e04f..161138998d8d 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -781,8 +781,8 @@ void __enable_irq(struct irq_desc *desc)
switch (desc->depth) {
case 0:
err_out:
- WARN(1, KERN_WARNING "Unbalanced enable for IRQ %d\n",
- irq_desc_get_irq(desc));
+ WARN(1, "Unbalanced enable for IRQ %d (%s)\n",
+ irq_desc_get_irq(desc), desc->name ? desc->name : "Null");
break;
case 1: {
if (desc->istate & IRQS_SUSPENDED)
@@ -823,7 +823,8 @@ void enable_irq(unsigned int irq)
if (!desc)
return;
if (WARN(!desc->irq_data.chip,
- KERN_ERR "enable_irq before setup/request_irq: irq %u\n", irq))
+ "%s before setup/request_irq: irq %u (%s)\n",
+ __func__, irq, desc->name ? desc->name : "Null"))
goto out;

__enable_irq(desc);
@@ -907,7 +908,8 @@ int irq_set_irq_wake(unsigned int irq, unsigned int on)
}
} else {
if (desc->wake_depth == 0) {
- WARN(1, "Unbalanced IRQ %d wake disable\n", irq);
+ WARN(1, "Unbalanced IRQ %d (%s) wake disable\n", irq,
+ desc->name ? desc->name : "Null");
} else if (--desc->wake_depth == 0) {
ret = set_irq_wake_real(irq, on);
if (ret)
--
2.35.1