mfd: pmic8058: avoid unmasking enabled irq
If an interrupt was already unmasked previously, don't unmask it
unnecessarily. This will avoid loosing the interrupt if it were
pending.
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
diff --git a/drivers/mfd/pmic8058.c b/drivers/mfd/pmic8058.c
index ee5294b..6f59a8d 100644
--- a/drivers/mfd/pmic8058.c
+++ b/drivers/mfd/pmic8058.c
@@ -790,6 +790,12 @@
irq_bit = irq % 8;
old_irqs_allowed = chip->irqs_allowed[block];
+ if (old_irqs_allowed & (1 << irq_bit)) {
+ pr_debug("%s: no need to enable an already enabled irq=%d\n",
+ __func__, irq + chip->pdata.irq_base);
+ return;
+ }
+
chip->irqs_allowed[block] |= 1 << irq_bit;
if (!old_irqs_allowed) {
master = block / 8;