mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
irq: introduce nr_irqs
at this point nr_irqs is equal NR_IRQS convert a few easy users from NR_IRQS to dynamic nr_irqs. v2: according to Eric, we need to take care of arch without generic_hardirqs Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
6da55c3e8d
commit
85c0f90978
@ -46,6 +46,8 @@
|
||||
#include <asm/q40ints.h>
|
||||
#endif
|
||||
|
||||
int nr_irqs = NR_IRQS;
|
||||
|
||||
extern u32 auto_irqhandler_fixup[];
|
||||
extern u32 user_irqhandler_fixup[];
|
||||
extern u16 user_irqvec_fixup[];
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/profile.h>
|
||||
|
||||
int nr_irqs = NR_IRQS;
|
||||
|
||||
/*
|
||||
* show_interrupts is needed by /proc/interrupts.
|
||||
*/
|
||||
|
@ -55,6 +55,9 @@
|
||||
#define SMP_NOP2
|
||||
#define SMP_NOP3
|
||||
#endif /* SMP */
|
||||
|
||||
int nr_irqs = NR_IRQS;
|
||||
|
||||
unsigned long __raw_local_irq_save(void)
|
||||
{
|
||||
unsigned long retval;
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include <asm/ptrace.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
extern int nr_irqs;
|
||||
|
||||
/*
|
||||
* These correspond to the IORESOURCE_IRQ_* defines in
|
||||
* linux/ioport.h to select the interrupt line behaviour. When
|
||||
|
@ -38,7 +38,7 @@ unsigned long probe_irq_on(void)
|
||||
* something may have generated an irq long ago and we want to
|
||||
* flush such a longstanding irq before considering it as spurious.
|
||||
*/
|
||||
for (i = NR_IRQS-1; i > 0; i--) {
|
||||
for (i = nr_irqs-1; i > 0; i--) {
|
||||
desc = irq_desc + i;
|
||||
|
||||
spin_lock_irq(&desc->lock);
|
||||
@ -68,7 +68,7 @@ unsigned long probe_irq_on(void)
|
||||
* (we must startup again here because if a longstanding irq
|
||||
* happened in the previous stage, it may have masked itself)
|
||||
*/
|
||||
for (i = NR_IRQS-1; i > 0; i--) {
|
||||
for (i = nr_irqs-1; i > 0; i--) {
|
||||
desc = irq_desc + i;
|
||||
|
||||
spin_lock_irq(&desc->lock);
|
||||
@ -89,7 +89,7 @@ unsigned long probe_irq_on(void)
|
||||
* Now filter out any obviously spurious interrupts
|
||||
*/
|
||||
mask = 0;
|
||||
for (i = 0; i < NR_IRQS; i++) {
|
||||
for (i = 0; i < nr_irqs; i++) {
|
||||
unsigned int status;
|
||||
|
||||
desc = irq_desc + i;
|
||||
@ -130,7 +130,7 @@ unsigned int probe_irq_mask(unsigned long val)
|
||||
int i;
|
||||
|
||||
mask = 0;
|
||||
for (i = 0; i < NR_IRQS; i++) {
|
||||
for (i = 0; i < nr_irqs; i++) {
|
||||
struct irq_desc *desc = irq_desc + i;
|
||||
unsigned int status;
|
||||
|
||||
@ -173,7 +173,7 @@ int probe_irq_off(unsigned long val)
|
||||
{
|
||||
int i, irq_found = 0, nr_irqs = 0;
|
||||
|
||||
for (i = 0; i < NR_IRQS; i++) {
|
||||
for (i = 0; i < nr_irqs; i++) {
|
||||
struct irq_desc *desc = irq_desc + i;
|
||||
unsigned int status;
|
||||
|
||||
|
@ -27,7 +27,7 @@ void dynamic_irq_init(unsigned int irq)
|
||||
struct irq_desc *desc;
|
||||
unsigned long flags;
|
||||
|
||||
if (irq >= NR_IRQS) {
|
||||
if (irq >= nr_irqs) {
|
||||
WARN(1, KERN_ERR "Trying to initialize invalid IRQ%d\n", irq);
|
||||
return;
|
||||
}
|
||||
@ -60,7 +60,7 @@ void dynamic_irq_cleanup(unsigned int irq)
|
||||
struct irq_desc *desc;
|
||||
unsigned long flags;
|
||||
|
||||
if (irq >= NR_IRQS) {
|
||||
if (irq >= nr_irqs) {
|
||||
WARN(1, KERN_ERR "Trying to cleanup invalid IRQ%d\n", irq);
|
||||
return;
|
||||
}
|
||||
@ -92,7 +92,7 @@ int set_irq_chip(unsigned int irq, struct irq_chip *chip)
|
||||
struct irq_desc *desc;
|
||||
unsigned long flags;
|
||||
|
||||
if (irq >= NR_IRQS) {
|
||||
if (irq >= nr_irqs) {
|
||||
WARN(1, KERN_ERR "Trying to install chip for IRQ%d\n", irq);
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -121,7 +121,7 @@ int set_irq_type(unsigned int irq, unsigned int type)
|
||||
unsigned long flags;
|
||||
int ret = -ENXIO;
|
||||
|
||||
if (irq >= NR_IRQS) {
|
||||
if (irq >= nr_irqs) {
|
||||
printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq);
|
||||
return -ENODEV;
|
||||
}
|
||||
@ -149,7 +149,7 @@ int set_irq_data(unsigned int irq, void *data)
|
||||
struct irq_desc *desc;
|
||||
unsigned long flags;
|
||||
|
||||
if (irq >= NR_IRQS) {
|
||||
if (irq >= nr_irqs) {
|
||||
printk(KERN_ERR
|
||||
"Trying to install controller data for IRQ%d\n", irq);
|
||||
return -EINVAL;
|
||||
@ -175,7 +175,7 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry)
|
||||
struct irq_desc *desc;
|
||||
unsigned long flags;
|
||||
|
||||
if (irq >= NR_IRQS) {
|
||||
if (irq >= nr_irqs) {
|
||||
printk(KERN_ERR
|
||||
"Trying to install msi data for IRQ%d\n", irq);
|
||||
return -EINVAL;
|
||||
@ -201,7 +201,7 @@ int set_irq_chip_data(unsigned int irq, void *data)
|
||||
struct irq_desc *desc = irq_desc + irq;
|
||||
unsigned long flags;
|
||||
|
||||
if (irq >= NR_IRQS || !desc->chip) {
|
||||
if (irq >= nr_irqs || !desc->chip) {
|
||||
printk(KERN_ERR "BUG: bad set_irq_chip_data(IRQ#%d)\n", irq);
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -545,7 +545,7 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
|
||||
struct irq_desc *desc;
|
||||
unsigned long flags;
|
||||
|
||||
if (irq >= NR_IRQS) {
|
||||
if (irq >= nr_irqs) {
|
||||
printk(KERN_ERR
|
||||
"Trying to install type control for IRQ%d\n", irq);
|
||||
return;
|
||||
@ -610,7 +610,7 @@ void __init set_irq_noprobe(unsigned int irq)
|
||||
struct irq_desc *desc;
|
||||
unsigned long flags;
|
||||
|
||||
if (irq >= NR_IRQS) {
|
||||
if (irq >= nr_irqs) {
|
||||
printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq);
|
||||
|
||||
return;
|
||||
@ -628,7 +628,7 @@ void __init set_irq_probe(unsigned int irq)
|
||||
struct irq_desc *desc;
|
||||
unsigned long flags;
|
||||
|
||||
if (irq >= NR_IRQS) {
|
||||
if (irq >= nr_irqs) {
|
||||
printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq);
|
||||
|
||||
return;
|
||||
|
@ -47,6 +47,7 @@ handle_bad_irq(unsigned int irq, struct irq_desc *desc)
|
||||
*
|
||||
* Controller mappings for all interrupt sources:
|
||||
*/
|
||||
int nr_irqs = NR_IRQS;
|
||||
struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
|
||||
[0 ... NR_IRQS-1] = {
|
||||
.status = IRQ_DISABLED,
|
||||
@ -265,7 +266,7 @@ void early_init_irq_lock_class(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NR_IRQS; i++)
|
||||
for (i = 0; i < nr_irqs; i++)
|
||||
lockdep_set_class(&irq_desc[i].lock, &irq_desc_lock_class);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ void synchronize_irq(unsigned int irq)
|
||||
struct irq_desc *desc = irq_desc + irq;
|
||||
unsigned int status;
|
||||
|
||||
if (irq >= NR_IRQS)
|
||||
if (irq >= nr_irqs)
|
||||
return;
|
||||
|
||||
do {
|
||||
@ -143,7 +143,7 @@ void disable_irq_nosync(unsigned int irq)
|
||||
struct irq_desc *desc = irq_desc + irq;
|
||||
unsigned long flags;
|
||||
|
||||
if (irq >= NR_IRQS)
|
||||
if (irq >= nr_irqs)
|
||||
return;
|
||||
|
||||
spin_lock_irqsave(&desc->lock, flags);
|
||||
@ -171,7 +171,7 @@ void disable_irq(unsigned int irq)
|
||||
{
|
||||
struct irq_desc *desc = irq_desc + irq;
|
||||
|
||||
if (irq >= NR_IRQS)
|
||||
if (irq >= nr_irqs)
|
||||
return;
|
||||
|
||||
disable_irq_nosync(irq);
|
||||
@ -214,7 +214,7 @@ void enable_irq(unsigned int irq)
|
||||
struct irq_desc *desc = irq_desc + irq;
|
||||
unsigned long flags;
|
||||
|
||||
if (irq >= NR_IRQS)
|
||||
if (irq >= nr_irqs)
|
||||
return;
|
||||
|
||||
spin_lock_irqsave(&desc->lock, flags);
|
||||
@ -290,7 +290,7 @@ int can_request_irq(unsigned int irq, unsigned long irqflags)
|
||||
{
|
||||
struct irqaction *action;
|
||||
|
||||
if (irq >= NR_IRQS || irq_desc[irq].status & IRQ_NOREQUEST)
|
||||
if (irq >= nr_irqs || irq_desc[irq].status & IRQ_NOREQUEST)
|
||||
return 0;
|
||||
|
||||
action = irq_desc[irq].action;
|
||||
@ -356,7 +356,7 @@ int setup_irq(unsigned int irq, struct irqaction *new)
|
||||
int shared = 0;
|
||||
int ret;
|
||||
|
||||
if (irq >= NR_IRQS)
|
||||
if (irq >= nr_irqs)
|
||||
return -EINVAL;
|
||||
|
||||
if (desc->chip == &no_irq_chip)
|
||||
@ -515,7 +515,7 @@ void free_irq(unsigned int irq, void *dev_id)
|
||||
unsigned long flags;
|
||||
|
||||
WARN_ON(in_interrupt());
|
||||
if (irq >= NR_IRQS)
|
||||
if (irq >= nr_irqs)
|
||||
return;
|
||||
|
||||
desc = irq_desc + irq;
|
||||
@ -630,7 +630,7 @@ int request_irq(unsigned int irq, irq_handler_t handler,
|
||||
*/
|
||||
if ((irqflags & IRQF_SHARED) && !dev_id)
|
||||
return -EINVAL;
|
||||
if (irq >= NR_IRQS)
|
||||
if (irq >= nr_irqs)
|
||||
return -EINVAL;
|
||||
if (irq_desc[irq].status & IRQ_NOREQUEST)
|
||||
return -EINVAL;
|
||||
|
@ -240,7 +240,7 @@ void init_irq_proc(void)
|
||||
/*
|
||||
* Create entries for all existing IRQs.
|
||||
*/
|
||||
for (i = 0; i < NR_IRQS; i++)
|
||||
for (i = 0; i < nr_irqs; i++)
|
||||
register_irq_proc(i);
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,8 @@ static void resend_irqs(unsigned long arg)
|
||||
struct irq_desc *desc;
|
||||
int irq;
|
||||
|
||||
while (!bitmap_empty(irqs_resend, NR_IRQS)) {
|
||||
irq = find_first_bit(irqs_resend, NR_IRQS);
|
||||
while (!bitmap_empty(irqs_resend, nr_irqs)) {
|
||||
irq = find_first_bit(irqs_resend, nr_irqs);
|
||||
clear_bit(irq, irqs_resend);
|
||||
desc = irq_desc + irq;
|
||||
local_irq_disable();
|
||||
|
@ -91,7 +91,7 @@ static int misrouted_irq(int irq)
|
||||
int i;
|
||||
int ok = 0;
|
||||
|
||||
for (i = 1; i < NR_IRQS; i++) {
|
||||
for (i = 1; i < nr_irqs; i++) {
|
||||
struct irq_desc *desc = irq_desc + i;
|
||||
|
||||
if (i == irq) /* Already tried */
|
||||
@ -107,7 +107,7 @@ static int misrouted_irq(int irq)
|
||||
static void poll_spurious_irqs(unsigned long dummy)
|
||||
{
|
||||
int i;
|
||||
for (i = 1; i < NR_IRQS; i++) {
|
||||
for (i = 1; i < nr_irqs; i++) {
|
||||
struct irq_desc *desc = irq_desc + i;
|
||||
unsigned int status;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user