aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/irq')
-rw-r--r--kernel/irq/chip.c1
-rw-r--r--kernel/irq/manage.c15
2 files changed, 10 insertions, 6 deletions
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 10b5092e9bfe..7765d4c80c30 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -124,6 +124,7 @@ int set_irq_type(unsigned int irq, unsigned int type)
124 return -ENODEV; 124 return -ENODEV;
125 } 125 }
126 126
127 type &= IRQ_TYPE_SENSE_MASK;
127 if (type == IRQ_TYPE_NONE) 128 if (type == IRQ_TYPE_NONE)
128 return 0; 129 return 0;
129 130
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 801addda3c43..46953a06f4a8 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -370,16 +370,18 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
370 return 0; 370 return 0;
371 } 371 }
372 372
373 ret = chip->set_type(irq, flags & IRQF_TRIGGER_MASK); 373 /* caller masked out all except trigger mode flags */
374 ret = chip->set_type(irq, flags);
374 375
375 if (ret) 376 if (ret)
376 pr_err("setting trigger mode %d for irq %u failed (%pF)\n", 377 pr_err("setting trigger mode %d for irq %u failed (%pF)\n",
377 (int)(flags & IRQF_TRIGGER_MASK), 378 (int)flags, irq, chip->set_type);
378 irq, chip->set_type);
379 else { 379 else {
380 if (flags & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH))
381 flags |= IRQ_LEVEL;
380 /* note that IRQF_TRIGGER_MASK == IRQ_TYPE_SENSE_MASK */ 382 /* note that IRQF_TRIGGER_MASK == IRQ_TYPE_SENSE_MASK */
381 desc->status &= ~IRQ_TYPE_SENSE_MASK; 383 desc->status &= ~(IRQ_LEVEL | IRQ_TYPE_SENSE_MASK);
382 desc->status |= flags & IRQ_TYPE_SENSE_MASK; 384 desc->status |= flags;
383 } 385 }
384 386
385 return ret; 387 return ret;
@@ -459,7 +461,8 @@ __setup_irq(unsigned int irq, struct irq_desc * desc, struct irqaction *new)
459 461
460 /* Setup the type (level, edge polarity) if configured: */ 462 /* Setup the type (level, edge polarity) if configured: */
461 if (new->flags & IRQF_TRIGGER_MASK) { 463 if (new->flags & IRQF_TRIGGER_MASK) {
462 ret = __irq_set_trigger(desc, irq, new->flags); 464 ret = __irq_set_trigger(desc, irq,
465 new->flags & IRQF_TRIGGER_MASK);
463 466
464 if (ret) { 467 if (ret) {
465 spin_unlock_irqrestore(&desc->lock, flags); 468 spin_unlock_irqrestore(&desc->lock, flags);