Skip to content

Reduce the scope of 'nr_irqs'

Bart Van Assche linuxppc-dev lkml 2 versions – Applied

Status from this message: The following commit has been merged into the irq/core branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest22 patches 1 replyApplied
  2. v222 patches 1 replySuperseded

Changes in v3 from the cover letter

- Changed "This patch prepares" into "Prepare" in the several patch descriptions.
- Changed the type of 'nr_irqs' from 'int' into 'unsigned int'.

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/22genirq: Introduce irq_get_nr_irqs() and irq_set_nr_irqs()include/linux/irqnr.h kernel/irq/irqdesc.c+25 -00 replies
2/22ARM: Switch to irq_get_nr_irqs() / irq_set_nr_irqs()arch/arm/kernel/irq.c+2 -30 replies
3/22LoongArch: Switch to irq_set_nr_irqs()arch/loongarch/kernel/irq.c+2 -20 replies
4/22powerpc/cell: Switch to irq_get_nr_irqs()arch/powerpc/platforms/cell/axon_msi.c+1 -11 reply
5/22s390/irq: Switch to irq_get_nr_irqs()arch/s390/kernel/irq.c+1 -10 replies
6/22x86/acpi: Switch to irq_get_nr_irqs() and irq_set_nr_irqs()arch/x86/kernel/acpi/boot.c arch/x86/kernel/apic/vector.c+8 -60 replies
7/22hpet: Switch to irq_get_nr_irqs()drivers/char/hpet.c+1 -00 replies
8/22net: 3com: 3c59x: Switch to irq_get_nr_irqs()drivers/net/ethernet/3com/3c59x.c+1 -10 replies
9/22net: hamradio: baycom_ser_fdx: Switch to irq_get_nr_irqs()drivers/net/hamradio/baycom_ser_fdx.c+1 -00 replies
10/22net: hamradio: scc: Switch to irq_get_nr_irqs()drivers/net/hamradio/scc.c+3 -10 replies
11/22scsi: aha152x: Switch to irq_get_nr_irqs()drivers/scsi/aha152x.c+1 -10 replies
12/22serial: core: Switch to irq_get_nr_irqs()drivers/tty/serial/serial_core.c+1 -10 replies
13/22serial: 8250: Switch to irq_get_nr_irqs()drivers/tty/serial/8250/8250_port.c+1 -10 replies
14/22serial: amba-pl010: Switch to irq_get_nr_irqs()drivers/tty/serial/amba-pl010.c+1 -10 replies
15/22serial: amba-pl011: Switch to irq_get_nr_irqs()drivers/tty/serial/amba-pl011.c+1 -10 replies
16/22serial: cpm_uart: Switch to irq_get_nr_irqs()drivers/tty/serial/cpm_uart.c+1 -10 replies
17/22serial: ucc_uart: Switch to irq_get_nr_irqs()drivers/tty/serial/ucc_uart.c+1 -10 replies
18/22sh: intc: Switch to irq_get_nr_irqs()drivers/sh/intc/virq-debugfs.c+1 -00 replies
19/22xen/events: Switch to irq_get_nr_irqs()drivers/xen/events/events_base.c+1 -10 replies
20/22fs/procfs: Switch to irq_get_nr_irqs()fs/proc/interrupts.c fs/proc/stat.c+4 -40 replies
21/22genirq: Switch to irq_get_nr_irqs()include/linux/irqnr.h kernel/irq/irqdomain.c kernel/irq/proc.c+22 -160 replies
22/22genirq: Unexport nr_irqsinclude/linux/irqnr.h kernel/irq/irqdesc.c+1 -30 replies

Reviews trailers per patch

1 of 22 patches has a Reviewed-by or Acked-by.

PatchMichael Ellerman
1/22
2/22
3/22
4/22A-b
5/22
6/22
7/22
8/22
9/22
10/22
11/22
12/22
13/22
14/22
15/22
16/22
17/22
18/22
19/22
20/22
21/22
22/22

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 00/22] Reduce the scope of 'nr_irqs'

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.

Accesses of the global variable 'nr_irqs' have been identified with Coccinelle.

Please consider this patch series for the next merge window.

Thanks,

Bart.

Changes compared to v2:
- Changed "This patch prepares" into "Prepare" in the several patch descriptions.
- Changed the type of 'nr_irqs' from 'int' into 'unsigned int'.

Changes compared to v1:
- Renamed the accessor functions: number_of_interrupts() has been renamed into irq_get_nr_irqs() and set_number_of_interrupts() has been renamed into set_number_of_interrupts().
- Made the description of patch 01 more detailed. It is now explained in detail why it is useful to introduce accessor functions for 'nr_irqs'.
- Cache the irq_get_nr_irqs() return value if it is used as a loop upper bound or inside a loop body instead of relying on CSE (common subexpression elimination) by the compiler.
- Changed the return type of the accessor functions from 'int' into 'unsigned int'.
- Split the hamradio patch into two patches - one patch per driver.

Bart Van Assche (22):
genirq: Introduce irq_get_nr_irqs() and irq_set_nr_irqs()
ARM: Switch to irq_get_nr_irqs() / irq_set_nr_irqs()
LoongArch: Switch to irq_set_nr_irqs() powerpc/cell: Switch to irq_get_nr_irqs() s390/irq: Switch to irq_get_nr_irqs()
x86/acpi: Switch to irq_get_nr_irqs() and irq_set_nr_irqs()
hpet: Switch to irq_get_nr_irqs()
net: 3com: 3c59x: Switch to irq_get_nr_irqs()
net: hamradio: baycom_ser_fdx: Switch to irq_get_nr_irqs()
net: hamradio: scc: Switch to irq_get_nr_irqs()
scsi: aha152x: Switch to irq_get_nr_irqs()
serial: core: Switch to irq_get_nr_irqs()
serial: 8250: Switch to irq_get_nr_irqs()
serial: amba-pl010: Switch to irq_get_nr_irqs()
serial: amba-pl011: Switch to irq_get_nr_irqs()
serial: cpm_uart: Switch to irq_get_nr_irqs()
serial: ucc_uart: Switch to irq_get_nr_irqs()
sh: intc: Switch to irq_get_nr_irqs()
xen/events: Switch to irq_get_nr_irqs() fs/procfs: Switch to irq_get_nr_irqs()
genirq: Switch to irq_get_nr_irqs()
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                    |  1 +
 drivers/net/ethernet/3com/3c59x.c      |  2 +-
 drivers/net/hamradio/baycom_ser_fdx.c  |  1 +
 drivers/net/hamradio/scc.c             |  4 ++-
 drivers/scsi/aha152x.c                 |  2 +-
 drivers/sh/intc/virq-debugfs.c         |  1 +
 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                  | 36 +++++++++++++++-----------
 kernel/irq/irqdesc.c                   | 26 +++++++++++++++++--
 kernel/irq/irqdomain.c                 |  2 +-
 kernel/irq/proc.c                      |  3 ++-
 25 files changed, 81 insertions(+), 46 deletions(-)