From: Tony Lindgren <tony@atomide.com>
To: Nishanth Menon <nm@ti.com>
Cc: linux-omap@vger.kernel.org, devicetree-discuss@lists.ozlabs.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
"Benoît Cousson" <b-cousson@ti.com>,
"Paul Walmsley" <paul@pwsan.com>,
"Kevin Hilman" <khilman@deeprootsystems.com>,
"Mike Turquette" <mturquette@linaro.org>
Subject: Re: [PATCH V4 1/6] clk: OMAP: introduce device tree binding to kernel clock data
Date: Fri, 12 Apr 2013 16:31:43 -0700 [thread overview]
Message-ID: <20130412233142.GE10155@atomide.com> (raw)
In-Reply-To: <1365807278-554-2-git-send-email-nm@ti.com>
* Nishanth Menon <nm@ti.com> [130412 15:59]:
> --- /dev/null
> +++ b/drivers/clk/omap/clk.c
> +/**
> + * omap_clk_src_get() - Get OMAP clock from node name when needed
> + * @clkspec: clkspec argument
> + * @data: unused
> + *
> + * REVISIT: We assume the following:
> + * 1. omap clock names end with _ck
> + * 2. omap clock names are under 32 characters in length
> + */
> +static struct clk *omap_clk_src_get(struct of_phandle_args *clkspec, void *data)
> +{
> + struct clk *clk;
> + char clk_name[32];
> + struct device_node *np = clkspec->np;
> +
> + /* Set up things so consumer can call clk_get() with name */
I would leave out the comment above, it's a leftover from
the clk_add_alias() version that we don't need because of
of_clk_get().
> + snprintf(clk_name, 32, "%s_ck", np->name);
> + clk = clk_get(NULL, clk_name);
> + if (IS_ERR(clk)) {
> + pr_err("%s: could not get clock %s(%ld)\n", __func__,
> + clk_name, PTR_ERR(clk));
> + goto out;
> + }
> + clk_put(clk);
> +
> +out:
> + return clk;
> +}
> +
> +/**
> + * omap_clk_probe() - create link from DT definition to clock data
> + * @pdev: device node
> + *
> + * NOTE: We assume that omap clocks are not removed.
> + */
How about drop the comment on clocks being removed above.
It no longer an issue, so maybe something like this instead:
* Note that we look up the clock lazily when the consumer
* driver does of_clk_get() and initialize a NULL clock here.
> +static int omap_clk_probe(struct platform_device *pdev)
> +{
> + int res;
> + struct device_node *np = pdev->dev.of_node;
> +
> + /* This allows the driver to of_clk_get() */
> + res = of_clk_add_provider(np, omap_clk_src_get, NULL);
> + if (res)
> + dev_err(&pdev->dev, "could not add provider(%d)\n", res);
> +
> + return res;
> +}
> +
> +/* We assume here that OMAP clocks will not be removed */
Then the above comment can be removed too.
Regards,
Tony
next prev parent reply other threads:[~2013-04-12 23:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-12 22:54 [PATCH V4 0/6] ARM: OMAP3+: support cpufreq-cpu0 for device tree boot Nishanth Menon
[not found] ` <1365807278-554-1-git-send-email-nm-l0cyMroinI0@public.gmane.org>
2013-04-12 22:54 ` [PATCH V4 1/6] clk: OMAP: introduce device tree binding to kernel clock data Nishanth Menon
2013-04-12 23:31 ` Tony Lindgren [this message]
[not found] ` <20130412233142.GE10155-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2013-04-12 23:39 ` Nishanth Menon
2013-04-13 17:22 ` Tony Lindgren
[not found] ` <20130413172210.GM10155-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2013-04-14 21:19 ` Nishanth Menon
2013-04-24 16:28 ` Mike Turquette
2013-04-25 7:01 ` Rajendra Nayak
2013-04-15 16:22 ` Stephen Warren
2013-04-15 18:43 ` Nishanth Menon
2013-04-12 22:54 ` [PATCH V4 3/6] ARM: dts: OMAP4: add clock nodes for CPU Nishanth Menon
2013-04-12 22:54 ` [PATCH V4 2/6] ARM: dts: OMAP3: " Nishanth Menon
2013-04-12 22:54 ` [PATCH V4 4/6] ARM: dts: AM33XX: " Nishanth Menon
2013-04-12 22:54 ` [PATCH V4 5/6] ARM: OMAP2+: AM33XX: add lateinit hook for calling pm late init Nishanth Menon
2013-04-12 22:54 ` [PATCH V4 6/6] ARM: OMAP3+: use cpu0-cpufreq driver in device tree supported boot Nishanth Menon
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=20130412233142.GE10155@atomide.com \
--to=tony@atomide.com \
--cc=b-cousson@ti.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=khilman@deeprootsystems.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=mturquette@linaro.org \
--cc=nm@ti.com \
--cc=paul@pwsan.com \
/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).