[PATCH 00/21] Reduce the scope of 'nr_irqs'

Bart Van Assche posted 21 patches 1 month, 4 weeks ago
There is a newer version of this series
arch/arm/kernel/irq.c                  |  5 ++---
arch/loongarch/kernel/irq.c            |  4 ++--
arch/powerpc/platforms/cell/axon_msi.c |  2 +-
arch/s390/kernel/irq.c                 |  2 +-
arch/x86/kernel/acpi/boot.c            |  6 ++++--
arch/x86/kernel/apic/vector.c          |  8 ++++----
drivers/char/hpet.c                    |  2 +-
drivers/net/ethernet/3com/3c59x.c      |  2 +-
drivers/net/hamradio/baycom_ser_fdx.c  |  4 ++--
drivers/net/hamradio/scc.c             |  6 +++---
drivers/scsi/aha152x.c                 |  2 +-
drivers/sh/intc/virq-debugfs.c         |  2 +-
drivers/tty/serial/8250/8250_port.c    |  2 +-
drivers/tty/serial/amba-pl010.c        |  2 +-
drivers/tty/serial/amba-pl011.c        |  2 +-
drivers/tty/serial/cpm_uart.c          |  2 +-
drivers/tty/serial/serial_core.c       |  2 +-
drivers/tty/serial/ucc_uart.c          |  2 +-
drivers/xen/events/events_base.c       |  2 +-
fs/proc/interrupts.c                   |  4 ++--
fs/proc/stat.c                         |  4 ++--
include/linux/irqnr.h                  | 18 ++++++++++--------
kernel/irq/irqdesc.c                   | 17 +++++++++++++++--
kernel/irq/irqdomain.c                 |  2 +-
kernel/irq/proc.c                      |  5 +++--
25 files changed, 63 insertions(+), 46 deletions(-)
[PATCH 00/21] Reduce the scope of 'nr_irqs'
Posted by Bart Van Assche 1 month, 4 weeks ago
Hi Thomas,

In addition to the global 'nr_irqs' variable, there are plenty of local
variables with the same name. This makes reviewing kernel patches and
auditing kernel source code harder than necessary. Hence this patch series
that reduces the scope of the global 'nr_irqs' variable to file scope and
that introduces functions for retrieving and setting the value of this
variable. Please consider this patch series for the next merge window.

All patches in this series except the first and the last two have been
generated by applying the following Coccinelle semantic patch on the
kernel tree:

// git grep -lw nr_irqs | grep -Ev 'kernel/irq/irqdesc.c|include/linux/irqnr.h' | while read -r f; do spatch --sp-file replace-nr_irqs.spatch --in-place "$f"; done
@@
global idexpression nr_irqs =~ "^nr_irqs$";
expression E;
@@
-nr_irqs = E;
-return nr_irqs;
+return set_number_of_interrupts(E);

@@
global idexpression nr_irqs =~ "^nr_irqs$";
expression E;
@@
-nr_irqs = (E);
+set_number_of_interrupts(E);

@@
global idexpression nr_irqs =~ "^nr_irqs$";
expression E;
@@
-nr_irqs = E;
+set_number_of_interrupts(E);

@@
global idexpression nr_irqs =~ "^nr_irqs$";
@@
-nr_irqs
+number_of_interrupts()

Thanks,

Bart.

Bart Van Assche (21):
  genirq: Introduce number_of_interrupts() and
    set_number_of_interrupts()
  ARM: Switch to number_of_interrupts() / set_number_of_interrupts()
  LoongArch: Switch to set_number_of_interrupts()
  powerpc/cell: Switch to number_of_interrupts()
  s390/irq: Switch to number_of_interrupts()
  x86/acpi: Switch to number_of_interrupts() /
    set_number_of_interrupts()
  hpet: Switch to number_of_interrupts()
  net: 3com: 3c59x: Switch to number_of_interrupts()
  net: hamradio: baycom_ser_fdx: Switch to number_of_interrupts()
  scsi: aha152x: Switch to number_of_interrupts()
  serial: core: Switch to number_of_interrupts()
  serial: 8250: Switch to number_of_interrupts()
  serial: amba-pl010: Switch to number_of_interrupts()
  serial: amba-pl011: Switch to number_of_interrupts()
  serial: cpm_uart: Switch to number_of_interrupts()
  serial: ucc_uart: Switch to number_of_interrupts()
  sh: intc: Switch to number_of_interrupts()
  xen/events: Switch to number_of_interrupts()
  fs/procfs: Switch to number_of_interrupts()
  genirq: Switch to number_of_interrupts()
  genirq: Unexport nr_irqs

 arch/arm/kernel/irq.c                  |  5 ++---
 arch/loongarch/kernel/irq.c            |  4 ++--
 arch/powerpc/platforms/cell/axon_msi.c |  2 +-
 arch/s390/kernel/irq.c                 |  2 +-
 arch/x86/kernel/acpi/boot.c            |  6 ++++--
 arch/x86/kernel/apic/vector.c          |  8 ++++----
 drivers/char/hpet.c                    |  2 +-
 drivers/net/ethernet/3com/3c59x.c      |  2 +-
 drivers/net/hamradio/baycom_ser_fdx.c  |  4 ++--
 drivers/net/hamradio/scc.c             |  6 +++---
 drivers/scsi/aha152x.c                 |  2 +-
 drivers/sh/intc/virq-debugfs.c         |  2 +-
 drivers/tty/serial/8250/8250_port.c    |  2 +-
 drivers/tty/serial/amba-pl010.c        |  2 +-
 drivers/tty/serial/amba-pl011.c        |  2 +-
 drivers/tty/serial/cpm_uart.c          |  2 +-
 drivers/tty/serial/serial_core.c       |  2 +-
 drivers/tty/serial/ucc_uart.c          |  2 +-
 drivers/xen/events/events_base.c       |  2 +-
 fs/proc/interrupts.c                   |  4 ++--
 fs/proc/stat.c                         |  4 ++--
 include/linux/irqnr.h                  | 18 ++++++++++--------
 kernel/irq/irqdesc.c                   | 17 +++++++++++++++--
 kernel/irq/irqdomain.c                 |  2 +-
 kernel/irq/proc.c                      |  5 +++--
 25 files changed, 63 insertions(+), 46 deletions(-)