From: Paul Walmsley <paul@pwsan.com>
To: linux-omap@vger.kernel.org
Cc: Paul Walmsley <paul@pwsan.com>
Subject: [PATCH v2 10/11] OMAP2/3 clock: simplify omap2_clksel_get_src_field()
Date: Thu, 18 Sep 2008 11:47:21 -0600 [thread overview]
Message-ID: <20080918174718.7146.88883.stgit@localhost.localdomain> (raw)
In-Reply-To: <20080918174432.7146.21366.stgit@localhost.localdomain>
Get rid of void __iomem * usage in omap2_clksel_get_src_field.
Prepend the function name with an underscore to highlight that it is a
static function.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
arch/arm/mach-omap2/clock.c | 31 ++++++++++++-------------------
1 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 062c034..621babc 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -803,18 +803,14 @@ int omap2_clk_set_rate(struct clk *clk, unsigned long rate)
/*
* Converts encoded control register address into a full address
- * On error, *src_addr will be returned as 0.
+ * On error, the return value (parent_div) will be 0.
*/
-static u32 omap2_clksel_get_src_field(void __iomem **src_addr,
- struct clk *src_clk, u32 *field_mask,
- struct clk *clk, u32 *parent_div)
+static u32 _omap2_clksel_get_src_field(struct clk *src_clk, struct clk *clk,
+ u32 *field_val)
{
const struct clksel *clks;
const struct clksel_rate *clkr;
- *parent_div = 0;
- *src_addr = NULL;
-
clks = omap2_get_clksel_by_parent(clk, src_clk);
if (!clks)
return 0;
@@ -834,17 +830,14 @@ static u32 omap2_clksel_get_src_field(void __iomem **src_addr,
/* Should never happen. Add a clksel mask to the struct clk. */
WARN_ON(clk->clksel_mask == 0);
- *field_mask = clk->clksel_mask;
- *src_addr = clk->clksel_reg;
- *parent_div = clkr->div;
+ *field_val = clkr->val;
- return clkr->val;
+ return clkr->div;
}
int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
{
- void __iomem *src_addr;
- u32 field_val, field_mask, v, parent_div;
+ u32 field_val, v, parent_div;
if (clk->flags & CONFIG_PARTICIPANT)
return -EINVAL;
@@ -852,18 +845,18 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
if (!clk->clksel)
return -EINVAL;
- field_val = omap2_clksel_get_src_field(&src_addr, new_parent,
- &field_mask, clk, &parent_div);
- if (src_addr == NULL)
+ parent_div = _omap2_clksel_get_src_field(new_parent, clk, &field_val);
+ if (!parent_div)
return -EINVAL;
if (clk->usecount > 0)
_omap2_clk_disable(clk);
/* Set new source value (previous dividers if any in effect) */
- v = __raw_readl(src_addr) & ~field_mask;
- v |= (field_val << __ffs(field_mask));
- __raw_writel(v, src_addr);
+ v = __raw_readl(clk->clksel_reg);
+ v &= ~clk->clksel_mask;
+ v |= field_val << __ffs(clk->clksel_mask);
+ __raw_writel(v, clk->clksel_reg);
wmb();
if (clk->flags & DELAYED_APP && cpu_is_omap24xx()) {
prev parent reply other threads:[~2008-09-18 17:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-18 17:46 [PATCH v2 00/11] OMAP2/3 clock: encode prcm_mod for each struct clk Paul Walmsley
2008-09-18 17:46 ` [PATCH v2 01/11] OMAP3 clock: split mcbspX_src_fck from mcbspX_fck Paul Walmsley
2008-09-18 17:46 ` [PATCH v2 02/11] OMAP2/3 clock: shorten some variable names in clock.c for legibility Paul Walmsley
2008-09-18 17:47 ` [PATCH v2 03/11] OMAP2 clock: add clk.prcm_mod field; annotate OMAP2xxx clocks Paul Walmsley
2008-09-18 17:47 ` [PATCH v2 04/11] OMAP3 clock: add "prcm_mod" field to OMAP3xxx clocks Paul Walmsley
2008-09-18 17:47 ` [PATCH v2 05/11] OMAP2/3 clock: add _omap2_clk_{read,write}_reg() Paul Walmsley
2008-09-18 17:47 ` [PATCH v2 06/11] OMAP2/3 clock: use symbolic constants in omap2_clk_wait_ready() Paul Walmsley
2008-09-18 17:47 ` [PATCH v2 07/11] OMAP2/3 clock: use prcm_mod field " Paul Walmsley
2008-09-18 17:47 ` [PATCH v2 08/11] OMAP2/3 clock: convert omap2_wait_clock_ready() to use clk.prcm_mod Paul Walmsley
2008-09-18 17:47 ` [PATCH v2 09/11] OMAP2/3 clock: remove omap2_get_clksel() Paul Walmsley
2008-09-18 17:47 ` Paul Walmsley [this message]
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=20080918174718.7146.88883.stgit@localhost.localdomain \
--to=paul@pwsan.com \
--cc=linux-omap@vger.kernel.org \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox