From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Davide Rizzo <elpa.rizzo@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
linux-arm-kernel@lists.arm.linux.org.uk, ben-linux@fluff.org,
Greg KH <gregkh@suse.de>
Subject: Re: [PATCH 1/2] User access to internal clocks
Date: Mon, 9 Feb 2009 18:12:19 +0000 [thread overview]
Message-ID: <20090209181219.GC19453@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <8447d6730902090904y138af9c6r3d64278bc7a30811@mail.gmail.com>
On Mon, Feb 09, 2009 at 06:04:29PM +0100, Davide Rizzo wrote:
> +static ssize_t parent_store(struct device *dev,
> + struct device_attribute *attr, const char *buffer, size_t count)
> +{
> + struct clk *parent;
> +
> + char *s = kstrdup(buffer, GFP_KERNEL);
> +
> + if (!s)
> + return -ENOMEM;
> + if (s[strlen(s) - 1] == '\n')
> + s[strlen(s) - 1] = '\0';
> + parent = clk_get(dev, s);
> + kfree(s);
> + if (IS_ERR(parent))
> + return PTR_ERR(parent);
> +
> + mutex_lock(&mutex);
> +
> + clk_set_parent(dev_get_drvdata(dev), parent);
BTW, MXC doesn't (and won't) support run-time changing of the clk tree.
OMAP sort-of does, but it's currently buggy. It looks like S3C is also
buggy.
These implementations are currently only usable under a very strict set
of circumstances (which are not currently checked by the implementations)
and if the parent is changed while the clock is in use, it'll screw up
the clock tree - details below.
Arguably, that's a problem which the clk_set_parent() implementations need
to be solved (and I hope are going to be resolved), but it's an example
where exposing the API to allow userspace to fiddle with things produces
new ways to make things explode. Certainly the MXC folk responded saying
"we don't support run-time parent changes".
FYI, the problem basically is that the sequence:
1. clk_enable(clk);
2. clk_set_parent(clk, new_parent);
3. clk_disable(clk);
will result in the old parent having a permanently incremented usecount,
and the new_parent having a negative usecount. You could say "don't
permit enabled clocks to change parents" but I believe such a statement
would be provably incompatible with OMAP.
(This issue has just been pointed out to the relevant ARM maintainers
today.)
prev parent reply other threads:[~2009-02-09 18:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-09 17:04 [PATCH 1/2] User access to internal clocks Davide Rizzo
[not found] ` <8447d6730902090904y138af9c6r3d64278bc7a30811-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-02-09 17:10 ` Russell King - ARM Linux
[not found] ` <20090209171042.GA19453-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2009-02-09 17:44 ` Davide Rizzo
[not found] ` <8447d6730902090944s9bc96f7r76da82ea09c629f0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-02-09 17:55 ` Russell King - ARM Linux
[not found] ` <20090209175514.GB19453-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2009-02-09 18:17 ` Davide Rizzo
[not found] ` <8447d6730902091017m21cb30d0w6be6fbbbf33db4f3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-02-09 18:54 ` Davide Rizzo
[not found] ` <8447d6730902091054x7c4c842m7339382e19260bd8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-02-09 19:01 ` Russell King - ARM Linux
[not found] ` <20090209190142.GD19453-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2009-02-09 21:06 ` Davide Rizzo
2009-02-09 17:12 ` Hans J. Koch
2009-02-09 18:12 ` Russell King - ARM Linux [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=20090209181219.GC19453@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=ben-linux@fluff.org \
--cc=elpa.rizzo@gmail.com \
--cc=gregkh@suse.de \
--cc=linux-api@vger.kernel.org \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).