lkml.org 
[lkml]   [2014]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 26/26] ARM: OMAP: dmtimer: Use is_timer_available function in omap_dm_timer_trigger
Date
Timer availability can be checked with is_timer_available function. Move it
before omap_dm_timer_trigger and use it.

Signed-off-by: Joel Fernandes <joelf@ti.com>
---
arch/arm/plat-omap/dmtimer.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 1059881..0d0e83b 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -221,6 +221,19 @@ int omap_dm_timer_reserve_systimer(int id)
return 0;
}

+static int is_timer_available(struct omap_dm_timer *timer)
+{
+ if (timer && timer->systimer)
+ return 1;
+
+ if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
+ pr_err("Timer not available or enabled.\n");
+ WARN_ON(1);
+ return 0;
+ }
+ return 1;
+}
+
void omap_dm_timer_init_regs(struct omap_dm_timer *timer)
{
u32 tidr;
@@ -524,7 +537,7 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_get_fclk);

int omap_dm_timer_trigger(struct omap_dm_timer *timer)
{
- if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
+ if (!is_timer_available(timer)) {
pr_err("%s: timer not available or enabled.\n", __func__);
return -EINVAL;
}
@@ -867,19 +880,6 @@ int omap_dm_timer_set_int_disable(struct omap_dm_timer *timer, u32 mask)
}
EXPORT_SYMBOL_GPL(omap_dm_timer_set_int_disable);

-static int is_timer_available(struct omap_dm_timer *timer)
-{
- if (timer && timer->systimer)
- return 1;
-
- if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
- pr_err("Timer not available or enabled.\n");
- WARN_ON(1);
- return 0;
- }
- return 1;
-}
-
unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer)
{
unsigned int l;
--
1.7.9.5


\
 
 \ /
  Last update: 2014-04-25 01:21    [W:0.246 / U:0.964 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site