Skip to content

Commit

Permalink
gpio/omap: fix missing check in *_runtime_suspend()
Browse files Browse the repository at this point in the history
We do checking for bank->enabled_non_wakeup_gpios in order
to skip redundant operations. Somehow, the check got missed
while doing the cleanup series.

Just to make sure that we do context restore correctly in
*_runtime_resume(), the bank->workaround_enabled check is
moved after context restore. Otherwise, it would prevent
context restore when bank->enabled_non_wakeup_gpios is 0.

Cc: Kevin Hilman <khilman@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Cousson, Benoit <b-cousson@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>
Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Govindraj.R <govindraj.raja@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
  • Loading branch information
Tarun Kanti DebBarma authored and Kevin Hilman committed May 12, 2012
1 parent 4e962e8 commit 1b12870
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/gpio/gpio-omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,9 @@ static int omap_gpio_runtime_suspend(struct device *dev)

spin_lock_irqsave(&bank->lock, flags);

if (!bank->enabled_non_wakeup_gpios)
goto update_gpio_context_count;

/*
* Only edges can generate a wakeup event to the PRCM.
*
Expand Down Expand Up @@ -1232,11 +1235,6 @@ static int omap_gpio_runtime_resume(struct device *dev)
__raw_writel(bank->context.risingdetect,
bank->base + bank->regs->risingdetect);

if (!bank->workaround_enabled) {
spin_unlock_irqrestore(&bank->lock, flags);
return 0;
}

if (bank->get_context_loss_count) {
context_lost_cnt_after =
bank->get_context_loss_count(bank->dev);
Expand All @@ -1249,6 +1247,11 @@ static int omap_gpio_runtime_resume(struct device *dev)
}
}

if (!bank->workaround_enabled) {
spin_unlock_irqrestore(&bank->lock, flags);
return 0;
}

__raw_writel(bank->context.fallingdetect,
bank->base + bank->regs->fallingdetect);
__raw_writel(bank->context.risingdetect,
Expand Down

0 comments on commit 1b12870

Please sign in to comment.