Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs/procfs: Switch to irq_get_nr_irqs()

Use the irq_get_nr_irqs() function instead of the global variable
'nr_irqs'. Prepare for changing 'nr_irqs' from an exported global
variable into a variable with file scope.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20241015190953.1266194-21-bvanassche@acm.org

authored by

Bart Van Assche and committed by
Thomas Gleixner
f4dd946c 3e48fa2e

+4 -4
+2 -2
fs/proc/interrupts.c
··· 11 11 */ 12 12 static void *int_seq_start(struct seq_file *f, loff_t *pos) 13 13 { 14 - return (*pos <= nr_irqs) ? pos : NULL; 14 + return *pos <= irq_get_nr_irqs() ? pos : NULL; 15 15 } 16 16 17 17 static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos) 18 18 { 19 19 (*pos)++; 20 - if (*pos > nr_irqs) 20 + if (*pos > irq_get_nr_irqs()) 21 21 return NULL; 22 22 return pos; 23 23 }
+2 -2
fs/proc/stat.c
··· 76 76 seq_put_decimal_ull(p, " ", kstat_irqs_usr(i)); 77 77 next = i + 1; 78 78 } 79 - show_irq_gap(p, nr_irqs - next); 79 + show_irq_gap(p, irq_get_nr_irqs() - next); 80 80 } 81 81 82 82 static int show_stat(struct seq_file *p, void *v) ··· 196 196 unsigned int size = 1024 + 128 * num_online_cpus(); 197 197 198 198 /* minimum size to display an interrupt count : 2 bytes */ 199 - size += 2 * nr_irqs; 199 + size += 2 * irq_get_nr_irqs(); 200 200 return single_open_size(file, show_stat, NULL, size); 201 201 } 202 202