From: mturquette@linaro.org (Mike Turquette)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC v1 1/3] clk: Add function to parse an arbitrary clocks list property
Date: Sun, 23 Feb 2014 16:43:35 -0800 [thread overview]
Message-ID: <20140224004335.22529.74369@quantum> (raw)
In-Reply-To: <1392829124-25705-2-git-send-email-s.nawrocki@samsung.com>
Quoting Sylwester Nawrocki (2014-02-19 08:58:42)
> The of_clk_get_list_entry() function is like of_clk_get() except it allows
> to pass name of a DT property containing list of phandles and clock specifiers.
> For of_clk_get() it has been hard coded to "clocks".
>
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> drivers/clk/clk.h | 3 +++
> drivers/clk/clkdev.c | 25 +++++++++++++++++++++----
> 2 files changed, 24 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/clk/clk.h b/drivers/clk/clk.h
> index 795cc9f..dd9def1 100644
> --- a/drivers/clk/clk.h
> +++ b/drivers/clk/clk.h
> @@ -10,7 +10,10 @@
> */
>
> #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
> +
> struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec);
> void of_clk_lock(void);
> void of_clk_unlock(void);
> +struct clk *of_clk_get_list_entry(struct device_node *np,
> + const char *list_name, int index);
> #endif
> diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
> index a360b2e..465662e 100644
> --- a/drivers/clk/clkdev.c
> +++ b/drivers/clk/clkdev.c
> @@ -27,17 +27,28 @@ static LIST_HEAD(clocks);
> static DEFINE_MUTEX(clocks_mutex);
>
> #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
> -struct clk *of_clk_get(struct device_node *np, int index)
> +/**
> + * of_clk_get_list_entry() - Parse and lookup a clock referenced by a device node
> + * @np: pointer to clock consumer node
> + * @list_name: name of the clock list property
> + * @index: index to the clock list
> + *
> + * This function parses the @list_name property and together with @index
> + * value indicating an entry of the list uses it to look up the struct clk
> + * from the registered list of clock providers.
> + */
> +struct clk *of_clk_get_list_entry(struct device_node *np,
> + const char *list_name, int index)
Bikeshed alert: how about of_clk_get_by_property or of_clk_get_by_prop?
No strong opinion on the topic though.
Regards,
Mike
> {
> struct of_phandle_args clkspec;
> struct clk *clk;
> int rc;
>
> - if (index < 0)
> + if (index < 0 || !list_name)
> return ERR_PTR(-EINVAL);
>
> - rc = of_parse_phandle_with_args(np, "clocks", "#clock-cells", index,
> - &clkspec);
> + rc = of_parse_phandle_with_args(np, list_name, "#clock-cells",
> + index, &clkspec);
> if (rc)
> return ERR_PTR(rc);
>
> @@ -51,6 +62,12 @@ struct clk *of_clk_get(struct device_node *np, int index)
> of_node_put(clkspec.np);
> return clk;
> }
> +EXPORT_SYMBOL(of_clk_get_list_entry);
> +
> +struct clk *of_clk_get(struct device_node *np, int index)
> +{
> + return of_clk_get_list_entry(np, "clocks", index);
> +}
> EXPORT_SYMBOL(of_clk_get);
>
> /**
> --
> 1.7.9.5
>
WARNING: multiple messages have this Message-ID (diff)
From: Mike Turquette <mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org,
galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
sw0312.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
Sylwester Nawrocki
<s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Subject: Re: [PATCH RFC v1 1/3] clk: Add function to parse an arbitrary clocks list property
Date: Sun, 23 Feb 2014 16:43:35 -0800 [thread overview]
Message-ID: <20140224004335.22529.74369@quantum> (raw)
In-Reply-To: <1392829124-25705-2-git-send-email-s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Quoting Sylwester Nawrocki (2014-02-19 08:58:42)
> The of_clk_get_list_entry() function is like of_clk_get() except it allows
> to pass name of a DT property containing list of phandles and clock specifiers.
> For of_clk_get() it has been hard coded to "clocks".
>
> Signed-off-by: Sylwester Nawrocki <s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> Acked-by: Kyungmin Park <kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
> drivers/clk/clk.h | 3 +++
> drivers/clk/clkdev.c | 25 +++++++++++++++++++++----
> 2 files changed, 24 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/clk/clk.h b/drivers/clk/clk.h
> index 795cc9f..dd9def1 100644
> --- a/drivers/clk/clk.h
> +++ b/drivers/clk/clk.h
> @@ -10,7 +10,10 @@
> */
>
> #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
> +
> struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec);
> void of_clk_lock(void);
> void of_clk_unlock(void);
> +struct clk *of_clk_get_list_entry(struct device_node *np,
> + const char *list_name, int index);
> #endif
> diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
> index a360b2e..465662e 100644
> --- a/drivers/clk/clkdev.c
> +++ b/drivers/clk/clkdev.c
> @@ -27,17 +27,28 @@ static LIST_HEAD(clocks);
> static DEFINE_MUTEX(clocks_mutex);
>
> #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
> -struct clk *of_clk_get(struct device_node *np, int index)
> +/**
> + * of_clk_get_list_entry() - Parse and lookup a clock referenced by a device node
> + * @np: pointer to clock consumer node
> + * @list_name: name of the clock list property
> + * @index: index to the clock list
> + *
> + * This function parses the @list_name property and together with @index
> + * value indicating an entry of the list uses it to look up the struct clk
> + * from the registered list of clock providers.
> + */
> +struct clk *of_clk_get_list_entry(struct device_node *np,
> + const char *list_name, int index)
Bikeshed alert: how about of_clk_get_by_property or of_clk_get_by_prop?
No strong opinion on the topic though.
Regards,
Mike
> {
> struct of_phandle_args clkspec;
> struct clk *clk;
> int rc;
>
> - if (index < 0)
> + if (index < 0 || !list_name)
> return ERR_PTR(-EINVAL);
>
> - rc = of_parse_phandle_with_args(np, "clocks", "#clock-cells", index,
> - &clkspec);
> + rc = of_parse_phandle_with_args(np, list_name, "#clock-cells",
> + index, &clkspec);
> if (rc)
> return ERR_PTR(rc);
>
> @@ -51,6 +62,12 @@ struct clk *of_clk_get(struct device_node *np, int index)
> of_node_put(clkspec.np);
> return clk;
> }
> +EXPORT_SYMBOL(of_clk_get_list_entry);
> +
> +struct clk *of_clk_get(struct device_node *np, int index)
> +{
> + return of_clk_get_list_entry(np, "clocks", index);
> +}
> EXPORT_SYMBOL(of_clk_get);
>
> /**
> --
> 1.7.9.5
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-02-24 0:43 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-19 16:58 [PATCH RFC v1 0/3] clk: Support for DT assigned clk parent and rate Sylwester Nawrocki
2014-02-19 16:58 ` Sylwester Nawrocki
[not found] ` < 1392829124-25705-4-git-send-email-s.nawrocki@samsung.com>
2014-02-19 16:58 ` [PATCH RFC v1 1/3] clk: Add function to parse an arbitrary clocks list property Sylwester Nawrocki
2014-02-19 16:58 ` Sylwester Nawrocki
2014-02-24 0:43 ` Mike Turquette [this message]
2014-02-24 0:43 ` Mike Turquette
2014-02-24 10:43 ` Sylwester Nawrocki
2014-02-24 10:43 ` Sylwester Nawrocki
2014-02-19 16:58 ` [PATCH RFC v1 2/3] of: Add definition of maximum length of a property name Sylwester Nawrocki
2014-02-19 16:58 ` Sylwester Nawrocki
2014-02-19 21:42 ` Rob Herring
2014-02-19 21:42 ` Rob Herring
2014-02-20 15:02 ` Sylwester Nawrocki
2014-02-20 15:02 ` Sylwester Nawrocki
2014-02-19 16:58 ` [PATCH RFC v1 3/3] clk: Add handling of clk parent and rate assigned from DT Sylwester Nawrocki
2014-02-19 16:58 ` Sylwester Nawrocki
2014-02-20 14:09 ` Grant Likely
2014-02-20 14:09 ` Grant Likely
2014-02-21 10:38 ` Sylwester Nawrocki
2014-02-21 10:38 ` Sylwester Nawrocki
2014-02-24 0:48 ` Mike Turquette
2014-02-24 0:48 ` Mike Turquette
2014-02-24 18:11 ` Sylwester Nawrocki
2014-02-24 18:11 ` Sylwester Nawrocki
2014-03-01 21:13 ` Grant Likely
2014-03-01 21:13 ` Grant Likely
2014-03-01 21:11 ` Grant Likely
2014-03-01 21:11 ` Grant Likely
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=20140224004335.22529.74369@quantum \
--to=mturquette@linaro.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.