Reduce the scope of 'nr_irqs'
Subsystems (21)
v3 cover 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(-)
PATCH v3 1/22 genirq: Introduce irq_get_nr_irqs() and irq_set_nr_irqs()
Prepare for changing 'nr_irqs' from an exported global variable into a variable with file scope. This will prevent accidental changes of assignments to a local variable 'nr_irqs' into assignments to the global 'nr_irqs' variable. Suppose that a patch would be submitted for review that removes a declaration of a local variable with the name 'nr_irqs' and that that patch does not remove all assignments to that local variable. Such a patch converts an assignment to a local variable into an assignment into a global variable. If the 'nr_irqs' assignment is more than three lines away from other changes, the assignment won't be included in the diff context lines and hence won't be visible without inspecting the modified file. With this patch series applied, such accidental conversions from assignments to a local variable into an assignment to a global variable are converted into a compilation error.
--- include/linux/irqnr.h | 2 ++ kernel/irq/irqdesc.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+)
include/linux/irqnr.h +2 -0
@@ -6,6 +6,8 @@extern int nr_irqs; +unsigned int irq_get_nr_irqs (void )__pure ; +unsigned int irq_set_nr_irqs (unsigned int nr);extern struct irq_desc *irq_to_desc (unsigned int irq);unsigned int irq_get_next_irq (unsigned int offset);
kernel/irq/irqdesc.c +23 -0
@@ -141,6 +141,29 @@ static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node,int nr_irqs =NR_IRQS ;EXPORT_SYMBOL_GPL (nr_irqs); +/** +* irq_get_nr_irqs() - Number of interrupts supported by the system. +*/ +unsigned int irq_get_nr_irqs (void ) +{ +return nr_irqs; +} +EXPORT_SYMBOL_GPL (irq_get_nr_irqs); + +/** +* irq_set_nr_irqs() - Set the number of interrupts supported by the system. +* @nr: New number of interrupts. +* +* Return: @nr. +*/ +unsigned int irq_set_nr_irqs (unsigned int nr) +{ + nr_irqs = nr; + +return nr; +} +EXPORT_SYMBOL_GPL (irq_set_nr_irqs); +static DEFINE_MUTEX (sparse_irq_lock); static struct maple_tree sparse_irqs = MTREE_INIT_EXT(sparse_irqs, MT_FLAGS_ALLOC_RANGE |
[tip: irq/core] genirq: Introduce irq_get_nr_irqs() and irq_set_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 5280a14a6079040205a1d968cd80f20448d047c7 Gitweb: https://git.kernel.org/tip/5280a14a6079040205a1d968cd80f20448d047c7 Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:32 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:56 +02:00
genirq: Introduce irq_get_nr_irqs() and irq_set_nr_irqs()
Prepare for changing 'nr_irqs' from an exported global variable into a variable with file scope.
This will prevent accidental changes of assignments to a local variable 'nr_irqs' into assignments to the global 'nr_irqs' variable.
Suppose that a patch would be submitted for review that removes a declaration of a local variable with the name 'nr_irqs' and that that patch does not remove all assignments to that local variable. Such a patch converts an assignment to a local variable into an assignment into a global variable. If the 'nr_irqs' assignment is more than three lines away from other changes, the assignment won't be included in the diff context lines and hence won't be visible without inspecting the modified file.
With these abstraction series applied, such accidental conversions from assignments to a local variable into an assignment to a global variable are converted into a compilation error.
--- include/linux/irqnr.h | 2 ++ kernel/irq/irqdesc.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+)
include/linux/irqnr.h +2 -0
@@ -6,6 +6,8 @@extern int nr_irqs; +unsigned int irq_get_nr_irqs (void )__pure ; +unsigned int irq_set_nr_irqs (unsigned int nr);extern struct irq_desc *irq_to_desc (unsigned int irq);unsigned int irq_get_next_irq (unsigned int offset);
kernel/irq/irqdesc.c +23 -0
@@ -141,6 +141,29 @@ static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node,int nr_irqs =NR_IRQS ;EXPORT_SYMBOL_GPL (nr_irqs); +/** +* irq_get_nr_irqs() - Number of interrupts supported by the system. +*/ +unsigned int irq_get_nr_irqs (void ) +{ +return nr_irqs; +} +EXPORT_SYMBOL_GPL (irq_get_nr_irqs); + +/** +* irq_set_nr_irqs() - Set the number of interrupts supported by the system. +* @nr: New number of interrupts. +* +* Return: @nr. +*/ +unsigned int irq_set_nr_irqs (unsigned int nr) +{ + nr_irqs = nr; + +return nr; +} +EXPORT_SYMBOL_GPL (irq_set_nr_irqs); +static DEFINE_MUTEX (sparse_irq_lock); static struct maple_tree sparse_irqs = MTREE_INIT_EXT(sparse_irqs, MT_FLAGS_ALLOC_RANGE |
PATCH v3 2/22 ARM: Switch to irq_get_nr_irqs() / irq_set_nr_irqs()
In reply to Bart Van AsscheUse the irq_get_nr_irqs() and irq_set_nr_irqs() functions instead of the global variable 'nr_irqs'. Prepare for changing 'nr_irqs' from an exported global variable into a variable with file scope.
--- arch/arm/kernel/irq.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm/kernel/irq.c +2 -3
@@ -111,7 +111,7 @@ void handle_IRQ(unsigned int irq, struct pt_regs *regs)* Some hardware gives randomly wrong interrupts. Rather * than crashing, do something sensible. */ -if (unlikely (!irq || irq >= nr_irqs)) +if (unlikely (!irq || irq >=irq_get_nr_irqs ())) desc =NULL ;else desc =irq_to_desc (irq);
@@ -151,7 +151,6 @@ void __init init_IRQ(void)#ifdef CONFIG_SPARSE_IRQ int __init arch_probe_nr_irqs (void ) { - nr_irqs = machine_desc->nr_irqs ? machine_desc->nr_irqs :NR_IRQS ; -return nr_irqs; +return irq_set_nr_irqs (machine_desc->nr_irqs ? :NR_IRQS ); }#endif
[tip: irq/core] ARM: Switch to irq_get_nr_irqs() / irq_set_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: bc033158a0e691428b6acc9bc8ab16566651ec0c Gitweb: https://git.kernel.org/tip/bc033158a0e691428b6acc9bc8ab16566651ec0c Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:33 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:56 +02:00
ARM: Switch to irq_get_nr_irqs() / irq_set_nr_irqs()
Use the irq_get_nr_irqs() and irq_set_nr_irqs() functions instead of the global variable 'nr_irqs'. Prepare for changing 'nr_irqs' from an exported global variable into a variable with file scope.
--- arch/arm/kernel/irq.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm/kernel/irq.c +2 -3
@@ -111,7 +111,7 @@ void handle_IRQ(unsigned int irq, struct pt_regs *regs)* Some hardware gives randomly wrong interrupts. Rather * than crashing, do something sensible. */ -if (unlikely (!irq || irq >= nr_irqs)) +if (unlikely (!irq || irq >=irq_get_nr_irqs ())) desc =NULL ;else desc =irq_to_desc (irq);
@@ -151,7 +151,6 @@ void __init init_IRQ(void)#ifdef CONFIG_SPARSE_IRQ int __init arch_probe_nr_irqs (void ) { - nr_irqs = machine_desc->nr_irqs ? machine_desc->nr_irqs :NR_IRQS ; -return nr_irqs; +return irq_set_nr_irqs (machine_desc->nr_irqs ? :NR_IRQS ); }#endif
PATCH v3 3/22 LoongArch: Switch to irq_set_nr_irqs()
In reply to Bart Van AsscheUse the irq_set_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.
--- arch/loongarch/kernel/irq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/loongarch/kernel/irq.c +2 -2
@@ -92,9 +92,9 @@ int __init arch_probe_nr_irqs(void)int nr_io_pics =bitmap_weight (loongson_sysconf.cores_io_master,NR_CPUS );if (!cpu_has_avecint) - nr_irqs = (64 +NR_VECTORS * nr_io_pics); +irq_set_nr_irqs (64 +NR_VECTORS * nr_io_pics);else - nr_irqs = (64 +NR_VECTORS * (nr_cpu_ids + nr_io_pics)); +irq_set_nr_irqs (64 +NR_VECTORS * (nr_cpu_ids + nr_io_pics));return NR_IRQS_LEGACY ; }
[tip: irq/core] LoongArch: Switch to irq_set_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: f90ff314a92f2eee5c00590a17e99f7f8bd7a32d Gitweb: https://git.kernel.org/tip/f90ff314a92f2eee5c00590a17e99f7f8bd7a32d Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:34 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:56 +02:00
LoongArch: Switch to irq_set_nr_irqs()
Use the irq_set_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.
--- arch/loongarch/kernel/irq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/loongarch/kernel/irq.c +2 -2
@@ -92,9 +92,9 @@ int __init arch_probe_nr_irqs(void)int nr_io_pics =bitmap_weight (loongson_sysconf.cores_io_master,NR_CPUS );if (!cpu_has_avecint) - nr_irqs = (64 +NR_VECTORS * nr_io_pics); +irq_set_nr_irqs (64 +NR_VECTORS * nr_io_pics);else - nr_irqs = (64 +NR_VECTORS * (nr_cpu_ids + nr_io_pics)); +irq_set_nr_irqs (64 +NR_VECTORS * (nr_cpu_ids + nr_io_pics));return NR_IRQS_LEGACY ; }
PATCH v3 4/22 powerpc/cell: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse 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.
--- arch/powerpc/platforms/cell/axon_msi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/cell/axon_msi.c +1 -1
@@ -112,7 +112,7 @@ static void axon_msi_cascade(struct irq_desc *desc)pr_devel ("axon_msi: woff %x roff %x msi %x\n" , write_offset, msic->read_offset, msi); -if (msi < nr_irqs &&irq_get_chip_data (msi) == msic) { +if (msi <irq_get_nr_irqs () &&irq_get_chip_data (msi) == msic) {generic_handle_irq (msi); msic->fifo_virt[idx] =cpu_to_le32 (0xffffffff ); }else {
Re: [PATCH v3 04/22] powerpc/cell: Switch to irq_get_nr_irqs()
Quoted 9 lines · Bart Van Assche
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 <[email protected]>--- arch/powerpc/platforms/cell/axon_msi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cheers
Quoted 13 lines
arch/powerpc/platforms/cell/axon_msi.c +1
-1@@ -112,7 +112,7 @@ static void axon_msi_cascade(struct irq_desc *desc)pr_devel ("axon_msi: woff %x roff %x msi %x\n" , write_offset, msic->read_offset, msi); -if (msi < nr_irqs &&irq_get_chip_data (msi) == msic) { +if (msi <irq_get_nr_irqs () &&irq_get_chip_data (msi) == msic) {generic_handle_irq (msi); msic->fifo_virt[idx] =cpu_to_le32 (0xffffffff ); }else {
[tip: irq/core] powerpc/cell: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheThe following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 29f42eb1a3cbaa48c6fae1e36d97162e1f6ab1ae Gitweb: https://git.kernel.org/tip/29f42eb1a3cbaa48c6fae1e36d97162e1f6ab1ae Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:35 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:57 +02:00
powerpc/cell: 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.
--- arch/powerpc/platforms/cell/axon_msi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/cell/axon_msi.c +1 -1
@@ -112,7 +112,7 @@ static void axon_msi_cascade(struct irq_desc *desc)pr_devel ("axon_msi: woff %x roff %x msi %x\n" , write_offset, msic->read_offset, msi); -if (msi < nr_irqs &&irq_get_chip_data (msi) == msic) { +if (msi <irq_get_nr_irqs () &&irq_get_chip_data (msi) == msic) {generic_handle_irq (msi); msic->fifo_virt[idx] =cpu_to_le32 (0xffffffff ); }else {
PATCH v3 5/22 s390/irq: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse 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.
--- arch/s390/kernel/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kernel/irq.c +1 -1
@@ -253,7 +253,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_putc (p,'\n' ); goto out; } -if (index < nr_irqs) { +if (index <irq_get_nr_irqs ()) {show_msi_interrupt (p, index); goto out; }
[tip: irq/core] s390/irq: Switch to irq_get_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 951248383a9029f236e80c3e408012f6e280fb2f Gitweb: https://git.kernel.org/tip/951248383a9029f236e80c3e408012f6e280fb2f Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:36 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:57 +02:00
s390/irq: 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.
--- arch/s390/kernel/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kernel/irq.c +1 -1
@@ -253,7 +253,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_putc (p,'\n' ); goto out; } -if (index < nr_irqs) { +if (index <irq_get_nr_irqs ()) {show_msi_interrupt (p, index); goto out; }
PATCH v3 6/22 x86/acpi: Switch to irq_get_nr_irqs() and irq_set_nr_irqs()
In reply to Bart Van AsscheUse the irq_get_nr_irqs() and irq_set_nr_irqs() functions instead of the global variable 'nr_irqs'. Prepare for changing 'nr_irqs' from an exported global variable into a variable with file scope.
--- arch/x86/kernel/acpi/boot.c | 6 ++++-- arch/x86/kernel/apic/vector.c | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-)
arch/x86/kernel/acpi/boot.c +4 -2
@@ -1171,7 +1171,8 @@ static int __init acpi_parse_madt_ioapic_entries(void) } count =acpi_table_parse_madt (ACPI_MADT_TYPE_INTERRUPT_OVERRIDE , - acpi_parse_int_src_ovr, nr_irqs); + acpi_parse_int_src_ovr, +irq_get_nr_irqs ());if (count <0 ) {pr_err ("Error parsing interrupt source overrides entry\n" );/* TBD: Cleanup to allow fallback to MPS */
@@ -1191,7 +1192,8 @@ static int __init acpi_parse_madt_ioapic_entries(void)mp_config_acpi_legacy_irqs (); count =acpi_table_parse_madt (ACPI_MADT_TYPE_NMI_SOURCE , - acpi_parse_nmi_src, nr_irqs); + acpi_parse_nmi_src, +irq_get_nr_irqs ());if (count <0 ) {pr_err ("Error parsing NMI SRC entry\n" );/* TBD: Cleanup to allow fallback to MPS */
arch/x86/kernel/apic/vector.c +4 -4
@@ -712,8 +712,8 @@ int __init arch_probe_nr_irqs(void) {int nr; -if (nr_irqs > (NR_VECTORS * nr_cpu_ids)) - nr_irqs =NR_VECTORS * nr_cpu_ids; +if (irq_get_nr_irqs () >NR_VECTORS * nr_cpu_ids) +irq_set_nr_irqs (NR_VECTORS * nr_cpu_ids); nr = (gsi_top +nr_legacy_irqs ()) +8 * nr_cpu_ids;#if defined(CONFIG_PCI_MSI )
@@ -725,8 +725,8 @@ int __init arch_probe_nr_irqs(void) else nr += gsi_top * 16;#endif -if (nr < nr_irqs) - nr_irqs = nr; +if (nr <irq_get_nr_irqs ()) +irq_set_nr_irqs (nr);/* * We don't know if PIC is present at this point so we need to do
[tip: irq/core] x86/acpi: Switch to irq_get_nr_irqs() and irq_set_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: f642974c0b772a18675602f2a366aa49d07baf8c Gitweb: https://git.kernel.org/tip/f642974c0b772a18675602f2a366aa49d07baf8c Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:37 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:57 +02:00
x86/acpi: Switch to irq_get_nr_irqs() and irq_set_nr_irqs()
Use the irq_get_nr_irqs() and irq_set_nr_irqs() functions instead of the global variable 'nr_irqs'. Prepare for changing 'nr_irqs' from an exported global variable into a variable with file scope.
--- arch/x86/kernel/acpi/boot.c | 6 ++++-- arch/x86/kernel/apic/vector.c | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-)
arch/x86/kernel/acpi/boot.c +4 -2
@@ -1171,7 +1171,8 @@ static int __init acpi_parse_madt_ioapic_entries(void) } count =acpi_table_parse_madt (ACPI_MADT_TYPE_INTERRUPT_OVERRIDE , - acpi_parse_int_src_ovr, nr_irqs); + acpi_parse_int_src_ovr, +irq_get_nr_irqs ());if (count <0 ) {pr_err ("Error parsing interrupt source overrides entry\n" );/* TBD: Cleanup to allow fallback to MPS */
@@ -1191,7 +1192,8 @@ static int __init acpi_parse_madt_ioapic_entries(void)mp_config_acpi_legacy_irqs (); count =acpi_table_parse_madt (ACPI_MADT_TYPE_NMI_SOURCE , - acpi_parse_nmi_src, nr_irqs); + acpi_parse_nmi_src, +irq_get_nr_irqs ());if (count <0 ) {pr_err ("Error parsing NMI SRC entry\n" );/* TBD: Cleanup to allow fallback to MPS */
arch/x86/kernel/apic/vector.c +4 -4
@@ -712,8 +712,8 @@ int __init arch_probe_nr_irqs(void) {int nr; -if (nr_irqs > (NR_VECTORS * nr_cpu_ids)) - nr_irqs =NR_VECTORS * nr_cpu_ids; +if (irq_get_nr_irqs () >NR_VECTORS * nr_cpu_ids) +irq_set_nr_irqs (NR_VECTORS * nr_cpu_ids); nr = (gsi_top +nr_legacy_irqs ()) +8 * nr_cpu_ids;#if defined(CONFIG_PCI_MSI )
@@ -725,8 +725,8 @@ int __init arch_probe_nr_irqs(void) else nr += gsi_top * 16;#endif -if (nr < nr_irqs) - nr_irqs = nr; +if (nr <irq_get_nr_irqs ()) +irq_set_nr_irqs (nr);/* * We don't know if PIC is present at this point so we need to do
PATCH v3 7/22 hpet: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse 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.
--- drivers/char/hpet.c | 1 + 1 file changed, 1 insertion(+)
drivers/char/hpet.c +1 -0
@@ -162,6 +162,7 @@ static irqreturn_t hpet_interrupt(int irq, void *data)static void hpet_timer_set_irq (struct hpet_dev *devp) { +const unsigned int nr_irqs =irq_get_nr_irqs ();unsigned long v;int irq, gsi;struct hpet_timer __iomem *timer;
[tip: irq/core] hpet: Switch to irq_get_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: ce1fa22a659dad1a14ae9ede2063e5bc6c9a86fb Gitweb: https://git.kernel.org/tip/ce1fa22a659dad1a14ae9ede2063e5bc6c9a86fb Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:38 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:57 +02:00
hpet: 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.
--- drivers/char/hpet.c | 1 + 1 file changed, 1 insertion(+)
drivers/char/hpet.c +1 -0
@@ -162,6 +162,7 @@ static irqreturn_t hpet_interrupt(int irq, void *data)static void hpet_timer_set_irq (struct hpet_dev *devp) { +const unsigned int nr_irqs =irq_get_nr_irqs ();unsigned long v;int irq, gsi;struct hpet_timer __iomem *timer;
PATCH v3 8/22 net: 3com: 3c59x: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse 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.
--- drivers/net/ethernet/3com/3c59x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/3com/3c59x.c +1 -1
@@ -1302,7 +1302,7 @@ static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq,if (print_info)pr_cont (", IRQ %d\n" , dev->irq);/* Tell them about an invalid IRQ. */ -if (dev->irq <=0 || dev->irq >= nr_irqs) +if (dev->irq <=0 || dev->irq >=irq_get_nr_irqs ())pr_warn (" *** Warning: IRQ %d is unlikely to work! ***\n" , dev->irq);
[tip: irq/core] net: 3com: 3c59x: Switch to irq_get_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: fb474ac2f4898b3c63ec9439219c0665c0773bb1 Gitweb: https://git.kernel.org/tip/fb474ac2f4898b3c63ec9439219c0665c0773bb1 Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:39 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:57 +02:00
net: 3com: 3c59x: 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.
--- drivers/net/ethernet/3com/3c59x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/3com/3c59x.c +1 -1
@@ -1302,7 +1302,7 @@ static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq,if (print_info)pr_cont (", IRQ %d\n" , dev->irq);/* Tell them about an invalid IRQ. */ -if (dev->irq <=0 || dev->irq >= nr_irqs) +if (dev->irq <=0 || dev->irq >=irq_get_nr_irqs ())pr_warn (" *** Warning: IRQ %d is unlikely to work! ***\n" , dev->irq);
PATCH v3 9/22 net: hamradio: baycom_ser_fdx: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse 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.
--- drivers/net/hamradio/baycom_ser_fdx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/hamradio/baycom_ser_fdx.c +1 -0
@@ -373,6 +373,7 @@ static enum uart ser12_check_uart(unsigned int iobase)static int ser12_open (struct net_device *dev) { +const unsigned int nr_irqs =irq_get_nr_irqs ();struct baycom_state *bc =netdev_priv (dev);enum uart u;
[tip: irq/core] net: hamradio: baycom_ser_fdx: Switch to irq_get_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: bc6e6f07ebeda52e9cd515a11f62c6a6abb6f50a Gitweb: https://git.kernel.org/tip/bc6e6f07ebeda52e9cd515a11f62c6a6abb6f50a Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:40 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:57 +02:00
net: hamradio: baycom_ser_fdx: 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.
--- drivers/net/hamradio/baycom_ser_fdx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/hamradio/baycom_ser_fdx.c +1 -0
@@ -373,6 +373,7 @@ static enum uart ser12_check_uart(unsigned int iobase)static int ser12_open (struct net_device *dev) { +const unsigned int nr_irqs =irq_get_nr_irqs ();struct baycom_state *bc =netdev_priv (dev);enum uart u;
PATCH v3 10/22 net: hamradio: scc: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse 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.
--- drivers/net/hamradio/scc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/hamradio/scc.c +3 -1
@@ -1460,6 +1460,7 @@ scc_start_calibrate(struct scc_channel *scc, int duration, unsigned char patternstatic void z8530_init (void ) { +const unsigned int nr_irqs =irq_get_nr_irqs ();struct scc_channel *scc;int chip, k;unsigned long flags;
@@ -1735,7 +1736,7 @@ static int scc_net_siocdevprivate(struct net_device *dev,if (hwcfg.irq ==2 ) hwcfg.irq =9 ; -if (hwcfg.irq <0 || hwcfg.irq >= nr_irqs) +if (hwcfg.irq <0 || hwcfg.irq >=irq_get_nr_irqs ())return -EINVAL ;if (!Ivec[hwcfg.irq].used && hwcfg.irq)
@@ -2117,6 +2118,7 @@ static int __init scc_init_driver (void) static void __exit scc_cleanup_driver(void) { +const unsigned int nr_irqs =irq_get_nr_irqs ();io_port ctrl;int k;struct scc_channel *scc;
[tip: irq/core] net: hamradio: scc: Switch to irq_get_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 4e69f13167f5618b5d487aa88db4800d0934a994 Gitweb: https://git.kernel.org/tip/4e69f13167f5618b5d487aa88db4800d0934a994 Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:41 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:57 +02:00
net: hamradio: scc: 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.
--- drivers/net/hamradio/scc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/hamradio/scc.c +3 -1
@@ -1460,6 +1460,7 @@ scc_start_calibrate(struct scc_channel *scc, int duration, unsigned char patternstatic void z8530_init (void ) { +const unsigned int nr_irqs =irq_get_nr_irqs ();struct scc_channel *scc;int chip, k;unsigned long flags;
@@ -1735,7 +1736,7 @@ static int scc_net_siocdevprivate(struct net_device *dev,if (hwcfg.irq ==2 ) hwcfg.irq =9 ; -if (hwcfg.irq <0 || hwcfg.irq >= nr_irqs) +if (hwcfg.irq <0 || hwcfg.irq >=irq_get_nr_irqs ())return -EINVAL ;if (!Ivec[hwcfg.irq].used && hwcfg.irq)
@@ -2117,6 +2118,7 @@ static int __init scc_init_driver (void) static void __exit scc_cleanup_driver(void) { +const unsigned int nr_irqs =irq_get_nr_irqs ();io_port ctrl;int k;struct scc_channel *scc;
PATCH v3 11/22 scsi: aha152x: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse 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.
--- drivers/scsi/aha152x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/aha152x.c +1 -1
@@ -295,7 +295,7 @@ CMD_INC_RESID(struct scsi_cmnd *cmd, int inc)#else #define IRQ_MIN 9#if defined(__PPC) -#define IRQ_MAX (nr_irqs-1) +#define IRQ_MAX (irq_get_nr_irqs()-1)#else #define IRQ_MAX 12#endif
[tip: irq/core] scsi: aha152x: Switch to irq_get_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 03f039def8332fef5efd93795291ad13cb187d65 Gitweb: https://git.kernel.org/tip/03f039def8332fef5efd93795291ad13cb187d65 Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:42 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:58 +02:00
scsi: aha152x: 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.
--- drivers/scsi/aha152x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/aha152x.c +1 -1
@@ -295,7 +295,7 @@ CMD_INC_RESID(struct scsi_cmnd *cmd, int inc)#else #define IRQ_MIN 9#if defined(__PPC) -#define IRQ_MAX (nr_irqs-1) +#define IRQ_MAX (irq_get_nr_irqs()-1)#else #define IRQ_MAX 12#endif
PATCH v3 12/22 serial: core: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse 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.
--- drivers/tty/serial/serial_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/serial_core.c +1 -1
@@ -919,7 +919,7 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port,if (uport->ops->verify_port) retval = uport->ops->verify_port (uport, new_info); -if ((new_info->irq >= nr_irqs) || (new_info->irq <0 ) || +if ((new_info->irq >=irq_get_nr_irqs ()) || (new_info->irq <0 ) || (new_info->baud_base <9600 )) retval = -EINVAL ;
[tip: irq/core] serial: core: Switch to irq_get_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 5732a63bada9923b4edcf90860fb8697d7c1231b Gitweb: https://git.kernel.org/tip/5732a63bada9923b4edcf90860fb8697d7c1231b Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:43 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:58 +02:00
serial: core: 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.
--- drivers/tty/serial/serial_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/serial_core.c +1 -1
@@ -919,7 +919,7 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port,if (uport->ops->verify_port) retval = uport->ops->verify_port (uport, new_info); -if ((new_info->irq >= nr_irqs) || (new_info->irq <0 ) || +if ((new_info->irq >=irq_get_nr_irqs ()) || (new_info->irq <0 ) || (new_info->baud_base <9600 )) retval = -EINVAL ;
PATCH v3 13/22 serial: 8250: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse 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.
--- drivers/tty/serial/8250/8250_port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_port.c +1 -1
@@ -3176,7 +3176,7 @@ static void serial8250_config_port(struct uart_port *port, int flags)static int serial8250_verify_port (struct uart_port *port,struct serial_struct *ser) { -if (ser->irq >= nr_irqs || ser->irq <0 || +if (ser->irq >=irq_get_nr_irqs () || ser->irq <0 || ser->baud_base <9600 || ser->type <PORT_UNKNOWN || ser->type >=ARRAY_SIZE (uart_config) || ser->type ==PORT_CIRRUS || ser->type ==PORT_STARTECH )
[tip: irq/core] serial: 8250: Switch to irq_get_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 4846c4c17e292537d4fedd9995432d3a0d78d355 Gitweb: https://git.kernel.org/tip/4846c4c17e292537d4fedd9995432d3a0d78d355 Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:44 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:58 +02:00
serial: 8250: 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.
--- drivers/tty/serial/8250/8250_port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_port.c +1 -1
@@ -3176,7 +3176,7 @@ static void serial8250_config_port(struct uart_port *port, int flags)static int serial8250_verify_port (struct uart_port *port,struct serial_struct *ser) { -if (ser->irq >= nr_irqs || ser->irq <0 || +if (ser->irq >=irq_get_nr_irqs () || ser->irq <0 || ser->baud_base <9600 || ser->type <PORT_UNKNOWN || ser->type >=ARRAY_SIZE (uart_config) || ser->type ==PORT_CIRRUS || ser->type ==PORT_STARTECH )
PATCH v3 14/22 serial: amba-pl010: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse 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.
--- drivers/tty/serial/amba-pl010.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/amba-pl010.c +1 -1
@@ -499,7 +499,7 @@ static int pl010_verify_port(struct uart_port *port, struct serial_struct *ser)int ret =0 ;if (ser->type !=PORT_UNKNOWN && ser->type !=PORT_AMBA ) ret = -EINVAL ; -if (ser->irq <0 || ser->irq >= nr_irqs) +if (ser->irq <0 || ser->irq >=irq_get_nr_irqs ()) ret = -EINVAL ;if (ser->baud_base <9600 ) ret = -EINVAL ;
[tip: irq/core] serial: amba-pl010: Switch to irq_get_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 3905fb8738ca3474982a4d230e9493a409837388 Gitweb: https://git.kernel.org/tip/3905fb8738ca3474982a4d230e9493a409837388 Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:45 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:58 +02:00
serial: amba-pl010: 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.
--- drivers/tty/serial/amba-pl010.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/amba-pl010.c +1 -1
@@ -499,7 +499,7 @@ static int pl010_verify_port(struct uart_port *port, struct serial_struct *ser)int ret =0 ;if (ser->type !=PORT_UNKNOWN && ser->type !=PORT_AMBA ) ret = -EINVAL ; -if (ser->irq <0 || ser->irq >= nr_irqs) +if (ser->irq <0 || ser->irq >=irq_get_nr_irqs ()) ret = -EINVAL ;if (ser->baud_base <9600 ) ret = -EINVAL ;
PATCH v3 15/22 serial: amba-pl011: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse 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.
--- drivers/tty/serial/amba-pl011.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/amba-pl011.c +1 -1
@@ -2202,7 +2202,7 @@ static int pl011_verify_port(struct uart_port *port, struct serial_struct *ser)if (ser->type !=PORT_UNKNOWN && ser->type !=PORT_AMBA ) ret = -EINVAL ; -if (ser->irq <0 || ser->irq >= nr_irqs) +if (ser->irq <0 || ser->irq >=irq_get_nr_irqs ()) ret = -EINVAL ;if (ser->baud_base <9600 ) ret = -EINVAL ;
[tip: irq/core] serial: amba-pl011: Switch to irq_get_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: d1a9a2f4ca62c35cc0ffab653241ef686a6a7526 Gitweb: https://git.kernel.org/tip/d1a9a2f4ca62c35cc0ffab653241ef686a6a7526 Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:46 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:58 +02:00
serial: amba-pl011: 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.
--- drivers/tty/serial/amba-pl011.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/amba-pl011.c +1 -1
@@ -2202,7 +2202,7 @@ static int pl011_verify_port(struct uart_port *port, struct serial_struct *ser)if (ser->type !=PORT_UNKNOWN && ser->type !=PORT_AMBA ) ret = -EINVAL ; -if (ser->irq <0 || ser->irq >= nr_irqs) +if (ser->irq <0 || ser->irq >=irq_get_nr_irqs ()) ret = -EINVAL ;if (ser->baud_base <9600 ) ret = -EINVAL ;
PATCH v3 16/22 serial: cpm_uart: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse 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.
--- drivers/tty/serial/cpm_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/cpm_uart.c +1 -1
@@ -631,7 +631,7 @@ static int cpm_uart_verify_port(struct uart_port *port,if (ser->type !=PORT_UNKNOWN && ser->type !=PORT_CPM ) ret = -EINVAL ; -if (ser->irq <0 || ser->irq >= nr_irqs) +if (ser->irq <0 || ser->irq >=irq_get_nr_irqs ()) ret = -EINVAL ;if (ser->baud_base <9600 ) ret = -EINVAL ;
[tip: irq/core] serial: cpm_uart: Switch to irq_get_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: b9b5df2986c1195504a0c8d1c44691ec099815df Gitweb: https://git.kernel.org/tip/b9b5df2986c1195504a0c8d1c44691ec099815df Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:47 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:58 +02:00
serial: cpm_uart: 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.
--- drivers/tty/serial/cpm_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/cpm_uart.c +1 -1
@@ -631,7 +631,7 @@ static int cpm_uart_verify_port(struct uart_port *port,if (ser->type !=PORT_UNKNOWN && ser->type !=PORT_CPM ) ret = -EINVAL ; -if (ser->irq <0 || ser->irq >= nr_irqs) +if (ser->irq <0 || ser->irq >=irq_get_nr_irqs ()) ret = -EINVAL ;if (ser->baud_base <9600 ) ret = -EINVAL ;
PATCH v3 17/22 serial: ucc_uart: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse 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.
--- drivers/tty/serial/ucc_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/ucc_uart.c +1 -1
@@ -1045,7 +1045,7 @@ static int qe_uart_verify_port(struct uart_port *port,if (ser->type !=PORT_UNKNOWN && ser->type !=PORT_CPM )return -EINVAL ; -if (ser->irq <0 || ser->irq >= nr_irqs) +if (ser->irq <0 || ser->irq >=irq_get_nr_irqs ())return -EINVAL ;if (ser->baud_base <9600 )
[tip: irq/core] serial: ucc_uart: Switch to irq_get_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 18444d339914a6080d832d9e8998ec243f7c3e9e Gitweb: https://git.kernel.org/tip/18444d339914a6080d832d9e8998ec243f7c3e9e Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:48 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:58 +02:00
serial: ucc_uart: 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.
--- drivers/tty/serial/ucc_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/ucc_uart.c +1 -1
@@ -1045,7 +1045,7 @@ static int qe_uart_verify_port(struct uart_port *port,if (ser->type !=PORT_UNKNOWN && ser->type !=PORT_CPM )return -EINVAL ; -if (ser->irq <0 || ser->irq >= nr_irqs) +if (ser->irq <0 || ser->irq >=irq_get_nr_irqs ())return -EINVAL ;if (ser->baud_base <9600 )
PATCH v3 18/22 sh: intc: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse 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.
--- drivers/sh/intc/virq-debugfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/sh/intc/virq-debugfs.c +1 -0
@@ -18,6 +18,7 @@static int intc_irq_xlate_show (struct seq_file *m,void *priv) { +const unsigned int nr_irqs =irq_get_nr_irqs ();int i;seq_printf (m,"%-5s %-7s %-15s\n" ,"irq" ,"enum" ,"chip name" );
[tip: irq/core] sh: intc: Switch to irq_get_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: d0c62d51ede0718203502c192665e1d379fbf207 Gitweb: https://git.kernel.org/tip/d0c62d51ede0718203502c192665e1d379fbf207 Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:49 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:58 +02:00
sh: intc: 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.
--- drivers/sh/intc/virq-debugfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/sh/intc/virq-debugfs.c +1 -0
@@ -18,6 +18,7 @@static int intc_irq_xlate_show (struct seq_file *m,void *priv) { +const unsigned int nr_irqs =irq_get_nr_irqs ();int i;seq_printf (m,"%-5s %-7s %-15s\n" ,"irq" ,"enum" ,"chip name" );
PATCH v3 19/22 xen/events: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse 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.
--- drivers/xen/events/events_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/events/events_base.c +1 -1
@@ -411,7 +411,7 @@ static evtchn_port_t evtchn_from_irq(unsigned int irq) {const struct irq_info *info =NULL ; -if (likely (irq < nr_irqs)) +if (likely (irq <irq_get_nr_irqs ())) info =info_for_irq (irq);if (!info)return 0 ;
[tip: irq/core] xen/events: Switch to irq_get_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 3e48fa2ecf4de8baf8a368987f8ea8ffb64ac7af Gitweb: https://git.kernel.org/tip/3e48fa2ecf4de8baf8a368987f8ea8ffb64ac7af Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:50 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:59 +02:00
xen/events: 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.
--- drivers/xen/events/events_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/events/events_base.c +1 -1
@@ -411,7 +411,7 @@ static evtchn_port_t evtchn_from_irq(unsigned int irq) {const struct irq_info *info =NULL ; -if (likely (irq < nr_irqs)) +if (likely (irq <irq_get_nr_irqs ())) info =info_for_irq (irq);if (!info)return 0 ;
PATCH v3 20/22 fs/procfs: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse 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.
--- fs/proc/interrupts.c | 4 ++-- fs/proc/stat.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
fs/proc/interrupts.c +2 -2
@@ -11,13 +11,13 @@*/ static void *int_seq_start (struct seq_file *f,loff_t *pos) { -return (*pos <= nr_irqs) ? pos :NULL ; +return *pos <=irq_get_nr_irqs () ? pos :NULL ; }static void *int_seq_next (struct seq_file *f,void *v,loff_t *pos) { (*pos)++; -if (*pos > nr_irqs) +if (*pos >irq_get_nr_irqs ())return NULL ;return pos; }
fs/proc/stat.c +2 -2
@@ -76,7 +76,7 @@ static void show_all_irqs(struct seq_file *p)seq_put_decimal_ull (p," " ,kstat_irqs_usr (i)); next = i +1 ; } -show_irq_gap (p, nr_irqs - next); +show_irq_gap (p,irq_get_nr_irqs () - next); }static int show_stat (struct seq_file *p,void *v)
@@ -196,7 +196,7 @@ static int stat_open(struct inode *inode, struct file *file)unsigned int size =1024 +128 *num_online_cpus ();/* minimum size to display an interrupt count : 2 bytes */ - size +=2 * nr_irqs; + size +=2 *irq_get_nr_irqs ();return single_open_size (file, show_stat,NULL , size); }
[tip: irq/core] fs/procfs: Switch to irq_get_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: f4dd946c775e85e4f9aa460cd3dba197c35e43f1 Gitweb: https://git.kernel.org/tip/f4dd946c775e85e4f9aa460cd3dba197c35e43f1 Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:51 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:59 +02:00
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.
--- fs/proc/interrupts.c | 4 ++-- fs/proc/stat.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
fs/proc/interrupts.c +2 -2
@@ -11,13 +11,13 @@*/ static void *int_seq_start (struct seq_file *f,loff_t *pos) { -return (*pos <= nr_irqs) ? pos :NULL ; +return *pos <=irq_get_nr_irqs () ? pos :NULL ; }static void *int_seq_next (struct seq_file *f,void *v,loff_t *pos) { (*pos)++; -if (*pos > nr_irqs) +if (*pos >irq_get_nr_irqs ())return NULL ;return pos; }
fs/proc/stat.c +2 -2
@@ -76,7 +76,7 @@ static void show_all_irqs(struct seq_file *p)seq_put_decimal_ull (p," " ,kstat_irqs_usr (i)); next = i +1 ; } -show_irq_gap (p, nr_irqs - next); +show_irq_gap (p,irq_get_nr_irqs () - next); }static int show_stat (struct seq_file *p,void *v)
@@ -196,7 +196,7 @@ static int stat_open(struct inode *inode, struct file *file)unsigned int size =1024 +128 *num_online_cpus ();/* minimum size to display an interrupt count : 2 bytes */ - size +=2 * nr_irqs; + size +=2 *irq_get_nr_irqs ();return single_open_size (file, show_stat,NULL , size); }
PATCH v3 21/22 genirq: Switch to irq_get_nr_irqs()
In reply to Bart Van AsscheUse the irq_get_nr_irqs() function instead of the global variable 'nr_irqs'. Cache the result of this function in a local variable in order not to rely on CSE (common subexpression elimination). Prepare for changing 'nr_irqs' from an exported global variable into a variable with file scope.
--- include/linux/irqnr.h | 33 +++++++++++++++++++-------------- kernel/irq/irqdomain.c | 2 +- kernel/irq/proc.c | 3 ++- 3 files changed, 22 insertions(+), 16 deletions(-)
include/linux/irqnr.h +19 -14
@@ -11,26 +11,31 @@ unsigned int irq_set_nr_irqs(unsigned int nr);extern struct irq_desc *irq_to_desc (unsigned int irq);unsigned int irq_get_next_irq (unsigned int offset); -# define for_each_irq_desc (irq, desc) \ - for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \ - irq++, desc = irq_to_desc(irq)) \ - if (!desc) \ - ; \ - else - +#define for_each_irq_desc (irq, desc) \ + for (unsigned int __nr_irqs__ = irq_get_nr_irqs(); __nr_irqs__; \ + __nr_irqs__ = 0) \ + for (irq = 0, desc = irq_to_desc(irq); irq < __nr_irqs__; \ + irq++, desc = irq_to_desc(irq)) \ + if (!desc) \ + ; \ + else# define for_each_irq_desc_reverse (irq, desc) \ - for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \ - irq--, desc = irq_to_desc(irq)) \ + for (irq = irq_get_nr_irqs() - 1, desc = irq_to_desc(irq); \ + irq >= 0; irq--, desc = irq_to_desc(irq)) \ if (!desc) \ ; \ else -# define for_each_active_irq (irq) \ - for (irq = irq_get_next_irq(0); irq < nr_irqs; \ - irq = irq_get_next_irq(irq + 1)) +#define for_each_active_irq (irq) \ + for (unsigned int __nr_irqs__ = irq_get_nr_irqs(); __nr_irqs__; \ + __nr_irqs__ = 0) \ + for (irq = irq_get_next_irq(0); irq < __nr_irqs__; \ + irq = irq_get_next_irq(irq + 1)) -#define for_each_irq_nr (irq) \ - for (irq = 0; irq < nr_irqs; irq++) +#define for_each_irq_nr (irq) \ + for (unsigned int __nr_irqs__ = irq_get_nr_irqs(); __nr_irqs__; \ + __nr_irqs__ = 0) \ + for (irq = 0; irq < __nr_irqs__; irq++)#endif
kernel/irq/irqdomain.c +1 -1
@@ -1225,7 +1225,7 @@ int irq_domain_alloc_descs(int virq, unsigned int cnt, irq_hw_number_t hwirq, virq =__irq_alloc_descs (virq, virq, cnt, node,THIS_MODULE , affinity); }else { - hint = hwirq % nr_irqs; + hint = hwirq %irq_get_nr_irqs ();if (hint ==0 ) hint++; virq = __irq_alloc_descs(-1, hint, cnt, node, THIS_MODULE,
kernel/irq/proc.c +2 -1
@@ -457,11 +457,12 @@ int __weak arch_show_interrupts(struct seq_file *p, int prec) }#ifndef ACTUAL_NR_IRQS -# define ACTUAL_NR_IRQS nr_irqs +# define ACTUAL_NR_IRQS irq_get_nr_irqs()#endif int show_interrupts (struct seq_file *p,void *v) { +const unsigned int nr_irqs =irq_get_nr_irqs ();static int prec;int i = *(loff_t *) v, j;
[tip: irq/core] genirq: Switch to irq_get_nr_irqs()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 1ad2048bf7146efb83bc033147ca1611a7fe8494 Gitweb: https://git.kernel.org/tip/1ad2048bf7146efb83bc033147ca1611a7fe8494 Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:52 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:59 +02:00
genirq: Switch to irq_get_nr_irqs()
Use the irq_get_nr_irqs() function instead of the global variable 'nr_irqs'. Cache the result of this function in a local variable in order not to rely on CSE (common subexpression elimination). Prepare for changing 'nr_irqs' from an exported global variable into a variable with file scope.
--- include/linux/irqnr.h | 33 +++++++++++++++++++-------------- kernel/irq/irqdomain.c | 2 +- kernel/irq/proc.c | 3 ++- 3 files changed, 22 insertions(+), 16 deletions(-)
include/linux/irqnr.h +19 -14
@@ -11,26 +11,31 @@ unsigned int irq_set_nr_irqs(unsigned int nr);extern struct irq_desc *irq_to_desc (unsigned int irq);unsigned int irq_get_next_irq (unsigned int offset); -# define for_each_irq_desc (irq, desc) \ - for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \ - irq++, desc = irq_to_desc(irq)) \ - if (!desc) \ - ; \ - else - +#define for_each_irq_desc (irq, desc) \ + for (unsigned int __nr_irqs__ = irq_get_nr_irqs(); __nr_irqs__; \ + __nr_irqs__ = 0) \ + for (irq = 0, desc = irq_to_desc(irq); irq < __nr_irqs__; \ + irq++, desc = irq_to_desc(irq)) \ + if (!desc) \ + ; \ + else# define for_each_irq_desc_reverse (irq, desc) \ - for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \ - irq--, desc = irq_to_desc(irq)) \ + for (irq = irq_get_nr_irqs() - 1, desc = irq_to_desc(irq); \ + irq >= 0; irq--, desc = irq_to_desc(irq)) \ if (!desc) \ ; \ else -# define for_each_active_irq (irq) \ - for (irq = irq_get_next_irq(0); irq < nr_irqs; \ - irq = irq_get_next_irq(irq + 1)) +#define for_each_active_irq (irq) \ + for (unsigned int __nr_irqs__ = irq_get_nr_irqs(); __nr_irqs__; \ + __nr_irqs__ = 0) \ + for (irq = irq_get_next_irq(0); irq < __nr_irqs__; \ + irq = irq_get_next_irq(irq + 1)) -#define for_each_irq_nr (irq) \ - for (irq = 0; irq < nr_irqs; irq++) +#define for_each_irq_nr (irq) \ + for (unsigned int __nr_irqs__ = irq_get_nr_irqs(); __nr_irqs__; \ + __nr_irqs__ = 0) \ + for (irq = 0; irq < __nr_irqs__; irq++)#endif
kernel/irq/irqdomain.c +1 -1
@@ -1225,7 +1225,7 @@ int irq_domain_alloc_descs(int virq, unsigned int cnt, irq_hw_number_t hwirq, virq =__irq_alloc_descs (virq, virq, cnt, node,THIS_MODULE , affinity); }else { - hint = hwirq % nr_irqs; + hint = hwirq %irq_get_nr_irqs ();if (hint ==0 ) hint++; virq = __irq_alloc_descs(-1, hint, cnt, node, THIS_MODULE,
kernel/irq/proc.c +2 -1
@@ -457,11 +457,12 @@ int __weak arch_show_interrupts(struct seq_file *p, int prec) }#ifndef ACTUAL_NR_IRQS -# define ACTUAL_NR_IRQS nr_irqs +# define ACTUAL_NR_IRQS irq_get_nr_irqs()#endif int show_interrupts (struct seq_file *p,void *v) { +const unsigned int nr_irqs =irq_get_nr_irqs ();static int prec;int i = *(loff_t *) v, j;
PATCH v3 22/22 genirq: Unexport nr_irqs
In reply to Bart Van AsscheUnexport nr_irqs and declare it static now that all code that reads or modifies nr_irqs has been converted to number_of_interrupts() / set_number_of_interrupts(). Change the type of 'nr_irqs' from 'int' into 'unsigned int' to match the return type and argument type of the irq_get_nr_iqs() / irq_set_nr_irqs() functions.
--- include/linux/irqnr.h | 1 - kernel/irq/irqdesc.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-)
include/linux/irqnr.h +0 -1
@@ -5,7 +5,6 @@#include <uapi/linux/irqnr.h> -extern int nr_irqs;unsigned int irq_get_nr_irqs (void )__pure ;unsigned int irq_set_nr_irqs (unsigned int nr);extern struct irq_desc *irq_to_desc (unsigned int irq);
kernel/irq/irqdesc.c +1 -2
@@ -138,8 +138,7 @@ static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node,desc_smp_init (desc, node, affinity); } -int nr_irqs =NR_IRQS ; -EXPORT_SYMBOL_GPL (nr_irqs); +static unsigned int nr_irqs =NR_IRQS ;/** * irq_get_nr_irqs() - Number of interrupts supported by the system.
[tip: irq/core] genirq: Unexport nr_irqs
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: ef4c675dc2961ee533bdc1ea20390761df0af5be Gitweb: https://git.kernel.org/tip/ef4c675dc2961ee533bdc1ea20390761df0af5be Author: Bart Van Assche <[email protected]> AuthorDate: Tue, 15 Oct 2024 12:09:53 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 16 Oct 2024 21:56:59 +02:00
genirq: Unexport nr_irqs
Unexport nr_irqs and declare it static now that all code that reads or modifies nr_irqs has been converted to number_of_interrupts() / set_number_of_interrupts(). Change the type of 'nr_irqs' from 'int' into 'unsigned int' to match the return type and argument type of the irq_get_nr_iqs() / irq_set_nr_irqs() functions.
--- include/linux/irqnr.h | 1 - kernel/irq/irqdesc.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-)
include/linux/irqnr.h +0 -1
@@ -5,7 +5,6 @@#include <uapi/linux/irqnr.h> -extern int nr_irqs;unsigned int irq_get_nr_irqs (void )__pure ;unsigned int irq_set_nr_irqs (unsigned int nr);extern struct irq_desc *irq_to_desc (unsigned int irq);
kernel/irq/irqdesc.c +1 -2
@@ -138,8 +138,7 @@ static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node,desc_smp_init (desc, node, affinity); } -int nr_irqs =NR_IRQS ; -EXPORT_SYMBOL_GPL (nr_irqs); +static unsigned int nr_irqs =NR_IRQS ;/** * irq_get_nr_irqs() - Number of interrupts supported by the system.