From: Sascha Hauer <s.hauer@pengutronix.de>
To: Alexander Shiyan <shc_work@mail.ru>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] clk: Add is_enabled callback
Date: Tue, 19 Mar 2013 11:36:49 +0100 [thread overview]
Message-ID: <20130319103649.GO1906@pengutronix.de> (raw)
In-Reply-To: <1363417134.599382752@f216.mail.ru>
On Sat, Mar 16, 2013 at 10:58:54AM +0400, Alexander Shiyan wrote:
> > This allows us to better detect whether a clk is enabled or not.
> >
> > - If we can ask a clk, ask it. If it's enabled, go on and ask parents
> > - If we can't ask it, but it can be enabled, depend on the enable_count.
> > if it's positive, go on and ask parents
> > - If we can't ask it and it cannot be enabled, assume it is enabled
> > and ask parents.
> >
> > This makes the CLK_ALWAYS_ENABLED unnecessary, since the fixed clk now
> > always returns 1 in its is_enabled callback.
> >
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> > drivers/clk/clk-fixed.c | 2 +-
> > drivers/clk/clk-gate.c | 14 ++++++++++++
> > drivers/clk/clk.c | 61 +++++++++++++++++++++++++++++++++++++------------
> > include/linux/clk.h | 4 ++--
> > 4 files changed, 63 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/clk/clk-fixed.c b/drivers/clk/clk-fixed.c
> > +
> > + if (val & (1 << g->shift))
> > + return 1;
> > + else
> > + return 0;
> > +}
>
> Make it simper, like:
> return !!(readl(g->reg) & (1 << g->shift));
>
Hm, do you find this simpler to read? The compiler will most likely
produce the same result.
> > unsigned int div;
> > @@ -202,6 +200,8 @@ struct clk *clk_mux(const char *name, void __iomem *reg,
> > struct clk *clk_gate(const char *name, const char *parent, void __iomem *reg,
> > u8 shift);
> >
> > +int clk_is_enabled_always(struct clk *clk);
>
> Used only in clk-fixed.c, is it really need to be declared global?
No, you're right. Will make this a local function in clk-fixed.c
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2013-03-19 10:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-15 8:54 Sascha Hauer
2013-03-16 6:58 ` Alexander Shiyan
2013-03-19 10:36 ` Sascha Hauer [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=20130319103649.GO1906@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=shc_work@mail.ru \
/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