diff options
author | Jon Hunter <jon-hunter@ti.com> | 2012-07-18 21:10:12 -0400 |
---|---|---|
committer | Jon Hunter <jon-hunter@ti.com> | 2012-11-12 17:23:56 -0500 |
commit | d7aba5540d3f1aa2d7248d2f81506d994b25b327 (patch) | |
tree | de6cd0f50c12ee907d4b378951781e3cf67a11f3 /arch/arm/plat-omap/dmtimer.c | |
parent | 4249d96ca35a765c25a70b7d29df5b6d80987c7f (diff) |
ARM: OMAP: Remove unnecessary call to clk_get()
Whenever we call the function omap_dm_timer_set_source() to set the clock
source of a dmtimer we look-up the dmtimer functional clock source by
calling clk_get(). This is not necessary because on requesting a dmtimer
we look-up the functional clock source and store it in the omap_dm_timer
structure. So instead of looking up the clock again used the clock handle
that stored in the omap_dm_timer structure.
Signed-off-by: Jon Hunter <jon-hunter@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Diffstat (limited to 'arch/arm/plat-omap/dmtimer.c')
-rw-r--r-- | arch/arm/plat-omap/dmtimer.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index b4e6634380e5..305faf539465 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c | |||
@@ -448,7 +448,7 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) | |||
448 | { | 448 | { |
449 | int ret; | 449 | int ret; |
450 | char *parent_name = NULL; | 450 | char *parent_name = NULL; |
451 | struct clk *fclk, *parent; | 451 | struct clk *parent; |
452 | struct dmtimer_platform_data *pdata; | 452 | struct dmtimer_platform_data *pdata; |
453 | 453 | ||
454 | if (unlikely(!timer)) | 454 | if (unlikely(!timer)) |
@@ -467,11 +467,8 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) | |||
467 | if (pdata && pdata->set_timer_src) | 467 | if (pdata && pdata->set_timer_src) |
468 | return pdata->set_timer_src(timer->pdev, source); | 468 | return pdata->set_timer_src(timer->pdev, source); |
469 | 469 | ||
470 | fclk = clk_get(&timer->pdev->dev, "fck"); | 470 | if (!timer->fclk) |
471 | if (IS_ERR_OR_NULL(fclk)) { | ||
472 | pr_err("%s: fck not found\n", __func__); | ||
473 | return -EINVAL; | 471 | return -EINVAL; |
474 | } | ||
475 | 472 | ||
476 | switch (source) { | 473 | switch (source) { |
477 | case OMAP_TIMER_SRC_SYS_CLK: | 474 | case OMAP_TIMER_SRC_SYS_CLK: |
@@ -490,18 +487,15 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) | |||
490 | parent = clk_get(&timer->pdev->dev, parent_name); | 487 | parent = clk_get(&timer->pdev->dev, parent_name); |
491 | if (IS_ERR_OR_NULL(parent)) { | 488 | if (IS_ERR_OR_NULL(parent)) { |
492 | pr_err("%s: %s not found\n", __func__, parent_name); | 489 | pr_err("%s: %s not found\n", __func__, parent_name); |
493 | ret = -EINVAL; | 490 | return -EINVAL; |
494 | goto out; | ||
495 | } | 491 | } |
496 | 492 | ||
497 | ret = clk_set_parent(fclk, parent); | 493 | ret = clk_set_parent(timer->fclk, parent); |
498 | if (IS_ERR_VALUE(ret)) | 494 | if (IS_ERR_VALUE(ret)) |
499 | pr_err("%s: failed to set %s as parent\n", __func__, | 495 | pr_err("%s: failed to set %s as parent\n", __func__, |
500 | parent_name); | 496 | parent_name); |
501 | 497 | ||
502 | clk_put(parent); | 498 | clk_put(parent); |
503 | out: | ||
504 | clk_put(fclk); | ||
505 | 499 | ||
506 | return ret; | 500 | return ret; |
507 | } | 501 | } |