From: Mike Turquette <mturquette@ti.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
Russell King <linux@arm.linux.org.uk>
Subject: Re: [PATCH 1/3] CLK: uninline clk_prepare() and clk_unprepare()
Date: Wed, 21 Nov 2012 12:43:24 -0800 [thread overview]
Message-ID: <20121121204324.21126.99677@nucleus> (raw)
In-Reply-To: <CAKohpo=B_7rVwePziyNe0rTMokcib_FgEN28cy4nByAzbUyaqg@mail.gmail.com>
Quoting Viresh Kumar (2012-11-20 02:13:55)
> On 20 November 2012 14:52, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> > We'll need to invoke clk_unprepare() via a pointer in our devm_*
> > conversion so let's uninline the pair.
>
> Sorry, but you aren't doing this :(
> This routine is already uninlined as it is in clk.c
>
> Instead you are just moving clk_prepare(), etc calls within
> #ifdef CONFIG_HAVE_CLK
> #else
> #endif
>
> I doubt why they have been added under #ifdef CONFIG_HAVE_CLK_PREPARE
> earlier. Can they exist without CONFIG_HAVE_CLK
>
> @Mike: ?
>
HAVE_CLK logically wraps HAVE_CLK_PREPARE. There is no point in
selecting HAVE_CLK_PREPARE without HAVE_CLK.
Looking through the code I see that this used to be the case. Commit
93abe8e "clk: add non CONFIG_HAVE_CLK routines" moved the
clk_(un)prepare declarations outside of #ifdef CONFIG_HAVE_CLK. That
commit was authored by you. Can you elaborate on why that aspect of the
patch was needed?
Thanks,
Mike
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > ---
> > drivers/clk/clk.c | 4 ++++
> > include/linux/clk.h | 68 +++++++++++++++++++++++++----------------------------
> > 2 files changed, 36 insertions(+), 36 deletions(-)
> >
> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > index 56e4495e..1b642f2 100644
> > --- a/drivers/clk/clk.c
> > +++ b/drivers/clk/clk.c
> > @@ -374,6 +374,7 @@ struct clk *__clk_lookup(const char *name)
> >
> > void __clk_unprepare(struct clk *clk)
> > {
> > +#ifdef CONFIG_HAVE_CLK_PREPARE
>
> clk.c is compiled if COMMON_CLK is selected. And COMMON_CLK has following:
> select HAVE_CLK_PREPARE
>
> So, these checks you added don't have a meaning.
>
> > if (!clk)
> > return;
> >
> > @@ -389,6 +390,7 @@ void __clk_unprepare(struct clk *clk)
> > clk->ops->unprepare(clk->hw);
> >
> > __clk_unprepare(clk->parent);
> > +#endif
> > }
> >
> > /**
> > @@ -412,6 +414,7 @@ EXPORT_SYMBOL_GPL(clk_unprepare);
> >
> > int __clk_prepare(struct clk *clk)
> > {
> > +#ifdef CONFIG_HAVE_CLK_PREPARE
>
> ditto.
>
> > int ret = 0;
> >
> > if (!clk)
> > @@ -432,6 +435,7 @@ int __clk_prepare(struct clk *clk)
> > }
> >
> > clk->prepare_count++;
> > +#endif
> >
> > return 0;
> > }
> > diff --git a/include/linux/clk.h b/include/linux/clk.h
> > index b3ac22d..f8204c3 100644
> > --- a/include/linux/clk.h
> > +++ b/include/linux/clk.h
> > @@ -84,42 +84,6 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
> >
> > #endif
> >
> > -/**
> > - * clk_prepare - prepare a clock source
> > - * @clk: clock source
> > - *
> > - * This prepares the clock source for use.
> > - *
> > - * Must not be called from within atomic context.
> > - */
> > -#ifdef CONFIG_HAVE_CLK_PREPARE
> > -int clk_prepare(struct clk *clk);
> > -#else
> > -static inline int clk_prepare(struct clk *clk)
> > -{
> > - might_sleep();
> > - return 0;
> > -}
> > -#endif
> > -
> > -/**
> > - * clk_unprepare - undo preparation of a clock source
> > - * @clk: clock source
> > - *
> > - * This undoes a previously prepared clock. The caller must balance
> > - * the number of prepare and unprepare calls.
> > - *
> > - * Must not be called from within atomic context.
> > - */
> > -#ifdef CONFIG_HAVE_CLK_PREPARE
> > -void clk_unprepare(struct clk *clk);
> > -#else
> > -static inline void clk_unprepare(struct clk *clk)
> > -{
> > - might_sleep();
> > -}
> > -#endif
> > -
> > #ifdef CONFIG_HAVE_CLK
> > /**
> > * clk_get - lookup and obtain a reference to a clock producer.
> > @@ -159,6 +123,27 @@ struct clk *clk_get(struct device *dev, const char *id);
> > struct clk *devm_clk_get(struct device *dev, const char *id);
> >
> > /**
> > + * clk_prepare - prepare a clock source
> > + * @clk: clock source
> > + *
> > + * This prepares the clock source for use.
> > + *
> > + * Must not be called from within atomic context.
> > + */
> > +int clk_prepare(struct clk *clk);
> > +
> > +/**
> > + * clk_unprepare - undo preparation of a clock source
> > + * @clk: clock source
> > + *
> > + * This undoes a previously prepared clock. The caller must balance
> > + * the number of prepare and unprepare calls.
> > + *
> > + * Must not be called from within atomic context.
> > + */
> > +void clk_unprepare(struct clk *clk);
> > +
> > +/**
> > * clk_enable - inform the system when the clock source should be running.
> > * @clk: clock source
> > *
> > @@ -292,6 +277,17 @@ static inline void clk_put(struct clk *clk) {}
> >
> > static inline void devm_clk_put(struct device *dev, struct clk *clk) {}
> >
> > +static inline int clk_prepare(struct clk *clk)
> > +{
> > + might_sleep();
> > + return 0;
> > +}
> > +
> > +static inline void clk_unprepare(struct clk *clk)
> > +{
> > + might_sleep();
> > +}
> > +
> > static inline int clk_enable(struct clk *clk)
> > {
> > return 0;
> > --
> > 1.7.11.7
> >
next prev parent reply other threads:[~2012-11-21 20:43 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-20 9:22 [RFC/PATCH 0/3] CLK: add more devm_* APIs Dmitry Torokhov
2012-11-20 9:22 ` [PATCH 1/3] CLK: uninline clk_prepare() and clk_unprepare() Dmitry Torokhov
2012-11-20 9:32 ` Russell King - ARM Linux
2012-11-20 9:40 ` Viresh Kumar
2012-11-20 9:57 ` Dmitry Torokhov
2012-11-20 10:13 ` Viresh Kumar
2012-11-21 20:43 ` Mike Turquette [this message]
2012-11-21 20:54 ` Dmitry Torokhov
2012-11-21 22:38 ` Russell King - ARM Linux
2012-11-22 2:17 ` Dmitry Torokhov
2012-11-22 3:11 ` Dmitry Torokhov
2012-11-22 3:24 ` Mike Turquette
2012-11-22 9:31 ` Russell King - ARM Linux
2012-11-22 3:26 ` Viresh Kumar
2012-11-22 9:30 ` Russell King - ARM Linux
2012-11-22 10:03 ` Russell King - ARM Linux
2012-11-22 10:08 ` Viresh Kumar
2012-11-23 7:19 ` Dmitry Torokhov
2012-11-23 7:27 ` Viresh Kumar
2012-11-23 8:08 ` Dmitry Torokhov
2012-11-23 8:43 ` Shawn Guo
2012-11-22 3:34 ` Viresh Kumar
2012-11-22 4:05 ` Mike Turquette
2012-11-20 9:22 ` [PATCH 2/3] CLK: uninline clk_prepare_enable() and clk_disable_unprepare() Dmitry Torokhov
2012-11-20 9:35 ` Russell King - ARM Linux
2012-11-20 10:18 ` Viresh Kumar
2012-12-16 11:40 ` Viresh Kumar
2012-12-16 11:41 ` Viresh Kumar
2012-12-16 11:57 ` Russell King - ARM Linux
2012-12-16 12:20 ` Viresh Kumar
2012-12-16 12:40 ` Russell King - ARM Linux
2012-12-16 13:05 ` Viresh Kumar
2012-12-16 13:09 ` Russell King - ARM Linux
2012-12-17 5:42 ` Dmitry Torokhov
2013-04-08 10:19 ` Viresh Kumar
2014-01-13 14:06 ` Andy Shevchenko
2012-11-20 9:22 ` [PATCH 3/3] CLK: add more managed APIs Dmitry Torokhov
2012-11-20 10:05 ` Viresh Kumar
2012-11-20 9:34 ` [RFC/PATCH 0/3] CLK: add more devm_* APIs Russell King - ARM Linux
2012-11-20 9:53 ` Dmitry Torokhov
2012-11-22 5:34 ` [PATCH v2 " Dmitry Torokhov
2012-11-22 5:34 ` [PATCH v2 1/3] CLK: get rid of HAVE_CLK_PREPARE Dmitry Torokhov
2012-11-22 6:12 ` Shawn Guo
2012-11-22 9:54 ` Russell King - ARM Linux
2012-11-22 5:34 ` [PATCH v2 2/3] CLK: uninline clk_prepare_enable() and clk_disable_unprepare() Dmitry Torokhov
2012-11-22 5:34 ` [PATCH v2 3/3] CLK: add more managed APIs Dmitry Torokhov
2017-01-02 18:09 ` [v2,3/3] " Guenter Roeck
2012-11-22 5:47 ` [PATCH v2 0/3] CLK: add more devm_* APIs Viresh Kumar
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=20121121204324.21126.99677@nucleus \
--to=mturquette@ti.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=viresh.kumar@linaro.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