From 18c2cdffc3995aaa38792e5d65a4ad4c00d700c6 Mon Sep 17 00:00:00 2001 From: Axel Haslam Date: Mon, 5 Sep 2011 14:26:52 -0700 Subject: OMAP: PM: replace omap_pm_get_dev_context_loss_count with omap_pm_was_context_lost Drivers just need to know if thier context was lost or not. There is not much point in maintaining a count This removes omap_pm_get_dev_context_loss_count and replaces it with omap_pm_was_context_lost Adapt drivers to use the omap_pm_was_context_lost API, which returns a bool value instead of relying on the incrementing context lost counter. This makes drivers a little more snappier as they do not need to restore contexts when not needed. WARNING: this changes the api set available to drivers to use from OMAP PM layer. Change-Id: I7fd9183d3e12982bb40651df9378637073121399 Signed-off-by: Axel Haslam --- drivers/gpio/gpio-omap.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'drivers/gpio') diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 110567e..b20d3164 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -27,6 +27,7 @@ #include #include #include +#include static LIST_HEAD(omap_gpio_list); @@ -74,12 +75,9 @@ struct gpio_bank { bool saved_context; int stride; u32 width; - u32 ctx_loss_count; u16 id; void (*set_dataout)(struct gpio_bank *bank, int gpio, int enable); - int (*get_context_loss_count)(struct device *dev); - struct omap_gpio_reg_offs *regs; }; @@ -1139,7 +1137,6 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev) bank->non_wakeup_gpios = pdata->non_wakeup_gpios; bank->loses_context = pdata->loses_context; bank->regs = pdata->regs; - bank->get_context_loss_count = pdata->get_context_loss_count; bank->saved_context = 0; if (bank->regs->set_dataout && bank->regs->clr_dataout) bank->set_dataout = _set_gpio_dataout_reg; @@ -1285,8 +1282,6 @@ static int omap_gpio_pm_runtime_suspend(struct device *dev) __raw_writel(l2, bank->base + bank->regs->risingdetect); save_gpio_ctx: - if (bank->get_context_loss_count) - bank->ctx_loss_count = bank->get_context_loss_count(bank->dev); omap_gpio_save_context(bank); for (j = 0; j < hweight_long(bank->dbck_enable_mask); j++) clk_disable(bank->dbck); @@ -1300,19 +1295,14 @@ static int omap_gpio_pm_runtime_resume(struct device *dev) #ifdef CONFIG_ARCH_OMAP2PLUS struct platform_device *pdev = to_platform_device(dev); struct gpio_bank *bank = platform_get_drvdata(pdev); - u32 ctx_lost_cnt_after; u32 l = 0, gen, gen0, gen1; int j; for (j = 0; j < hweight_long(bank->dbck_enable_mask); j++) clk_enable(bank->dbck); - if (bank->get_context_loss_count) { - ctx_lost_cnt_after = - bank->get_context_loss_count(bank->dev); - if (ctx_lost_cnt_after != bank->ctx_loss_count) - omap_gpio_restore_context(bank); - } + if (omap_pm_was_context_lost(dev)) + omap_gpio_restore_context(bank); if (!(bank->enabled_non_wakeup_gpios)) return 0; -- cgit v1.1