From: Jon Hunter <jon-hunter@ti.com> To: Tony Lindgren <tony@atomide.com>, Kevin Hilman <khilman@ti.com>, Paul Walmsley <paul@pwsan.com> Cc: linux-omap <linux-omap@vger.kernel.org>, linux-arm <linux-arm-kernel@lists.infradead.org>, Jon Hunter <jon-hunter@ti.com> Subject: [PATCH 10/10] ARM: OMAP: Remove unnecessary call to clk_get() Date: Wed, 5 Sep 2012 14:04:32 -0500 [thread overview] Message-ID: <1346871872-24413-11-git-send-email-jon-hunter@ti.com> (raw) In-Reply-To: <1346871872-24413-1-git-send-email-jon-hunter@ti.com> 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> --- arch/arm/plat-omap/dmtimer.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index 3b548dc..a4cc122 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c @@ -400,7 +400,7 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) { int ret; char *parent_name = NULL; - struct clk *fclk, *parent; + struct clk *parent; struct dmtimer_platform_data *pdata; if (unlikely(!timer)) @@ -419,11 +419,8 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) if (pdata->set_timer_src) return pdata->set_timer_src(timer->pdev, source); - fclk = clk_get(&timer->pdev->dev, "fck"); - if (IS_ERR_OR_NULL(fclk)) { - pr_err("%s: fck not found\n", __func__); + if (!timer->fclk) return -EINVAL; - } switch (source) { case OMAP_TIMER_SRC_SYS_CLK: @@ -442,18 +439,15 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) parent = clk_get(&timer->pdev->dev, parent_name); if (IS_ERR_OR_NULL(parent)) { pr_err("%s: %s not found\n", __func__, parent_name); - ret = -EINVAL; - goto out; + return -EINVAL; } - ret = clk_set_parent(fclk, parent); + ret = clk_set_parent(timer->fclk, parent); if (IS_ERR_VALUE(ret)) pr_err("%s: failed to set %s as parent\n", __func__, parent_name); clk_put(parent); -out: - clk_put(fclk); return ret; } -- 1.7.9.5
WARNING: multiple messages have this Message-ID (diff)
From: jon-hunter@ti.com (Jon Hunter) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 10/10] ARM: OMAP: Remove unnecessary call to clk_get() Date: Wed, 5 Sep 2012 14:04:32 -0500 [thread overview] Message-ID: <1346871872-24413-11-git-send-email-jon-hunter@ti.com> (raw) In-Reply-To: <1346871872-24413-1-git-send-email-jon-hunter@ti.com> 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> --- arch/arm/plat-omap/dmtimer.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index 3b548dc..a4cc122 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c @@ -400,7 +400,7 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) { int ret; char *parent_name = NULL; - struct clk *fclk, *parent; + struct clk *parent; struct dmtimer_platform_data *pdata; if (unlikely(!timer)) @@ -419,11 +419,8 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) if (pdata->set_timer_src) return pdata->set_timer_src(timer->pdev, source); - fclk = clk_get(&timer->pdev->dev, "fck"); - if (IS_ERR_OR_NULL(fclk)) { - pr_err("%s: fck not found\n", __func__); + if (!timer->fclk) return -EINVAL; - } switch (source) { case OMAP_TIMER_SRC_SYS_CLK: @@ -442,18 +439,15 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) parent = clk_get(&timer->pdev->dev, parent_name); if (IS_ERR_OR_NULL(parent)) { pr_err("%s: %s not found\n", __func__, parent_name); - ret = -EINVAL; - goto out; + return -EINVAL; } - ret = clk_set_parent(fclk, parent); + ret = clk_set_parent(timer->fclk, parent); if (IS_ERR_VALUE(ret)) pr_err("%s: failed to set %s as parent\n", __func__, parent_name); clk_put(parent); -out: - clk_put(fclk); return ret; } -- 1.7.9.5
next prev parent reply other threads:[~2012-09-05 19:04 UTC|newest] Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-09-05 19:04 [PATCH 00/10] ARM: OMAP: DMTIMER fixes and clean-up Jon Hunter 2012-09-05 19:04 ` Jon Hunter 2012-09-05 19:04 ` [PATCH 01/10] ARM: OMAP3+: Implement timer workaround for errata i103 and i767 Jon Hunter 2012-09-05 19:04 ` Jon Hunter 2012-09-06 5:07 ` Vaibhav Hiremath 2012-09-06 5:07 ` Vaibhav Hiremath 2012-09-06 14:06 ` Jon Hunter 2012-09-06 14:06 ` Jon Hunter 2012-09-06 14:42 ` Jon Hunter 2012-09-06 14:42 ` Jon Hunter 2012-09-06 15:20 ` Jon Hunter 2012-09-06 15:20 ` Jon Hunter 2012-09-13 10:26 ` Hiremath, Vaibhav 2012-09-13 10:26 ` Hiremath, Vaibhav 2012-09-13 10:24 ` Hiremath, Vaibhav 2012-09-13 10:24 ` Hiremath, Vaibhav 2012-09-05 19:04 ` [PATCH 02/10] ARM: OMAP: Fix timer posted mode support Jon Hunter 2012-09-05 19:04 ` Jon Hunter 2012-09-06 12:57 ` Vaibhav Hiremath 2012-09-06 12:57 ` Vaibhav Hiremath 2012-09-06 14:20 ` Jon Hunter 2012-09-06 14:20 ` Jon Hunter 2012-09-06 16:01 ` Jon Hunter 2012-09-06 16:01 ` Jon Hunter 2012-09-13 10:24 ` Hiremath, Vaibhav 2012-09-13 10:24 ` Hiremath, Vaibhav 2012-09-05 19:04 ` [PATCH 03/10] ARM: OMAP3: Correct HWMOD DMTIMER SYSC register declarations Jon Hunter 2012-09-05 19:04 ` Jon Hunter 2012-09-05 19:04 ` [PATCH 04/10] ARM: OMAP2/3: Define HWMOD software reset status for DMTIMERs Jon Hunter 2012-09-05 19:04 ` Jon Hunter 2012-09-05 19:04 ` [PATCH 05/10] ARM: OMAP2+: Don't use __omap_dm_timer_reset() Jon Hunter 2012-09-05 19:04 ` Jon Hunter 2012-09-05 19:04 ` [PATCH 06/10] ARM: OMAP: Fix dmtimer reset for timer1 Jon Hunter 2012-09-05 19:04 ` Jon Hunter 2012-09-05 19:04 ` [PATCH 07/10] ARM: OMAP: Clean-up dmtimer reset code Jon Hunter 2012-09-05 19:04 ` Jon Hunter 2012-09-05 19:04 ` [PATCH 08/10] ARM: OMAP: Clean-up timer posted mode support Jon Hunter 2012-09-05 19:04 ` Jon Hunter 2012-09-07 22:22 ` Tony Lindgren 2012-09-07 22:22 ` Tony Lindgren 2012-09-10 21:59 ` Jon Hunter 2012-09-10 21:59 ` Jon Hunter 2012-09-11 0:58 ` Tony Lindgren 2012-09-11 0:58 ` Tony Lindgren 2012-09-11 16:26 ` Jon Hunter 2012-09-11 16:26 ` Jon Hunter 2012-09-11 16:34 ` Tony Lindgren 2012-09-11 16:34 ` Tony Lindgren 2012-09-13 3:26 ` Jon Hunter 2012-09-13 3:26 ` Jon Hunter 2012-09-05 19:04 ` [PATCH 09/10] ARM: OMAP: Add dmtimer interrupt disable function Jon Hunter 2012-09-05 19:04 ` Jon Hunter 2012-09-06 12:58 ` Vaibhav Hiremath 2012-09-06 12:58 ` Vaibhav Hiremath 2012-09-06 14:26 ` Jon Hunter 2012-09-06 14:26 ` Jon Hunter 2012-09-05 19:04 ` Jon Hunter [this message] 2012-09-05 19:04 ` [PATCH 10/10] ARM: OMAP: Remove unnecessary call to clk_get() Jon Hunter 2012-09-06 12:58 ` [PATCH 00/10] ARM: OMAP: DMTIMER fixes and clean-up Vaibhav Hiremath 2012-09-06 12:58 ` Vaibhav Hiremath 2012-09-06 14:30 ` Jon Hunter 2012-09-06 14:30 ` Jon Hunter
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1346871872-24413-11-git-send-email-jon-hunter@ti.com \ --to=jon-hunter@ti.com \ --cc=khilman@ti.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-omap@vger.kernel.org \ --cc=paul@pwsan.com \ --cc=tony@atomide.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.