Commit d3c60047 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar

genirq: cleanup the sparseirq modifications

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent a1aca5de
...@@ -24,11 +24,9 @@ ...@@ -24,11 +24,9 @@
*/ */
void dynamic_irq_init(unsigned int irq) void dynamic_irq_init(unsigned int irq)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags; unsigned long flags;
/* first time to use this irq_desc */
desc = irq_to_desc(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;
...@@ -58,10 +56,9 @@ void dynamic_irq_init(unsigned int irq) ...@@ -58,10 +56,9 @@ void dynamic_irq_init(unsigned int irq)
*/ */
void dynamic_irq_cleanup(unsigned int irq) void dynamic_irq_cleanup(unsigned int irq)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags; unsigned long flags;
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;
...@@ -90,10 +87,9 @@ void dynamic_irq_cleanup(unsigned int irq) ...@@ -90,10 +87,9 @@ void dynamic_irq_cleanup(unsigned int irq)
*/ */
int set_irq_chip(unsigned int irq, struct irq_chip *chip) int set_irq_chip(unsigned int irq, struct irq_chip *chip)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags; unsigned long flags;
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;
...@@ -118,11 +114,10 @@ EXPORT_SYMBOL(set_irq_chip); ...@@ -118,11 +114,10 @@ EXPORT_SYMBOL(set_irq_chip);
*/ */
int set_irq_type(unsigned int irq, unsigned int type) int set_irq_type(unsigned int irq, unsigned int type)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags; unsigned long flags;
int ret = -ENXIO; int ret = -ENXIO;
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;
...@@ -147,10 +142,9 @@ EXPORT_SYMBOL(set_irq_type); ...@@ -147,10 +142,9 @@ EXPORT_SYMBOL(set_irq_type);
*/ */
int set_irq_data(unsigned int irq, void *data) int set_irq_data(unsigned int irq, void *data)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags; unsigned long flags;
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);
...@@ -173,10 +167,9 @@ EXPORT_SYMBOL(set_irq_data); ...@@ -173,10 +167,9 @@ EXPORT_SYMBOL(set_irq_data);
*/ */
int set_irq_msi(unsigned int irq, struct msi_desc *entry) int set_irq_msi(unsigned int irq, struct msi_desc *entry)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags; unsigned long flags;
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);
...@@ -200,10 +193,9 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry) ...@@ -200,10 +193,9 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry)
*/ */
int set_irq_chip_data(unsigned int irq, void *data) int set_irq_chip_data(unsigned int irq, void *data)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags; unsigned long flags;
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);
...@@ -228,9 +220,8 @@ EXPORT_SYMBOL(set_irq_chip_data); ...@@ -228,9 +220,8 @@ EXPORT_SYMBOL(set_irq_chip_data);
*/ */
static void default_enable(unsigned int irq) static void default_enable(unsigned int irq)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
desc = irq_to_desc(irq);
desc->chip->unmask(irq); desc->chip->unmask(irq);
desc->status &= ~IRQ_MASKED; desc->status &= ~IRQ_MASKED;
} }
...@@ -247,11 +238,9 @@ static void default_disable(unsigned int irq) ...@@ -247,11 +238,9 @@ static void default_disable(unsigned int irq)
*/ */
static unsigned int default_startup(unsigned int irq) static unsigned int default_startup(unsigned int irq)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
desc = irq_to_desc(irq);
desc->chip->enable(irq); desc->chip->enable(irq);
return 0; return 0;
} }
...@@ -260,9 +249,8 @@ static unsigned int default_startup(unsigned int irq) ...@@ -260,9 +249,8 @@ static unsigned int default_startup(unsigned int irq)
*/ */
static void default_shutdown(unsigned int irq) static void default_shutdown(unsigned int irq)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
desc = irq_to_desc(irq);
desc->chip->mask(irq); desc->chip->mask(irq);
desc->status |= IRQ_MASKED; desc->status |= IRQ_MASKED;
} }
...@@ -550,10 +538,9 @@ void ...@@ -550,10 +538,9 @@ void
__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
const char *name) const char *name)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags; unsigned long flags;
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);
...@@ -614,13 +601,11 @@ set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip, ...@@ -614,13 +601,11 @@ set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
void __init set_irq_noprobe(unsigned int irq) void __init set_irq_noprobe(unsigned int irq)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags; unsigned long flags;
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);
return; return;
} }
...@@ -631,13 +616,11 @@ void __init set_irq_noprobe(unsigned int irq) ...@@ -631,13 +616,11 @@ void __init set_irq_noprobe(unsigned int irq)
void __init set_irq_probe(unsigned int irq) void __init set_irq_probe(unsigned int irq)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags; unsigned long flags;
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);
return; return;
} }
......
...@@ -68,9 +68,8 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { ...@@ -68,9 +68,8 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
*/ */
static void ack_bad(unsigned int irq) static void ack_bad(unsigned int irq)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
desc = irq_to_desc(irq);
print_irq_desc(irq, desc); print_irq_desc(irq, desc);
ack_bad_irq(irq); ack_bad_irq(irq);
} }
......
...@@ -140,10 +140,9 @@ int irq_select_affinity(unsigned int irq) ...@@ -140,10 +140,9 @@ int irq_select_affinity(unsigned int irq)
*/ */
void disable_irq_nosync(unsigned int irq) void disable_irq_nosync(unsigned int irq)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags; unsigned long flags;
desc = irq_to_desc(irq);
if (!desc) if (!desc)
return; return;
...@@ -170,9 +169,8 @@ EXPORT_SYMBOL(disable_irq_nosync); ...@@ -170,9 +169,8 @@ EXPORT_SYMBOL(disable_irq_nosync);
*/ */
void disable_irq(unsigned int irq) void disable_irq(unsigned int irq)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
desc = irq_to_desc(irq);
if (!desc) if (!desc)
return; return;
...@@ -213,10 +211,9 @@ static void __enable_irq(struct irq_desc *desc, unsigned int irq) ...@@ -213,10 +211,9 @@ static void __enable_irq(struct irq_desc *desc, unsigned int irq)
*/ */
void enable_irq(unsigned int irq) void enable_irq(unsigned int irq)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags; unsigned long flags;
desc = irq_to_desc(irq);
if (!desc) if (!desc)
return; return;
...@@ -291,10 +288,9 @@ EXPORT_SYMBOL(set_irq_wake); ...@@ -291,10 +288,9 @@ EXPORT_SYMBOL(set_irq_wake);
*/ */
int can_request_irq(unsigned int irq, unsigned long irqflags) int can_request_irq(unsigned int irq, unsigned long irqflags)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
struct irqaction *action; struct irqaction *action;
desc = irq_to_desc(irq);
if (!desc) if (!desc)
return 0; return 0;
...@@ -355,16 +351,15 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned int irq, ...@@ -355,16 +351,15 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
* Internal function to register an irqaction - typically used to * Internal function to register an irqaction - typically used to
* allocate special interrupts that are part of the architecture. * allocate special interrupts that are part of the architecture.
*/ */
int setup_irq(unsigned int irq, struct irqaction *new) static int
__setup_irq(unsigned int irq, struct irq_desc * desc, struct irqaction *new)
{ {
struct irq_desc *desc;
struct irqaction *old, **p; struct irqaction *old, **p;
const char *old_name = NULL; const char *old_name = NULL;
unsigned long flags; unsigned long flags;
int shared = 0; int shared = 0;
int ret; int ret;
desc = irq_to_desc(irq);
if (!desc) if (!desc)
return -EINVAL; return -EINVAL;
...@@ -503,6 +498,20 @@ int setup_irq(unsigned int irq, struct irqaction *new) ...@@ -503,6 +498,20 @@ int setup_irq(unsigned int irq, struct irqaction *new)
return -EBUSY; return -EBUSY;
} }
/**
* setup_irq - setup an interrupt
* @irq: Interrupt line to setup
* @act: irqaction for the interrupt
*
* Used to statically setup interrupts in the early boot process.
*/
int setup_irq(unsigned int irq, struct irqaction *act)
{
struct irq_desc *desc = irq_to_desc(irq);
return __setup_irq(irq, desc, act);
}
/** /**
* free_irq - free an interrupt * free_irq - free an interrupt
* @irq: Interrupt line to free * @irq: Interrupt line to free
...@@ -519,13 +528,12 @@ int setup_irq(unsigned int irq, struct irqaction *new) ...@@ -519,13 +528,12 @@ int setup_irq(unsigned int irq, struct irqaction *new)
*/ */
void free_irq(unsigned int irq, void *dev_id) void free_irq(unsigned int irq, void *dev_id)
{ {
struct irq_desc *desc; struct irq_desc *desc = irq_to_desc(irq);
struct irqaction **p; struct irqaction **p;
unsigned long flags; unsigned long flags;
WARN_ON(in_interrupt()); WARN_ON(in_interrupt());
desc = irq_to_desc(irq);
if (!desc) if (!desc)
return; return;
...@@ -624,8 +632,8 @@ int request_irq(unsigned int irq, irq_handler_t handler, ...@@ -624,8 +632,8 @@ int request_irq(unsigned int irq, irq_handler_t handler,
unsigned long irqflags, const char *devname, void *dev_id) unsigned long irqflags, const char *devname, void *dev_id)
{ {
struct irqaction *action; struct irqaction *action;
int retval;
struct irq_desc *desc; struct irq_desc *desc;
int retval;
#ifdef CONFIG_LOCKDEP #ifdef CONFIG_LOCKDEP
/* /*
...@@ -662,7 +670,7 @@ int request_irq(unsigned int irq, irq_handler_t handler, ...@@ -662,7 +670,7 @@ int request_irq(unsigned int irq, irq_handler_t handler,
action->next = NULL; action->next = NULL;
action->dev_id = dev_id; action->dev_id = dev_id;
retval = setup_irq(irq, action); retval = __setup_irq(irq, desc, action);
if (retval) if (retval)
kfree(action); kfree(action);
......
...@@ -215,6 +215,7 @@ void unregister_handler_proc(unsigned int irq, struct irqaction *action) ...@@ -215,6 +215,7 @@ void unregister_handler_proc(unsigned int irq, struct irqaction *action)
{ {
if (action->dir) { if (action->dir) {
struct irq_desc *desc = irq_to_desc(irq); struct irq_desc *desc = irq_to_desc(irq);
remove_proc_entry(action->dir->name, desc->dir); remove_proc_entry(action->dir->name, desc->dir);
} }
} }
......
...@@ -26,8 +26,7 @@ static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs, 0, 0); ...@@ -26,8 +26,7 @@ static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs, 0, 0);
static int try_one_irq(int irq, struct irq_desc *desc) static int try_one_irq(int irq, struct irq_desc *desc)
{ {
struct irqaction *action; struct irqaction *action;
int ok = 0; int ok = 0, work = 0;
int work = 0; /* Did we do work for a real IRQ */
spin_lock(&desc->lock); spin_lock(&desc->lock);
/* Already running on another processor */ /* Already running on another processor */
...@@ -88,9 +87,8 @@ static int try_one_irq(int irq, struct irq_desc *desc) ...@@ -88,9 +87,8 @@ static int try_one_irq(int irq, struct irq_desc *desc)
static int misrouted_irq(int irq) static int misrouted_irq(int irq)
{ {
int i;
int ok = 0;
struct irq_desc *desc; struct irq_desc *desc;
int i, ok = 0;
for_each_irq_desc(i, desc) { for_each_irq_desc(i, desc) {
if (!i) if (!i)
...@@ -108,8 +106,8 @@ static int misrouted_irq(int irq) ...@@ -108,8 +106,8 @@ static int misrouted_irq(int irq)
static void poll_spurious_irqs(unsigned long dummy) static void poll_spurious_irqs(unsigned long dummy)
{ {
int i;
struct irq_desc *desc; struct irq_desc *desc;
int i;
for_each_irq_desc(i, desc) { for_each_irq_desc(i, desc) {
unsigned int status; unsigned int status;
...@@ -126,7 +124,8 @@ static void poll_spurious_irqs(unsigned long dummy) ...@@ -126,7 +124,8 @@ static void poll_spurious_irqs(unsigned long dummy)
try_one_irq(i, desc); try_one_irq(i, desc);
} }
mod_timer(&poll_spurious_irq_timer, jiffies + POLL_SPURIOUS_IRQ_INTERVAL); mod_timer(&poll_spurious_irq_timer,
jiffies + POLL_SPURIOUS_IRQ_INTERVAL);
} }
/* /*
...@@ -177,7 +176,9 @@ report_bad_irq(unsigned int irq, struct irq_desc *desc, irqreturn_t action_ret) ...@@ -177,7 +176,9 @@ report_bad_irq(unsigned int irq, struct irq_desc *desc, irqreturn_t action_ret)
} }
} }
static inline int try_misrouted_irq(unsigned int irq, struct irq_desc *desc, irqreturn_t action_ret) static inline int
try_misrouted_irq(unsigned int irq, struct irq_desc *desc,
irqreturn_t action_ret)
{ {
struct irqaction *action; struct irqaction *action;
...@@ -253,7 +254,8 @@ void note_interrupt(unsigned int irq, struct irq_desc *desc, ...@@ -253,7 +254,8 @@ void note_interrupt(unsigned int irq, struct irq_desc *desc,
desc->depth++; desc->depth++;
desc->chip->disable(irq); desc->chip->disable(irq);
mod_timer(&poll_spurious_irq_timer, jiffies + POLL_SPURIOUS_IRQ_INTERVAL); mod_timer(&poll_spurious_irq_timer,
jiffies + POLL_SPURIOUS_IRQ_INTERVAL);
} }
desc->irqs_unhandled = 0; desc->irqs_unhandled = 0;
} }
......
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