Commit d7e51e66 authored by Yinghai Lu's avatar Yinghai Lu Committed by Ingo Molnar

sparseirq: make some func to be used with genirq

Impact: clean up sparseirq fallout on random.c

Ingo suggested to change some ifdef from SPARSE_IRQ to GENERIC_HARDIRQS
so we could some #ifdef later if all arch support genirq
Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Acked-by: default avatarMatt Mackall <mpm@selenic.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent e8b722f4
...@@ -558,7 +558,7 @@ struct timer_rand_state { ...@@ -558,7 +558,7 @@ struct timer_rand_state {
unsigned dont_count_entropy:1; unsigned dont_count_entropy:1;
}; };
#ifndef CONFIG_SPARSE_IRQ #ifndef CONFIG_GENERIC_HARDIRQS
static struct timer_rand_state *irq_timer_state[NR_IRQS]; static struct timer_rand_state *irq_timer_state[NR_IRQS];
......
...@@ -20,7 +20,7 @@ struct irq_2_iommu { ...@@ -20,7 +20,7 @@ struct irq_2_iommu {
u8 irte_mask; u8 irte_mask;
}; };
#ifdef CONFIG_SPARSE_IRQ #ifdef CONFIG_GENERIC_HARDIRQS
static struct irq_2_iommu *get_one_free_irq_2_iommu(int cpu) static struct irq_2_iommu *get_one_free_irq_2_iommu(int cpu)
{ {
struct irq_2_iommu *iommu; struct irq_2_iommu *iommu;
......
...@@ -160,12 +160,10 @@ struct irq_2_iommu; ...@@ -160,12 +160,10 @@ struct irq_2_iommu;
*/ */
struct irq_desc { struct irq_desc {
unsigned int irq; unsigned int irq;
#ifdef CONFIG_SPARSE_IRQ
struct timer_rand_state *timer_rand_state; struct timer_rand_state *timer_rand_state;
unsigned int *kstat_irqs; unsigned int *kstat_irqs;
# ifdef CONFIG_INTR_REMAP #ifdef CONFIG_INTR_REMAP
struct irq_2_iommu *irq_2_iommu; struct irq_2_iommu *irq_2_iommu;
# endif
#endif #endif
irq_flow_handler_t handle_irq; irq_flow_handler_t handle_irq;
struct irq_chip *chip; struct irq_chip *chip;
...@@ -202,13 +200,13 @@ extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc ...@@ -202,13 +200,13 @@ extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc
extern struct irq_desc irq_desc[NR_IRQS]; extern struct irq_desc irq_desc[NR_IRQS];
#else /* CONFIG_SPARSE_IRQ */ #else /* CONFIG_SPARSE_IRQ */
extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu); extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu);
#endif /* CONFIG_SPARSE_IRQ */
#define kstat_irqs_this_cpu(DESC) \ #define kstat_irqs_this_cpu(DESC) \
((DESC)->kstat_irqs[smp_processor_id()]) ((DESC)->kstat_irqs[smp_processor_id()])
#define kstat_incr_irqs_this_cpu(irqno, DESC) \ #define kstat_incr_irqs_this_cpu(irqno, DESC) \
((DESC)->kstat_irqs[smp_processor_id()]++) ((DESC)->kstat_irqs[smp_processor_id()]++)
#endif /* CONFIG_SPARSE_IRQ */
extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu); extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu);
......
...@@ -28,7 +28,7 @@ struct cpu_usage_stat { ...@@ -28,7 +28,7 @@ struct cpu_usage_stat {
struct kernel_stat { struct kernel_stat {
struct cpu_usage_stat cpustat; struct cpu_usage_stat cpustat;
#ifndef CONFIG_SPARSE_IRQ #ifndef CONFIG_GENERIC_HARDIRQS
unsigned int irqs[NR_IRQS]; unsigned int irqs[NR_IRQS];
#endif #endif
}; };
...@@ -41,7 +41,7 @@ DECLARE_PER_CPU(struct kernel_stat, kstat); ...@@ -41,7 +41,7 @@ DECLARE_PER_CPU(struct kernel_stat, kstat);
extern unsigned long long nr_context_switches(void); extern unsigned long long nr_context_switches(void);
#ifndef CONFIG_SPARSE_IRQ #ifndef CONFIG_GENERIC_HARDIRQS
#define kstat_irqs_this_cpu(irq) \ #define kstat_irqs_this_cpu(irq) \
(kstat_this_cpu.irqs[irq]) (kstat_this_cpu.irqs[irq])
...@@ -55,7 +55,7 @@ static inline void kstat_incr_irqs_this_cpu(unsigned int irq, ...@@ -55,7 +55,7 @@ static inline void kstat_incr_irqs_this_cpu(unsigned int irq,
#endif #endif
#ifndef CONFIG_SPARSE_IRQ #ifndef CONFIG_GENERIC_HARDIRQS
static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
{ {
return kstat_cpu(cpu).irqs[irq]; return kstat_cpu(cpu).irqs[irq];
......
...@@ -213,6 +213,7 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { ...@@ -213,6 +213,7 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
} }
}; };
static unsigned int kstat_irqs_all[NR_IRQS][NR_CPUS];
int __init early_irq_init(void) int __init early_irq_init(void)
{ {
struct irq_desc *desc; struct irq_desc *desc;
...@@ -222,8 +223,10 @@ int __init early_irq_init(void) ...@@ -222,8 +223,10 @@ int __init early_irq_init(void)
desc = irq_desc; desc = irq_desc;
count = ARRAY_SIZE(irq_desc); count = ARRAY_SIZE(irq_desc);
for (i = 0; i < count; i++) for (i = 0; i < count; i++) {
desc[i].irq = i; desc[i].irq = i;
desc[i].kstat_irqs = kstat_irqs_all[i];
}
return arch_early_irq_init(); return arch_early_irq_init();
} }
...@@ -451,12 +454,10 @@ void early_init_irq_lock_class(void) ...@@ -451,12 +454,10 @@ void early_init_irq_lock_class(void)
} }
} }
#ifdef CONFIG_SPARSE_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);
return desc ? desc->kstat_irqs[cpu] : 0; return desc ? desc->kstat_irqs[cpu] : 0;
} }
#endif
EXPORT_SYMBOL(kstat_irqs_cpu); EXPORT_SYMBOL(kstat_irqs_cpu);
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