Commit a28ab38c authored by Thomas Gleixner's avatar Thomas Gleixner

powerpc: cpm2_pic: Cleanup flow type handling

The core irq_set_type() function updates the flow type when the chip
callback returns 0. So setting the type is bogus.

The new core code allows to update the type in irq_data and return
IRQ_SET_MASK_OK_NOCOPY, so the core code will not touch it, except for
setting the IRQ_LEVEL flag.

Use the proper accessors for setting the irq handlers.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 00e70bad
...@@ -140,7 +140,6 @@ static void cpm2_end_irq(struct irq_data *d) ...@@ -140,7 +140,6 @@ static void cpm2_end_irq(struct irq_data *d)
static int cpm2_set_irq_type(struct irq_data *d, unsigned int flow_type) static int cpm2_set_irq_type(struct irq_data *d, unsigned int flow_type)
{ {
unsigned int src = virq_to_hw(d->irq); unsigned int src = virq_to_hw(d->irq);
struct irq_desc *desc = irq_to_desc(d->irq);
unsigned int vold, vnew, edibit; unsigned int vold, vnew, edibit;
/* Port C interrupts are either IRQ_TYPE_EDGE_FALLING or /* Port C interrupts are either IRQ_TYPE_EDGE_FALLING or
...@@ -162,13 +161,11 @@ static int cpm2_set_irq_type(struct irq_data *d, unsigned int flow_type) ...@@ -162,13 +161,11 @@ static int cpm2_set_irq_type(struct irq_data *d, unsigned int flow_type)
goto err_sense; goto err_sense;
} }
desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL); irqd_set_trigger_type(d, flow_type);
desc->status |= flow_type & IRQ_TYPE_SENSE_MASK; if (flow_type & IRQ_TYPE_LEVEL_LOW)
if (flow_type & IRQ_TYPE_LEVEL_LOW) { __set_irq_handler_unlocked(d->irq, handle_level_irq);
desc->status |= IRQ_LEVEL; else
desc->handle_irq = handle_level_irq; __set_irq_handler_unlocked(d->irq, handle_edge_irq);
} else
desc->handle_irq = handle_edge_irq;
/* internal IRQ senses are LEVEL_LOW /* internal IRQ senses are LEVEL_LOW
* EXT IRQ and Port C IRQ senses are programmable * EXT IRQ and Port C IRQ senses are programmable
...@@ -179,7 +176,8 @@ static int cpm2_set_irq_type(struct irq_data *d, unsigned int flow_type) ...@@ -179,7 +176,8 @@ static int cpm2_set_irq_type(struct irq_data *d, unsigned int flow_type)
if (src >= CPM2_IRQ_PORTC15 && src <= CPM2_IRQ_PORTC0) if (src >= CPM2_IRQ_PORTC15 && src <= CPM2_IRQ_PORTC0)
edibit = (31 - (CPM2_IRQ_PORTC0 - src)); edibit = (31 - (CPM2_IRQ_PORTC0 - src));
else else
return (flow_type & IRQ_TYPE_LEVEL_LOW) ? 0 : -EINVAL; return (flow_type & IRQ_TYPE_LEVEL_LOW) ?
IRQ_SET_MASK_OK_NOCOPY : -EINVAL;
vold = in_be32(&cpm2_intctl->ic_siexr); vold = in_be32(&cpm2_intctl->ic_siexr);
...@@ -190,7 +188,7 @@ static int cpm2_set_irq_type(struct irq_data *d, unsigned int flow_type) ...@@ -190,7 +188,7 @@ static int cpm2_set_irq_type(struct irq_data *d, unsigned int flow_type)
if (vold != vnew) if (vold != vnew)
out_be32(&cpm2_intctl->ic_siexr, vnew); out_be32(&cpm2_intctl->ic_siexr, vnew);
return 0; return IRQ_SET_MASK_OK_NOCOPY;
err_sense: err_sense:
pr_err("CPM2 PIC: sense type 0x%x not supported\n", flow_type); pr_err("CPM2 PIC: sense type 0x%x not supported\n", flow_type);
......
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