Skip to content

Commit d7e51e6

Browse files
Yinghai LuIngo Molnar
authored andcommitted
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: Yinghai Lu <[email protected]> Acked-by: Matt Mackall <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent e8b722f commit d7e51e6

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

drivers/char/random.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ struct timer_rand_state {
558558
unsigned dont_count_entropy:1;
559559
};
560560

561-
#ifndef CONFIG_SPARSE_IRQ
561+
#ifndef CONFIG_GENERIC_HARDIRQS
562562

563563
static struct timer_rand_state *irq_timer_state[NR_IRQS];
564564

drivers/pci/intr_remapping.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct irq_2_iommu {
2020
u8 irte_mask;
2121
};
2222

23-
#ifdef CONFIG_SPARSE_IRQ
23+
#ifdef CONFIG_GENERIC_HARDIRQS
2424
static struct irq_2_iommu *get_one_free_irq_2_iommu(int cpu)
2525
{
2626
struct irq_2_iommu *iommu;

include/linux/irq.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,10 @@ struct irq_2_iommu;
160160
*/
161161
struct irq_desc {
162162
unsigned int irq;
163-
#ifdef CONFIG_SPARSE_IRQ
164163
struct timer_rand_state *timer_rand_state;
165164
unsigned int *kstat_irqs;
166-
# ifdef CONFIG_INTR_REMAP
165+
#ifdef CONFIG_INTR_REMAP
167166
struct irq_2_iommu *irq_2_iommu;
168-
# endif
169167
#endif
170168
irq_flow_handler_t handle_irq;
171169
struct irq_chip *chip;
@@ -202,13 +200,13 @@ extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc
202200
extern struct irq_desc irq_desc[NR_IRQS];
203201
#else /* CONFIG_SPARSE_IRQ */
204202
extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu);
203+
#endif /* CONFIG_SPARSE_IRQ */
205204

206205
#define kstat_irqs_this_cpu(DESC) \
207206
((DESC)->kstat_irqs[smp_processor_id()])
208207
#define kstat_incr_irqs_this_cpu(irqno, DESC) \
209208
((DESC)->kstat_irqs[smp_processor_id()]++)
210209

211-
#endif /* CONFIG_SPARSE_IRQ */
212210

213211
extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu);
214212

include/linux/kernel_stat.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct cpu_usage_stat {
2828

2929
struct kernel_stat {
3030
struct cpu_usage_stat cpustat;
31-
#ifndef CONFIG_SPARSE_IRQ
31+
#ifndef CONFIG_GENERIC_HARDIRQS
3232
unsigned int irqs[NR_IRQS];
3333
#endif
3434
};
@@ -41,7 +41,7 @@ DECLARE_PER_CPU(struct kernel_stat, kstat);
4141

4242
extern unsigned long long nr_context_switches(void);
4343

44-
#ifndef CONFIG_SPARSE_IRQ
44+
#ifndef CONFIG_GENERIC_HARDIRQS
4545
#define kstat_irqs_this_cpu(irq) \
4646
(kstat_this_cpu.irqs[irq])
4747

@@ -55,7 +55,7 @@ static inline void kstat_incr_irqs_this_cpu(unsigned int irq,
5555
#endif
5656

5757

58-
#ifndef CONFIG_SPARSE_IRQ
58+
#ifndef CONFIG_GENERIC_HARDIRQS
5959
static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
6060
{
6161
return kstat_cpu(cpu).irqs[irq];

kernel/irq/handle.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
213213
}
214214
};
215215

216+
static unsigned int kstat_irqs_all[NR_IRQS][NR_CPUS];
216217
int __init early_irq_init(void)
217218
{
218219
struct irq_desc *desc;
@@ -222,8 +223,10 @@ int __init early_irq_init(void)
222223
desc = irq_desc;
223224
count = ARRAY_SIZE(irq_desc);
224225

225-
for (i = 0; i < count; i++)
226+
for (i = 0; i < count; i++) {
226227
desc[i].irq = i;
228+
desc[i].kstat_irqs = kstat_irqs_all[i];
229+
}
227230

228231
return arch_early_irq_init();
229232
}
@@ -451,12 +454,10 @@ void early_init_irq_lock_class(void)
451454
}
452455
}
453456

454-
#ifdef CONFIG_SPARSE_IRQ
455457
unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
456458
{
457459
struct irq_desc *desc = irq_to_desc(irq);
458460
return desc ? desc->kstat_irqs[cpu] : 0;
459461
}
460-
#endif
461462
EXPORT_SYMBOL(kstat_irqs_cpu);
462463

0 commit comments

Comments
 (0)