Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 38419
b: refs/heads/master
c: 3a16d71
h: refs/heads/master
i:
  38417: e18a1f7
  38415: 57d88bb
v: v3
  • Loading branch information
Eric W. Biederman authored and Linus Torvalds committed Oct 4, 2006
1 parent 806fda4 commit 7dd471f
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 92db6d10bc1bc43330a4c540fa5b64c83d9d865f
refs/heads/master: 3a16d713626735f3016da0521b7bf251cd78e836
9 changes: 8 additions & 1 deletion trunk/include/linux/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,15 @@ set_irq_chained_handler(unsigned int irq,
__set_irq_handler(irq, handle, 1);
}

/* Set/get chip/data for an IRQ: */
/* Handle dynamic irq creation and destruction */
extern int create_irq(void);
extern void destroy_irq(unsigned int irq);

/* Dynamic irq helper functions */
extern void dynamic_irq_init(unsigned int irq);
extern void dynamic_irq_cleanup(unsigned int irq);

/* Set/get chip/data for an IRQ: */
extern int set_irq_chip(unsigned int irq, struct irq_chip *chip);
extern int set_irq_data(unsigned int irq, void *data);
extern int set_irq_chip_data(unsigned int irq, void *data);
Expand Down
56 changes: 56 additions & 0 deletions trunk/kernel/irq/chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,62 @@

#include "internals.h"

/**
* dynamic_irq_init - initialize a dynamically allocated irq
* @irq: irq number to initialize
*/
void dynamic_irq_init(unsigned int irq)
{
struct irq_desc *desc;
unsigned long flags;

if (irq >= NR_IRQS) {
printk(KERN_ERR "Trying to initialize invalid IRQ%d\n", irq);
WARN_ON(1);
return;
}

/* Ensure we don't have left over values from a previous use of this irq */
desc = irq_desc + irq;
spin_lock_irqsave(&desc->lock, flags);
desc->status = IRQ_DISABLED;
desc->chip = &no_irq_chip;
desc->handle_irq = handle_bad_irq;
desc->depth = 1;
desc->handler_data = NULL;
desc->chip_data = NULL;
desc->action = NULL;
desc->irq_count = 0;
desc->irqs_unhandled = 0;
#ifdef CONFIG_SMP
desc->affinity = CPU_MASK_ALL;
#endif
spin_unlock_irqrestore(&desc->lock, flags);
}

/**
* dynamic_irq_cleanup - cleanup a dynamically allocated irq
* @irq: irq number to initialize
*/
void dynamic_irq_cleanup(unsigned int irq)
{
struct irq_desc *desc;
unsigned long flags;

if (irq >= NR_IRQS) {
printk(KERN_ERR "Trying to cleanup invalid IRQ%d\n", irq);
WARN_ON(1);
return;
}

desc = irq_desc + irq;
spin_lock_irqsave(&desc->lock, flags);
desc->handle_irq = handle_bad_irq;
desc->chip = &no_irq_chip;
spin_unlock_irqrestore(&desc->lock, flags);
}


/**
* set_irq_chip - set the irq chip for an irq
* @irq: irq number
Expand Down

0 comments on commit 7dd471f

Please sign in to comment.