summary refs log tree commit diff
path: root/drivers/irqchip
diff options
context:
space:
mode:
authorJon Hunter <jonathanh@nvidia.com>2016-05-10 16:14:38 +0100
committerMarc Zyngier <marc.zyngier@arm.com>2016-05-11 10:12:41 +0100
commitec1a454d6136b93e26902ead21025efc08047d05 (patch)
tree2ce8d140d751af0c76aba528e185d420ff98a67e /drivers/irqchip
parenta2a8fa5563d8740efaa8e62f653a6a85569c858b (diff)
downloadlinux-ec1a454d6136b93e26902ead21025efc08047d05.tar.gz
irqchip/gic: Don't unnecessarily write the IRQ configuration
If the interrupt configuration matches the current configuration, then
don't bother writing the configuration again.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'drivers/irqchip')
-rw-r--r--drivers/irqchip/irq-gic-common.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/irqchip/irq-gic-common.c b/drivers/irqchip/irq-gic-common.c
index f174ce0ca361..ffff5a45f1e3 100644
--- a/drivers/irqchip/irq-gic-common.c
+++ b/drivers/irqchip/irq-gic-common.c
@@ -50,13 +50,17 @@ int gic_configure_irq(unsigned int irq, unsigned int type,
 	else if (type & IRQ_TYPE_EDGE_BOTH)
 		val |= confmask;
 
+	/* If the current configuration is the same, then we are done */
+	if (val == oldval)
+		return 0;
+
 	/*
 	 * Write back the new configuration, and possibly re-enable
-	 * the interrupt. If we tried to write a new configuration and failed,
+	 * the interrupt. If we fail to write a new configuration,
 	 * return an error.
 	 */
 	writel_relaxed(val, base + GIC_DIST_CONFIG + confoff);
-	if (readl_relaxed(base + GIC_DIST_CONFIG + confoff) != val && val != oldval)
+	if (readl_relaxed(base + GIC_DIST_CONFIG + confoff) != val)
 		ret = -EINVAL;
 
 	if (sync_access)