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>
This commit is contained in:
parent
4249d96ca3
commit
d7aba5540d
1 changed files with 4 additions and 10 deletions
|
@ -448,7 +448,7 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char *parent_name = NULL;
|
char *parent_name = NULL;
|
||||||
struct clk *fclk, *parent;
|
struct clk *parent;
|
||||||
struct dmtimer_platform_data *pdata;
|
struct dmtimer_platform_data *pdata;
|
||||||
|
|
||||||
if (unlikely(!timer))
|
if (unlikely(!timer))
|
||||||
|
@ -467,11 +467,8 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
|
||||||
if (pdata && pdata->set_timer_src)
|
if (pdata && pdata->set_timer_src)
|
||||||
return pdata->set_timer_src(timer->pdev, source);
|
return pdata->set_timer_src(timer->pdev, source);
|
||||||
|
|
||||||
fclk = clk_get(&timer->pdev->dev, "fck");
|
if (!timer->fclk)
|
||||||
if (IS_ERR_OR_NULL(fclk)) {
|
|
||||||
pr_err("%s: fck not found\n", __func__);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
|
||||||
|
|
||||||
switch (source) {
|
switch (source) {
|
||||||
case OMAP_TIMER_SRC_SYS_CLK:
|
case OMAP_TIMER_SRC_SYS_CLK:
|
||||||
|
@ -490,18 +487,15 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
|
||||||
parent = clk_get(&timer->pdev->dev, parent_name);
|
parent = clk_get(&timer->pdev->dev, parent_name);
|
||||||
if (IS_ERR_OR_NULL(parent)) {
|
if (IS_ERR_OR_NULL(parent)) {
|
||||||
pr_err("%s: %s not found\n", __func__, parent_name);
|
pr_err("%s: %s not found\n", __func__, parent_name);
|
||||||
ret = -EINVAL;
|
return -EINVAL;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = clk_set_parent(fclk, parent);
|
ret = clk_set_parent(timer->fclk, parent);
|
||||||
if (IS_ERR_VALUE(ret))
|
if (IS_ERR_VALUE(ret))
|
||||||
pr_err("%s: failed to set %s as parent\n", __func__,
|
pr_err("%s: failed to set %s as parent\n", __func__,
|
||||||
parent_name);
|
parent_name);
|
||||||
|
|
||||||
clk_put(parent);
|
clk_put(parent);
|
||||||
out:
|
|
||||||
clk_put(fclk);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue