ARM: OMAP: Remove timer function pointer for context loss counter
authorJon Hunter <jon-hunter@ti.com>
Tue, 5 Jun 2012 17:34:56 +0000 (12:34 -0500)
committerTony Lindgren <tony@atomide.com>
Thu, 14 Jun 2012 09:39:47 +0000 (02:39 -0700)
For OMAP2+ devices, a function pointer that returns the number of times a timer
power domain has lost context is passed to the dmtimer driver. This function
pointer is only populated for OMAP2+ devices and it is pointing to a platform
function. Given that this is a platform function, we can simplify the code by
removing the function pointer and referencing the function directly. We can use
the OMAP_TIMER_ALWON flag to determine if we need to call this function for
OMAP1 and OMAP2+ devices.

The benefit of this change is the we can remove the function pointer from the
platform data and simplifies the dmtimer migration to device-tree.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/timer.c
arch/arm/plat-omap/dmtimer.c
arch/arm/plat-omap/include/plat/dmtimer.h

index 9b6880a33793d972bb971292e53c8c2725a998ca..0e17a0d9690b7c1d189d15fbe65e209d5f2c4997 100644 (file)
@@ -494,9 +494,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
        if (timer_dev_attr)
                pdata->timer_capability = timer_dev_attr->timer_capability;
 
-#ifdef CONFIG_PM
-       pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
-#endif
        pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
                                 NULL, 0, 0);
 
index 7aa12785e23823dd800f432fa3ef255840f074d4..7875eefd0474fe1959301f61868d172bc4d63610 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/pm_runtime.h>
 
 #include <plat/dmtimer.h>
+#include <plat/omap-pm.h>
 
 #include <mach/hardware.h>
 
@@ -342,9 +343,8 @@ int omap_dm_timer_start(struct omap_dm_timer *timer)
        omap_dm_timer_enable(timer);
 
        if (!(timer->capability & OMAP_TIMER_ALWON)) {
-               u32 ctx_loss_cnt_after =
-                       timer->get_context_loss_count(&timer->pdev->dev);
-               if (ctx_loss_cnt_after != timer->ctx_loss_count)
+               if (omap_pm_get_dev_context_loss_count(&timer->pdev->dev) !=
+                               timer->ctx_loss_count)
                        omap_timer_restore_context(timer);
        }
 
@@ -374,10 +374,9 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)
 
        __omap_dm_timer_stop(timer, timer->posted, rate);
 
-       if (!(timer->capability & OMAP_TIMER_ALWON) &&
-                       timer->get_context_loss_count)
+       if (!(timer->capability & OMAP_TIMER_ALWON))
                timer->ctx_loss_count =
-                       timer->get_context_loss_count(&timer->pdev->dev);
+                       omap_pm_get_dev_context_loss_count(&timer->pdev->dev);
 
        /*
         * Since the register values are computed and written within
@@ -449,9 +448,8 @@ int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
        omap_dm_timer_enable(timer);
 
        if (!(timer->capability & OMAP_TIMER_ALWON)) {
-               u32 ctx_loss_cnt_after =
-                       timer->get_context_loss_count(&timer->pdev->dev);
-               if (ctx_loss_cnt_after != timer->ctx_loss_count)
+               if (omap_pm_get_dev_context_loss_count(&timer->pdev->dev) !=
+                               timer->ctx_loss_count)
                        omap_timer_restore_context(timer);
        }
 
@@ -693,7 +691,6 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
        timer->irq = irq->start;
        timer->reserved = omap_dm_timer_reserved_systimer(timer->id);
        timer->pdev = pdev;
-       timer->get_context_loss_count = pdata->get_context_loss_count;
        timer->capability = pdata->timer_capability;
 
        /* Skip pm_runtime_enable for OMAP1 */
index 0a7ed31954eabf71f5d8a274a2954bd5b20e3837..e11c9ea7ec53569866fcc4cba5667de522ea304d 100644 (file)
@@ -91,7 +91,6 @@ struct timer_regs {
 struct dmtimer_platform_data {
        int (*set_timer_src)(struct platform_device *pdev, int source);
        u32 needs_manual_reset:1;
-       int (*get_context_loss_count)(struct device *dev);
        u32 timer_capability;
 };
 
@@ -267,8 +266,6 @@ struct omap_dm_timer {
        u32 capability;
        struct platform_device *pdev;
        struct list_head node;
-
-       int (*get_context_loss_count)(struct device *dev);
 };
 
 int omap_dm_timer_prepare(struct omap_dm_timer *timer);