diff options
Diffstat (limited to 'arch/arm/plat-omap/omap-pm-noop.c')
-rw-r--r-- | arch/arm/plat-omap/omap-pm-noop.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/arch/arm/plat-omap/omap-pm-noop.c b/arch/arm/plat-omap/omap-pm-noop.c index b0471bb2d47d..3dc3801aace4 100644 --- a/arch/arm/plat-omap/omap-pm-noop.c +++ b/arch/arm/plat-omap/omap-pm-noop.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <plat/omap_device.h> | 27 | #include <plat/omap_device.h> |
28 | 28 | ||
29 | static bool off_mode_enabled; | 29 | static bool off_mode_enabled; |
30 | static u32 dummy_context_loss_counter; | 30 | static int dummy_context_loss_counter; |
31 | 31 | ||
32 | /* | 32 | /* |
33 | * Device-driver-originated constraints (via board-*.c files) | 33 | * Device-driver-originated constraints (via board-*.c files) |
@@ -311,22 +311,32 @@ void omap_pm_disable_off_mode(void) | |||
311 | 311 | ||
312 | #ifdef CONFIG_ARCH_OMAP2PLUS | 312 | #ifdef CONFIG_ARCH_OMAP2PLUS |
313 | 313 | ||
314 | u32 omap_pm_get_dev_context_loss_count(struct device *dev) | 314 | int omap_pm_get_dev_context_loss_count(struct device *dev) |
315 | { | 315 | { |
316 | struct platform_device *pdev = to_platform_device(dev); | 316 | struct platform_device *pdev = to_platform_device(dev); |
317 | u32 count; | 317 | int count; |
318 | 318 | ||
319 | if (WARN_ON(!dev)) | 319 | if (WARN_ON(!dev)) |
320 | return 0; | 320 | return -ENODEV; |
321 | 321 | ||
322 | if (dev->parent == &omap_device_parent) { | 322 | if (dev->parent == &omap_device_parent) { |
323 | count = omap_device_get_context_loss_count(pdev); | 323 | count = omap_device_get_context_loss_count(pdev); |
324 | } else { | 324 | } else { |
325 | WARN_ONCE(off_mode_enabled, "omap_pm: using dummy context loss counter; device %s should be converted to omap_device", | 325 | WARN_ONCE(off_mode_enabled, "omap_pm: using dummy context loss counter; device %s should be converted to omap_device", |
326 | dev_name(dev)); | 326 | dev_name(dev)); |
327 | if (off_mode_enabled) | 327 | |
328 | dummy_context_loss_counter++; | ||
329 | count = dummy_context_loss_counter; | 328 | count = dummy_context_loss_counter; |
329 | |||
330 | if (off_mode_enabled) { | ||
331 | count++; | ||
332 | /* | ||
333 | * Context loss count has to be a non-negative value. | ||
334 | * Clear the sign bit to get a value range from 0 to | ||
335 | * INT_MAX. | ||
336 | */ | ||
337 | count &= INT_MAX; | ||
338 | dummy_context_loss_counter = count; | ||
339 | } | ||
330 | } | 340 | } |
331 | 341 | ||
332 | pr_debug("OMAP PM: context loss count for dev %s = %d\n", | 342 | pr_debug("OMAP PM: context loss count for dev %s = %d\n", |
@@ -337,7 +347,7 @@ u32 omap_pm_get_dev_context_loss_count(struct device *dev) | |||
337 | 347 | ||
338 | #else | 348 | #else |
339 | 349 | ||
340 | u32 omap_pm_get_dev_context_loss_count(struct device *dev) | 350 | int omap_pm_get_dev_context_loss_count(struct device *dev) |
341 | { | 351 | { |
342 | return dummy_context_loss_counter; | 352 | return dummy_context_loss_counter; |
343 | } | 353 | } |