aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2011-06-09 09:56:23 -0400
committerTony Lindgren <tony@atomide.com>2011-11-04 20:41:07 -0400
commitfc01387302c01899e3cc67d3c81fd4287db9bab9 (patch)
treeb37a3d19f99a0c76d6399337536f7d19e7aac219 /arch/arm/plat-omap
parentc862dd706759c48a8a45af140330544724f170f9 (diff)
ARM: OMAP: change get_context_loss_count ret value to int
get_context_loss_count functions return context loss count as u32, and zero means an error. However, zero is also returned when context has never been lost and could also be returned when the context loss count has wrapped and goes to zero. Change the functions to return an int, with negative value meaning an error. OMAP HSMMC code uses omap_pm_get_dev_context_loss_count(), but as the hsmmc code handles the returned value as an int, with negative value meaning an error, this patch actually fixes hsmmc code also. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Acked-by: Kevin Hilman <khilman@ti.com> Acked-by: Paul Walmsley <paul@pwsan.com> [tony@atomide.com: updated to fix a warning with recent dmtimer changes] Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/include/plat/dmtimer.h4
-rw-r--r--arch/arm/plat-omap/include/plat/omap-pm.h4
-rw-r--r--arch/arm/plat-omap/include/plat/omap_device.h2
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h2
-rw-r--r--arch/arm/plat-omap/omap-pm-noop.c24
-rw-r--r--arch/arm/plat-omap/omap_device.c2
6 files changed, 24 insertions, 14 deletions
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index d11025e6e7a4..9418f00b6c38 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -104,7 +104,7 @@ struct dmtimer_platform_data {
104 104
105 bool loses_context; 105 bool loses_context;
106 106
107 u32 (*get_context_loss_count)(struct device *dev); 107 int (*get_context_loss_count)(struct device *dev);
108}; 108};
109 109
110struct omap_dm_timer *omap_dm_timer_request(void); 110struct omap_dm_timer *omap_dm_timer_request(void);
@@ -279,7 +279,7 @@ struct omap_dm_timer {
279 struct platform_device *pdev; 279 struct platform_device *pdev;
280 struct list_head node; 280 struct list_head node;
281 281
282 u32 (*get_context_loss_count)(struct device *dev); 282 int (*get_context_loss_count)(struct device *dev);
283}; 283};
284 284
285int omap_dm_timer_prepare(struct omap_dm_timer *timer); 285int omap_dm_timer_prepare(struct omap_dm_timer *timer);
diff --git a/arch/arm/plat-omap/include/plat/omap-pm.h b/arch/arm/plat-omap/include/plat/omap-pm.h
index 0840df813f4f..67faa7b8fe92 100644
--- a/arch/arm/plat-omap/include/plat/omap-pm.h
+++ b/arch/arm/plat-omap/include/plat/omap-pm.h
@@ -342,9 +342,9 @@ unsigned long omap_pm_cpu_get_freq(void);
342 * driver must restore device context. If the number of context losses 342 * driver must restore device context. If the number of context losses
343 * exceeds the maximum positive integer, the function will wrap to 0 and 343 * exceeds the maximum positive integer, the function will wrap to 0 and
344 * continue counting. Returns the number of context losses for this device, 344 * continue counting. Returns the number of context losses for this device,
345 * or zero upon error. 345 * or negative value upon error.
346 */ 346 */
347u32 omap_pm_get_dev_context_loss_count(struct device *dev); 347int omap_pm_get_dev_context_loss_count(struct device *dev);
348 348
349void omap_pm_enable_off_mode(void); 349void omap_pm_enable_off_mode(void);
350void omap_pm_disable_off_mode(void); 350void omap_pm_disable_off_mode(void);
diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
index 12c5b0c345bf..51423d2727a5 100644
--- a/arch/arm/plat-omap/include/plat/omap_device.h
+++ b/arch/arm/plat-omap/include/plat/omap_device.h
@@ -107,7 +107,7 @@ struct device *omap_device_get_by_hwmod_name(const char *oh_name);
107int omap_device_align_pm_lat(struct platform_device *pdev, 107int omap_device_align_pm_lat(struct platform_device *pdev,
108 u32 new_wakeup_lat_limit); 108 u32 new_wakeup_lat_limit);
109struct powerdomain *omap_device_get_pwrdm(struct omap_device *od); 109struct powerdomain *omap_device_get_pwrdm(struct omap_device *od);
110u32 omap_device_get_context_loss_count(struct platform_device *pdev); 110int omap_device_get_context_loss_count(struct platform_device *pdev);
111 111
112/* Other */ 112/* Other */
113 113
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 5419f1a2aaa4..8b372ede17c1 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -600,7 +600,7 @@ int omap_hwmod_for_each_by_class(const char *classname,
600 void *user); 600 void *user);
601 601
602int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state); 602int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state);
603u32 omap_hwmod_get_context_loss_count(struct omap_hwmod *oh); 603int omap_hwmod_get_context_loss_count(struct omap_hwmod *oh);
604 604
605int omap_hwmod_no_setup_reset(struct omap_hwmod *oh); 605int omap_hwmod_no_setup_reset(struct omap_hwmod *oh);
606 606
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
29static bool off_mode_enabled; 29static bool off_mode_enabled;
30static u32 dummy_context_loss_counter; 30static 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
314u32 omap_pm_get_dev_context_loss_count(struct device *dev) 314int 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
340u32 omap_pm_get_dev_context_loss_count(struct device *dev) 350int 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}
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index cd90bedd9306..ef4ffc21bbae 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -426,7 +426,7 @@ static int _omap_device_notifier_call(struct notifier_block *nb,
426 * return the context loss counter for that hwmod, otherwise return 426 * return the context loss counter for that hwmod, otherwise return
427 * zero. 427 * zero.
428 */ 428 */
429u32 omap_device_get_context_loss_count(struct platform_device *pdev) 429int omap_device_get_context_loss_count(struct platform_device *pdev)
430{ 430{
431 struct omap_device *od; 431 struct omap_device *od;
432 u32 ret = 0; 432 u32 ret = 0;