Commit 792d0018 authored by Thomas Gleixner's avatar Thomas Gleixner

genirq: Add a kstat helper to increment irq stats

There is a common pattern all over the place:

      kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq));

This results in a call to core code anyway. So provide a function
which does the same thing in core.

While at it, replace the butt ugly macro with an inline.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20140223212737.422068876@linutronix.deSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 02893afd
...@@ -54,11 +54,13 @@ extern unsigned long long nr_context_switches(void); ...@@ -54,11 +54,13 @@ extern unsigned long long nr_context_switches(void);
#include <linux/irq.h> #include <linux/irq.h>
extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu); extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu);
#define kstat_incr_irqs_this_cpu(irqno, DESC) \ static inline void kstat_incr_irqs_this_cpu(unsigned int irq, struct irq_desc *desc)
do { \ {
__this_cpu_inc(*(DESC)->kstat_irqs); \ __this_cpu_inc(*desc->kstat_irqs);
__this_cpu_inc(kstat.irqs_sum); \ __this_cpu_inc(kstat.irqs_sum);
} while (0) }
extern void kstat_incr_irq_this_cpu(unsigned int irq);
static inline void kstat_incr_softirqs_this_cpu(unsigned int irq) static inline void kstat_incr_softirqs_this_cpu(unsigned int irq)
{ {
......
...@@ -489,6 +489,11 @@ void dynamic_irq_cleanup(unsigned int irq) ...@@ -489,6 +489,11 @@ void dynamic_irq_cleanup(unsigned int irq)
raw_spin_unlock_irqrestore(&desc->lock, flags); raw_spin_unlock_irqrestore(&desc->lock, flags);
} }
void kstat_incr_irq_this_cpu(unsigned int irq)
{
kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq));
}
unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
{ {
struct irq_desc *desc = irq_to_desc(irq); struct irq_desc *desc = irq_to_desc(irq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment