Skip to content

Commit ab7798f

Browse files
committed
genirq: Expand generic show_interrupts()
Some archs want to print extra information for certain irq_chips which is per irq and not per chip. Allow them to provide a chip callback to print the chip name and the extra information. PowerPC wants to print the LEVEL/EDGE type information. Make it configurable. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 08f1b80 commit ab7798f

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

‎include/linux/irq.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <asm/ptrace.h>
2929
#include <asm/irq_regs.h>
3030

31+
struct seq_file;
3132
struct irq_desc;
3233
struct irq_data;
3334
typedef void (*irq_flow_handler_t)(unsigned int irq,
@@ -270,6 +271,7 @@ static inline bool irqd_can_move_in_process_context(struct irq_data *d)
270271
* @irq_set_wake: enable/disable power-management wake-on of an IRQ
271272
* @irq_bus_lock: function to lock access to slow bus (i2c) chips
272273
* @irq_bus_sync_unlock:function to sync and unlock slow bus (i2c) chips
274+
* @irq_print_chip: optional to print special chip info in show_interrupts
273275
* @flags: chip specific flags
274276
*
275277
* @release: release function solely used by UML
@@ -317,6 +319,8 @@ struct irq_chip {
317319
void (*irq_bus_lock)(struct irq_data *data);
318320
void (*irq_bus_sync_unlock)(struct irq_data *data);
319321

322+
void (*irq_print_chip)(struct irq_data *data, struct seq_file *p);
323+
320324
unsigned long flags;
321325

322326
/* Currently used only by UML, might disappear one day.*/

‎kernel/irq/Kconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ config GENERIC_IRQ_PROBE
3131
config GENERIC_IRQ_SHOW
3232
bool
3333

34+
# Print level/edge extra information
35+
config GENERIC_IRQ_SHOW_LEVEL
36+
bool
37+
3438
# Support for delayed migration from interrupt context
3539
config GENERIC_PENDING_IRQ
3640
bool

‎kernel/irq/proc.c‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,20 @@ int show_interrupts(struct seq_file *p, void *v)
404404
seq_printf(p, "%*d: ", prec, i);
405405
for_each_online_cpu(j)
406406
seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
407-
seq_printf(p, " %8s", desc->irq_data.chip->name);
407+
408+
if (desc->irq_data.chip) {
409+
if (desc->irq_data.chip->irq_print_chip)
410+
desc->irq_data.chip->irq_print_chip(&desc->irq_data, p);
411+
else if (desc->irq_data.chip->name)
412+
seq_printf(p, " %8s", desc->irq_data.chip->name);
413+
else
414+
seq_printf(p, " %8s", "-");
415+
} else {
416+
seq_printf(p, " %8s", "None");
417+
}
418+
#ifdef CONFIG_GENIRC_IRQ_SHOW_LEVEL
419+
seq_printf(p, " %-8s", irqd_is_level_type(&desc->irq_data) ? "Level" : "Edge");
420+
#endif
408421
if (desc->name)
409422
seq_printf(p, "-%-8s", desc->name);
410423

0 commit comments

Comments
 (0)