From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v8 4/7] clk: use struct clk only for external API
Date: Wed, 03 Sep 2014 16:45:47 -0700 [thread overview]
Message-ID: <5407A82B.7000602@codeaurora.org> (raw)
In-Reply-To: <1409585675-26894-1-git-send-email-tomeu.vizoso@collabora.com>
On 09/01/14 08:34, Tomeu Vizoso wrote:
>
> NOTE: with this patch, clk_get_parent() behaves like clk_get(), i.e. it
> needs to be matched with a clk_put(). Otherwise, memory will leak.
>
[...]
> }
> +EXPORT_SYMBOL_GPL(clk_provider_get_parent);
> +
> +/**
> + * clk_get_parent - return the parent of a clk
> + * @clk_user: the clk whose parent gets returned
> + *
> + * Simply returns clk->parent. Returns NULL if clk is NULL.
We should at least document here that clk_put() is expected to be called
when it's not being used. I wonder why it's this way though. Why can't
every clk_core have a private clk pointer to it's parent that's created
during registration time? Then we just hand that out for
clk_get_parent() and destroy it when the clk_core is freed?
> + */
> +struct clk *clk_get_parent(struct clk *clk_user)
> +{
> + struct clk_core *clk;
> + struct clk_core *parent;
> +
> + if (!clk_user)
> + return NULL;
> +
> + clk = clk_to_clk_core(clk_user);
> + parent = clk_provider_get_parent(clk);
> +
> + return __clk_create_clk(parent);
> +}
> EXPORT_SYMBOL_GPL(clk_get_parent);
>
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@codeaurora.org>
To: Tomeu Vizoso <tomeu.vizoso@collabora.com>,
Mike Turquette <mturquette@linaro.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>,
Tomasz Figa <t.figa@samsung.com>,
linux-kernel@vger.kernel.org,
Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
rabin@rab.in, Thierry Reding <thierry.reding@gmail.com>,
Peter De Schrijver <pdeschrijver@nvidia.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v8 4/7] clk: use struct clk only for external API
Date: Wed, 03 Sep 2014 16:45:47 -0700 [thread overview]
Message-ID: <5407A82B.7000602@codeaurora.org> (raw)
In-Reply-To: <1409585675-26894-1-git-send-email-tomeu.vizoso@collabora.com>
On 09/01/14 08:34, Tomeu Vizoso wrote:
>
> NOTE: with this patch, clk_get_parent() behaves like clk_get(), i.e. it
> needs to be matched with a clk_put(). Otherwise, memory will leak.
>
[...]
> }
> +EXPORT_SYMBOL_GPL(clk_provider_get_parent);
> +
> +/**
> + * clk_get_parent - return the parent of a clk
> + * @clk_user: the clk whose parent gets returned
> + *
> + * Simply returns clk->parent. Returns NULL if clk is NULL.
We should at least document here that clk_put() is expected to be called
when it's not being used. I wonder why it's this way though. Why can't
every clk_core have a private clk pointer to it's parent that's created
during registration time? Then we just hand that out for
clk_get_parent() and destroy it when the clk_core is freed?
> + */
> +struct clk *clk_get_parent(struct clk *clk_user)
> +{
> + struct clk_core *clk;
> + struct clk_core *parent;
> +
> + if (!clk_user)
> + return NULL;
> +
> + clk = clk_to_clk_core(clk_user);
> + parent = clk_provider_get_parent(clk);
> +
> + return __clk_create_clk(parent);
> +}
> EXPORT_SYMBOL_GPL(clk_get_parent);
>
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
next prev parent reply other threads:[~2014-09-03 23:45 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-01 15:29 [PATCH v8 0/7] Per-user clock constraints Tomeu Vizoso
2014-09-01 15:29 ` Tomeu Vizoso
2014-09-01 15:29 ` [PATCH v8 1/7] clk: Add temporary mapping to the existing API Tomeu Vizoso
2014-09-01 15:29 ` Tomeu Vizoso
2014-09-01 15:29 ` [PATCH v8 2/7] ASoC: mxs-saif: fix mixed use of public and provider clk API Tomeu Vizoso
2014-09-01 15:29 ` Tomeu Vizoso
2014-09-01 15:32 ` [PATCH v8 3/7] clk: Move all drivers to use internal API Tomeu Vizoso
2014-09-01 15:32 ` Tomeu Vizoso
2014-09-02 7:13 ` Ulf Hansson
2014-09-02 7:13 ` Ulf Hansson
2014-09-03 12:59 ` Tomeu Vizoso
2014-09-03 12:59 ` Tomeu Vizoso
2014-09-01 15:34 ` [PATCH v8 4/7] clk: use struct clk only for external API Tomeu Vizoso
2014-09-01 15:34 ` Tomeu Vizoso
2014-09-01 15:34 ` [PATCH v8 5/7] clk: per-user clock accounting for debug Tomeu Vizoso
2014-09-01 15:34 ` Tomeu Vizoso
2014-09-01 15:34 ` [PATCH v8 6/7] clk: Add floor and ceiling constraints to clock rates Tomeu Vizoso
2014-09-01 15:34 ` Tomeu Vizoso
2014-09-03 0:13 ` Mike Turquette
2014-09-03 14:14 ` Tomeu Vizoso
2014-09-03 14:14 ` Tomeu Vizoso
2014-09-01 15:34 ` [PATCH v8 7/7] clk: Warn of unbalanced clk_prepare() calls Tomeu Vizoso
2014-09-01 15:34 ` Tomeu Vizoso
2014-09-03 23:45 ` Stephen Boyd [this message]
2014-09-03 23:45 ` [PATCH v8 4/7] clk: use struct clk only for external API Stephen Boyd
2014-09-04 13:34 ` Tomeu Vizoso
2014-09-04 13:34 ` Tomeu Vizoso
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=5407A82B.7000602@codeaurora.org \
--to=sboyd@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.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 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.