Commit 62ec05d1 authored by Thomas Gleixner's avatar Thomas Gleixner

avr32: Cleanup eic_set_irq_type()

No need to fiddle in irq_desc. The trigger mask can be written back
into irq_data. Return IRQ_SET_MASK_OK_NOCOPY, so the generic code wont
overwrite it again.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
parent db82817b
...@@ -89,18 +89,14 @@ static void eic_unmask_irq(struct irq_chip *d) ...@@ -89,18 +89,14 @@ static void eic_unmask_irq(struct irq_chip *d)
static int eic_set_irq_type(struct irq_chip *d, unsigned int flow_type) static int eic_set_irq_type(struct irq_chip *d, unsigned int flow_type)
{ {
struct eic *eic = irq_data_get_irq_chip_data(data); struct eic *eic = irq_data_get_irq_chip_data(data);
struct irq_desc *desc;
unsigned int irq = d->irq; unsigned int irq = d->irq;
unsigned int i = irq - eic->first_irq; unsigned int i = irq - eic->first_irq;
u32 mode, edge, level; u32 mode, edge, level;
int ret = 0;
flow_type &= IRQ_TYPE_SENSE_MASK; flow_type &= IRQ_TYPE_SENSE_MASK;
if (flow_type == IRQ_TYPE_NONE) if (flow_type == IRQ_TYPE_NONE)
flow_type = IRQ_TYPE_LEVEL_LOW; flow_type = IRQ_TYPE_LEVEL_LOW;
desc = irq_to_desc(irq);
mode = eic_readl(eic, MODE); mode = eic_readl(eic, MODE);
edge = eic_readl(eic, EDGE); edge = eic_readl(eic, EDGE);
level = eic_readl(eic, LEVEL); level = eic_readl(eic, LEVEL);
...@@ -123,25 +119,20 @@ static int eic_set_irq_type(struct irq_chip *d, unsigned int flow_type) ...@@ -123,25 +119,20 @@ static int eic_set_irq_type(struct irq_chip *d, unsigned int flow_type)
edge &= ~(1 << i); edge &= ~(1 << i);
break; break;
default: default:
ret = -EINVAL; return -EINVAL;
break;
} }
if (ret == 0) { eic_writel(eic, MODE, mode);
eic_writel(eic, MODE, mode); eic_writel(eic, EDGE, edge);
eic_writel(eic, EDGE, edge); eic_writel(eic, LEVEL, level);
eic_writel(eic, LEVEL, level);
if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) {
flow_type |= IRQ_LEVEL;
__irq_set_handler_locked(irq, handle_level_irq);
} else
__irq_set_handler_locked(irq, handle_edge_irq);
desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);
desc->status |= flow_type;
}
return ret; irqd_set_trigger_type(d, flow_type);
if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH))
__irq_set_handler_locked(irq, handle_level_irq);
else
__irq_set_handler_locked(irq, handle_edge_irq);
return IRQ_SET_MASK_OK_NOCOPY;
} }
static struct irq_chip eic_chip = { static struct irq_chip eic_chip = {
......
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