Skip to content

Commit

Permalink
irqchip/gic: Don't unnecessarily write the IRQ configuration
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jon Hunter authored and Marc Zyngier committed May 11, 2016
1 parent a2a8fa5 commit ec1a454
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/irqchip/irq-gic-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ec1a454

Please sign in to comment.