[PATCH] genirq: no need to mask non trigger mode flags before __irq_set_trigger()

From: Alexander Kuleshov
Date: Tue Jul 19 2016 - 05:54:21 EST


Some callers of __irq_set_trigger() masks all flags besides trigger mode
flags. Actually it is unnecessary operation now, because the
__irq_set_trigger() already does this before usage of flags.

Signed-off-by: Alexander Kuleshov <kuleshovmail@xxxxxxxxx>
---
kernel/irq/chip.c | 1 -
kernel/irq/manage.c | 5 ++---
2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 2f9f2b0..38f2fa4 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -76,7 +76,6 @@ int irq_set_irq_type(unsigned int irq, unsigned int type)
if (!desc)
return -EINVAL;

- type &= IRQ_TYPE_SENSE_MASK;
ret = __irq_set_trigger(desc, type);
irq_put_desc_busunlock(desc, flags);
return ret;
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index ef0bc02..f33c719 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -662,7 +662,7 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned long flags)
unmask = 1;
}

- /* caller masked out all except trigger mode flags */
+ /* all flags except trigger mode flags are masked */
ret = chip->irq_set_type(&desc->irq_data, flags);

switch (ret) {
@@ -1730,8 +1730,7 @@ void enable_percpu_irq(unsigned int irq, unsigned int type)
if (!desc)
return;

- type &= IRQ_TYPE_SENSE_MASK;
- if (type != IRQ_TYPE_NONE) {
+ if (type & IRQ_TYPE_SENSE_MASK) {
int ret;

ret = __irq_set_trigger(desc, type);
--
2.8.0.rc3.922.g2bcc146