Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 116383
b: refs/heads/master
c: 0c5d1eb
h: refs/heads/master
i:
  116381: cffbf04
  116379: 9ce7ee8
  116375: 34025af
  116367: 068d07b
  116351: 639b340
v: v3
  • Loading branch information
David Brownell authored and Ingo Molnar committed Oct 2, 2008
1 parent ac4da36 commit 9b38956
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 11 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: d6d5aeb661fc14655c417f3582ae7ec52985d2a8
refs/heads/master: 0c5d1eb77a8be917b638344a22afe1398236482b
15 changes: 8 additions & 7 deletions trunk/kernel/irq/chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ int set_irq_chip(unsigned int irq, struct irq_chip *chip)
EXPORT_SYMBOL(set_irq_chip);

/**
* set_irq_type - set the irq type for an irq
* set_irq_type - set the irq trigger type for an irq
* @irq: irq number
* @type: interrupt type - see include/linux/interrupt.h
* @type: IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h
*/
int set_irq_type(unsigned int irq, unsigned int type)
{
Expand All @@ -127,11 +127,12 @@ int set_irq_type(unsigned int irq, unsigned int type)
}

desc = irq_desc + irq;
if (desc->chip->set_type) {
spin_lock_irqsave(&desc->lock, flags);
ret = desc->chip->set_type(irq, type);
spin_unlock_irqrestore(&desc->lock, flags);
}
if (type == IRQ_TYPE_NONE)
return 0;

spin_lock_irqsave(&desc->lock, flags);
ret = __irq_set_trigger(desc, irq, flags);
spin_unlock_irqrestore(&desc->lock, flags);
return ret;
}
EXPORT_SYMBOL(set_irq_type);
Expand Down
3 changes: 3 additions & 0 deletions trunk/kernel/irq/internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ extern void irq_chip_set_defaults(struct irq_chip *chip);
/* Set default handler: */
extern void compat_irq_chip_set_default_handler(struct irq_desc *desc);

extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
unsigned long flags);

#ifdef CONFIG_PROC_FS
extern void register_irq_proc(unsigned int irq);
extern void register_handler_proc(unsigned int irq, struct irqaction *action);
Expand Down
21 changes: 18 additions & 3 deletions trunk/kernel/irq/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void enable_irq(unsigned int irq)
}
EXPORT_SYMBOL(enable_irq);

int set_irq_wake_real(unsigned int irq, unsigned int on)
static int set_irq_wake_real(unsigned int irq, unsigned int on)
{
struct irq_desc *desc = irq_desc + irq;
int ret = -ENXIO;
Expand Down Expand Up @@ -305,10 +305,11 @@ void compat_irq_chip_set_default_handler(struct irq_desc *desc)
desc->handle_irq = NULL;
}

static int __irq_set_trigger(struct irq_chip *chip, unsigned int irq,
int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
unsigned long flags)
{
int ret;
struct irq_chip *chip = desc->chip;

if (!chip || !chip->set_type) {
/*
Expand All @@ -326,6 +327,11 @@ static int __irq_set_trigger(struct irq_chip *chip, unsigned int irq,
pr_err("setting trigger mode %d for irq %u failed (%pF)\n",
(int)(flags & IRQF_TRIGGER_MASK),
irq, chip->set_type);
else {
/* note that IRQF_TRIGGER_MASK == IRQ_TYPE_SENSE_MASK */
desc->status &= ~IRQ_TYPE_SENSE_MASK;
desc->status |= flags & IRQ_TYPE_SENSE_MASK;
}

return ret;
}
Expand Down Expand Up @@ -404,7 +410,7 @@ int setup_irq(unsigned int irq, struct irqaction *new)

/* Setup the type (level, edge polarity) if configured: */
if (new->flags & IRQF_TRIGGER_MASK) {
ret = __irq_set_trigger(desc->chip, irq, new->flags);
ret = __irq_set_trigger(desc, irq, new->flags);

if (ret) {
spin_unlock_irqrestore(&desc->lock, flags);
Expand All @@ -430,6 +436,14 @@ int setup_irq(unsigned int irq, struct irqaction *new)

/* Set default affinity mask once everything is setup */
irq_select_affinity(irq);

} else if ((new->flags & IRQF_TRIGGER_MASK)
&& (new->flags & IRQF_TRIGGER_MASK)
!= (desc->status & IRQ_TYPE_SENSE_MASK)) {
/* hope the handler works with the actual trigger mode... */
pr_warning("IRQ %d uses trigger mode %d; requested %d\n",
irq, (int)(desc->status & IRQ_TYPE_SENSE_MASK),
(int)(new->flags & IRQF_TRIGGER_MASK));
}

*p = new;
Expand Down Expand Up @@ -586,6 +600,7 @@ EXPORT_SYMBOL(free_irq);
* IRQF_SHARED Interrupt is shared
* IRQF_DISABLED Disable local interrupts while processing
* IRQF_SAMPLE_RANDOM The interrupt can be used for entropy
* IRQF_TRIGGER_* Specify active edge(s) or level
*
*/
int request_irq(unsigned int irq, irq_handler_t handler,
Expand Down

0 comments on commit 9b38956

Please sign in to comment.