Commit cb5bc832 authored by Yinghai Lu's avatar Yinghai Lu Committed by Ingo Molnar

x86_64: rename irq_desc/irq_desc_alloc

change names:

          irq_desc() ==> irq_desc_alloc
	__irq_desc() ==> irq_desc

Also split a few of the uses in lowlevel x86 code.

v2: need to check if desc is null in smp_irq_move_cleanup
Signed-off-by: default avatarYinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 1d5f6b36
...@@ -1124,7 +1124,12 @@ static void ioapic_register_intr(int irq, unsigned long trigger) ...@@ -1124,7 +1124,12 @@ static void ioapic_register_intr(int irq, unsigned long trigger)
{ {
struct irq_desc *desc; struct irq_desc *desc;
desc = irq_to_desc(irq); /* first time to use this irq_desc */
if (irq < 16)
desc = irq_to_desc(irq);
else
desc = irq_to_desc_alloc(irq);
if (trigger) if (trigger)
desc->status |= IRQ_LEVEL; desc->status |= IRQ_LEVEL;
else else
...@@ -1919,6 +1924,9 @@ asmlinkage void smp_irq_move_cleanup_interrupt(void) ...@@ -1919,6 +1924,9 @@ asmlinkage void smp_irq_move_cleanup_interrupt(void)
irq = __get_cpu_var(vector_irq)[vector]; irq = __get_cpu_var(vector_irq)[vector];
desc = irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc)
continue;
cfg = irq_cfg(irq); cfg = irq_cfg(irq);
spin_lock(&desc->lock); spin_lock(&desc->lock);
if (!cfg->move_cleanup_count) if (!cfg->move_cleanup_count)
......
...@@ -83,7 +83,7 @@ int show_interrupts(struct seq_file *p, void *v) ...@@ -83,7 +83,7 @@ int show_interrupts(struct seq_file *p, void *v)
if (i < nr_irqs) { if (i < nr_irqs) {
unsigned any_count = 0; unsigned any_count = 0;
struct irq_desc *desc = __irq_to_desc(i); struct irq_desc *desc = irq_to_desc(i);
if (!desc) if (!desc)
return 0; return 0;
...@@ -206,7 +206,7 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs) ...@@ -206,7 +206,7 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
stack_overflow_check(regs); stack_overflow_check(regs);
#endif #endif
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (likely(desc)) if (likely(desc))
generic_handle_irq_desc(irq, desc); generic_handle_irq_desc(irq, desc);
else { else {
......
...@@ -143,7 +143,8 @@ void __init init_ISA_irqs(void) ...@@ -143,7 +143,8 @@ void __init init_ISA_irqs(void)
init_8259A(0); init_8259A(0);
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
struct irq_desc *desc = irq_to_desc(i); /* first time call this irq_desc */
struct irq_desc *desc = irq_to_desc_alloc(i);
desc->status = IRQ_DISABLED; desc->status = IRQ_DISABLED;
desc->action = NULL; desc->action = NULL;
......
...@@ -191,7 +191,7 @@ struct irq_desc { ...@@ -191,7 +191,7 @@ struct irq_desc {
} ____cacheline_internodealigned_in_smp; } ____cacheline_internodealigned_in_smp;
extern struct irq_desc *irq_to_desc(unsigned int irq); extern struct irq_desc *irq_to_desc(unsigned int irq);
extern struct irq_desc *__irq_to_desc(unsigned int irq); extern struct irq_desc *irq_to_desc_alloc(unsigned int irq);
#ifndef CONFIG_HAVE_SPARSE_IRQ #ifndef CONFIG_HAVE_SPARSE_IRQ
......
...@@ -27,7 +27,8 @@ void dynamic_irq_init(unsigned int irq) ...@@ -27,7 +27,8 @@ void dynamic_irq_init(unsigned int irq)
struct irq_desc *desc; struct irq_desc *desc;
unsigned long flags; unsigned long flags;
desc = irq_to_desc(irq); /* first time to use this irq_desc */
desc = irq_to_desc_alloc(irq);
if (!desc) { if (!desc) {
WARN(1, KERN_ERR "Trying to initialize invalid IRQ%d\n", irq); WARN(1, KERN_ERR "Trying to initialize invalid IRQ%d\n", irq);
return; return;
...@@ -60,7 +61,7 @@ void dynamic_irq_cleanup(unsigned int irq) ...@@ -60,7 +61,7 @@ void dynamic_irq_cleanup(unsigned int irq)
struct irq_desc *desc; struct irq_desc *desc;
unsigned long flags; unsigned long flags;
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc) { if (!desc) {
WARN(1, KERN_ERR "Trying to cleanup invalid IRQ%d\n", irq); WARN(1, KERN_ERR "Trying to cleanup invalid IRQ%d\n", irq);
return; return;
...@@ -92,7 +93,7 @@ int set_irq_chip(unsigned int irq, struct irq_chip *chip) ...@@ -92,7 +93,7 @@ int set_irq_chip(unsigned int irq, struct irq_chip *chip)
struct irq_desc *desc; struct irq_desc *desc;
unsigned long flags; unsigned long flags;
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc) { if (!desc) {
WARN(1, KERN_ERR "Trying to install chip for IRQ%d\n", irq); WARN(1, KERN_ERR "Trying to install chip for IRQ%d\n", irq);
return -EINVAL; return -EINVAL;
...@@ -122,7 +123,7 @@ int set_irq_type(unsigned int irq, unsigned int type) ...@@ -122,7 +123,7 @@ int set_irq_type(unsigned int irq, unsigned int type)
unsigned long flags; unsigned long flags;
int ret = -ENXIO; int ret = -ENXIO;
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc) { if (!desc) {
printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq); printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq);
return -ENODEV; return -ENODEV;
...@@ -150,7 +151,7 @@ int set_irq_data(unsigned int irq, void *data) ...@@ -150,7 +151,7 @@ int set_irq_data(unsigned int irq, void *data)
struct irq_desc *desc; struct irq_desc *desc;
unsigned long flags; unsigned long flags;
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc) { if (!desc) {
printk(KERN_ERR printk(KERN_ERR
"Trying to install controller data for IRQ%d\n", irq); "Trying to install controller data for IRQ%d\n", irq);
...@@ -176,7 +177,7 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry) ...@@ -176,7 +177,7 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry)
struct irq_desc *desc; struct irq_desc *desc;
unsigned long flags; unsigned long flags;
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc) { if (!desc) {
printk(KERN_ERR printk(KERN_ERR
"Trying to install msi data for IRQ%d\n", irq); "Trying to install msi data for IRQ%d\n", irq);
...@@ -203,7 +204,7 @@ int set_irq_chip_data(unsigned int irq, void *data) ...@@ -203,7 +204,7 @@ int set_irq_chip_data(unsigned int irq, void *data)
struct irq_desc *desc; struct irq_desc *desc;
unsigned long flags; unsigned long flags;
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc) { if (!desc) {
printk(KERN_ERR printk(KERN_ERR
"Trying to install chip data for IRQ%d\n", irq); "Trying to install chip data for IRQ%d\n", irq);
...@@ -554,7 +555,7 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, ...@@ -554,7 +555,7 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
struct irq_desc *desc; struct irq_desc *desc;
unsigned long flags; unsigned long flags;
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc) { if (!desc) {
printk(KERN_ERR printk(KERN_ERR
"Trying to install type control for IRQ%d\n", irq); "Trying to install type control for IRQ%d\n", irq);
...@@ -618,7 +619,7 @@ void __init set_irq_noprobe(unsigned int irq) ...@@ -618,7 +619,7 @@ void __init set_irq_noprobe(unsigned int irq)
struct irq_desc *desc; struct irq_desc *desc;
unsigned long flags; unsigned long flags;
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc) { if (!desc) {
printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq); printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq);
...@@ -635,7 +636,7 @@ void __init set_irq_probe(unsigned int irq) ...@@ -635,7 +636,7 @@ void __init set_irq_probe(unsigned int irq)
struct irq_desc *desc; struct irq_desc *desc;
unsigned long flags; unsigned long flags;
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc) { if (!desc) {
printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq); printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq);
......
...@@ -151,7 +151,7 @@ early_param("nr_irq_desc", parse_nr_irq_desc); ...@@ -151,7 +151,7 @@ early_param("nr_irq_desc", parse_nr_irq_desc);
struct irq_desc *sparse_irqs; struct irq_desc *sparse_irqs;
DEFINE_DYN_ARRAY(sparse_irqs, sizeof(struct irq_desc), nr_irq_desc, PAGE_SIZE, init_work); DEFINE_DYN_ARRAY(sparse_irqs, sizeof(struct irq_desc), nr_irq_desc, PAGE_SIZE, init_work);
struct irq_desc *__irq_to_desc(unsigned int irq) struct irq_desc *irq_to_desc(unsigned int irq)
{ {
struct irq_desc *desc; struct irq_desc *desc;
...@@ -169,7 +169,7 @@ struct irq_desc *__irq_to_desc(unsigned int irq) ...@@ -169,7 +169,7 @@ struct irq_desc *__irq_to_desc(unsigned int irq)
} }
return NULL; return NULL;
} }
struct irq_desc *irq_to_desc(unsigned int irq) struct irq_desc *irq_to_desc_alloc(unsigned int irq)
{ {
struct irq_desc *desc, *desc_pri; struct irq_desc *desc, *desc_pri;
int i; int i;
...@@ -186,6 +186,7 @@ struct irq_desc *irq_to_desc(unsigned int irq) ...@@ -186,6 +186,7 @@ struct irq_desc *irq_to_desc(unsigned int irq)
if (desc->irq == -1U) { if (desc->irq == -1U) {
desc->irq = irq; desc->irq = irq;
printk(KERN_DEBUG "found new irq_desc for irq %d\n", desc->irq);
return desc; return desc;
} }
desc_pri = desc; desc_pri = desc;
...@@ -236,21 +237,7 @@ struct irq_desc *irq_to_desc(unsigned int irq) ...@@ -236,21 +237,7 @@ struct irq_desc *irq_to_desc(unsigned int irq)
desc->irq = irq; desc->irq = irq;
desc_pri->next = desc; desc_pri->next = desc;
{ printk(KERN_DEBUG "1 found new irq_desc for irq %d and pri will be irq %d\n", desc->irq, desc_pri->irq);
/* double check if some one mess up the list */
struct irq_desc *desc;
int count = 0;
desc = &sparse_irqs[0];
while (desc) {
printk(KERN_DEBUG "1 found irq_desc for irq %d\n", desc->irq);
if (desc->next)
printk(KERN_DEBUG "1 found irq_desc for irq %d and next will be irq %d\n", desc->irq, desc->next->irq);
desc = desc->next;
count++;
}
printk(KERN_DEBUG "1 all preallocted %d\n", count);
}
return desc; return desc;
} }
...@@ -285,7 +272,7 @@ struct irq_desc *irq_to_desc(unsigned int irq) ...@@ -285,7 +272,7 @@ struct irq_desc *irq_to_desc(unsigned int irq)
return NULL; return NULL;
} }
struct irq_desc *__irq_to_desc(unsigned int irq) struct irq_desc *irq_to_desc_alloc(unsigned int irq)
{ {
return irq_to_desc(irq); return irq_to_desc(irq);
} }
......
...@@ -31,7 +31,7 @@ cpumask_t irq_default_affinity = CPU_MASK_ALL; ...@@ -31,7 +31,7 @@ cpumask_t irq_default_affinity = CPU_MASK_ALL;
*/ */
void synchronize_irq(unsigned int irq) void synchronize_irq(unsigned int irq)
{ {
struct irq_desc *desc = __irq_to_desc(irq); struct irq_desc *desc = irq_to_desc(irq);
unsigned int status; unsigned int status;
if (!desc) if (!desc)
...@@ -145,7 +145,7 @@ void disable_irq_nosync(unsigned int irq) ...@@ -145,7 +145,7 @@ void disable_irq_nosync(unsigned int irq)
struct irq_desc *desc; struct irq_desc *desc;
unsigned long flags; unsigned long flags;
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc) if (!desc)
return; return;
...@@ -174,7 +174,7 @@ void disable_irq(unsigned int irq) ...@@ -174,7 +174,7 @@ void disable_irq(unsigned int irq)
{ {
struct irq_desc *desc; struct irq_desc *desc;
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc) if (!desc)
return; return;
...@@ -218,7 +218,7 @@ void enable_irq(unsigned int irq) ...@@ -218,7 +218,7 @@ void enable_irq(unsigned int irq)
struct irq_desc *desc; struct irq_desc *desc;
unsigned long flags; unsigned long flags;
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc) if (!desc)
return; return;
...@@ -296,7 +296,7 @@ int can_request_irq(unsigned int irq, unsigned long irqflags) ...@@ -296,7 +296,7 @@ int can_request_irq(unsigned int irq, unsigned long irqflags)
struct irq_desc *desc; struct irq_desc *desc;
struct irqaction *action; struct irqaction *action;
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc) if (!desc)
return 0; return 0;
...@@ -366,7 +366,7 @@ int setup_irq(unsigned int irq, struct irqaction *new) ...@@ -366,7 +366,7 @@ int setup_irq(unsigned int irq, struct irqaction *new)
int shared = 0; int shared = 0;
int ret; int ret;
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc) if (!desc)
return -EINVAL; return -EINVAL;
...@@ -527,7 +527,7 @@ void free_irq(unsigned int irq, void *dev_id) ...@@ -527,7 +527,7 @@ void free_irq(unsigned int irq, void *dev_id)
WARN_ON(in_interrupt()); WARN_ON(in_interrupt());
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc) if (!desc)
return; return;
...@@ -644,7 +644,7 @@ int request_irq(unsigned int irq, irq_handler_t handler, ...@@ -644,7 +644,7 @@ int request_irq(unsigned int irq, irq_handler_t handler,
if ((irqflags & IRQF_SHARED) && !dev_id) if ((irqflags & IRQF_SHARED) && !dev_id)
return -EINVAL; return -EINVAL;
desc = __irq_to_desc(irq); desc = irq_to_desc(irq);
if (!desc) if (!desc)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment