devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <b.zolnierkie-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
To: Sylwester Nawrocki <s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	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,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH RFC v3 1/2] clk: Add function parsing arbitrary clock list DT property
Date: Thu, 27 Mar 2014 18:17:27 +0100	[thread overview]
Message-ID: <3164460.aT5tTxdc17@amdc1032> (raw)
In-Reply-To: <1395922579-28547-2-git-send-email-s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>


Hi Sylwester,

On Thursday, March 27, 2014 01:16:18 PM Sylwester Nawrocki wrote:
> The of_clk_get_by_property() function added by this patch is similar to
> of_clk_get(), except it allows to pass name of a DT property containing
> list of phandles and clock specifiers. For of_clk_get() this has been
> hard coded to "clocks".
> 
> Signed-off-by: Sylwester Nawrocki <s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
> Changes since v2:
>  - moved the function declaration from drivers/clk/clk.h to
>    include/linux/clk.h
> 
> Changes since v1:
>  - s/of_clk_get_list_entry/of_clk_get_by_property.
> ---
>  drivers/clk/clkdev.c |   25 +++++++++++++++++++++----
>  include/linux/clk.h  |    7 +++++++
>  2 files changed, 28 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
> index a360b2e..1d41540 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_by_property() - 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_by_property(struct device_node *np,
> +				   const char *list_name, int index)
>  {
>  	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_by_property);
> +
> +struct clk *of_clk_get(struct device_node *np, int index)
> +{
> +	return of_clk_get_by_property(np, "clocks", index);
> +}
>  EXPORT_SYMBOL(of_clk_get);
>  
>  /**
> diff --git a/include/linux/clk.h b/include/linux/clk.h
> index 0dd9114..f71235b 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -383,6 +383,8 @@ struct of_phandle_args;
>  
>  #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
>  struct clk *of_clk_get(struct device_node *np, int index);
> +struct clk *of_clk_get_by_property(struct device_node *np,
> +				   const char *list_name, int index);
>  struct clk *of_clk_get_by_name(struct device_node *np, const char *name);
>  struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec);
>  #else
> @@ -395,6 +397,11 @@ static inline struct clk *of_clk_get_by_name(struct device_node *np,
>  {
>  	return ERR_PTR(-ENOENT);
>  }
> +struct clk *of_clk_get_by_property(struct device_node *np,

This causes build brake with s3c6400_defconfig
(it should be 'static inline').

> +				   const char *list_name, int index)
> +{
> +	return ERR_PTR(-ENOENT);
> +}
>  #endif
>  
>  #endif

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

--
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

  parent reply	other threads:[~2014-03-27 17:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27 12:16 [PATCH RFC v3 0/2] clk: Support for DT assigned clock parents and rates Sylwester Nawrocki
     [not found] ` <1395922579-28547-1-git-send-email-s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-03-27 12:16   ` [PATCH RFC v3 1/2] clk: Add function parsing arbitrary clock list DT property Sylwester Nawrocki
     [not found]     ` <1395922579-28547-2-git-send-email-s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-03-27 17:17       ` Bartlomiej Zolnierkiewicz [this message]
2014-03-27 18:02         ` Sylwester Nawrocki
2014-03-27 12:16   ` [PATCH RFC v3 2/2] clk: Add handling of clk parent and rate assigned from DT Sylwester Nawrocki
     [not found]     ` <1395922579-28547-3-git-send-email-s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-03-27 13:24       ` Laurent Pinchart
2014-03-27 13:57         ` Sylwester Nawrocki
     [not found]           ` <53342E64.5060505-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-03-27 14:08             ` Laurent Pinchart
2014-03-27 14:47               ` Sascha Hauer
     [not found]                 ` <20140327144712.GW17250-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-03-28 16:44                   ` Laurent Pinchart
2014-03-31  8:32                     ` Sascha Hauer
     [not found]                       ` <20140331083210.GX24917-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-04-01 13:36                         ` Laurent Pinchart
2014-03-27 15:02               ` Sylwester Nawrocki
     [not found]                 ` <53343D9C.6040605-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-03-28 16:49                   ` Laurent Pinchart
2014-03-31 11:40                     ` Sylwester Nawrocki
2014-03-27 17:19       ` Bartlomiej Zolnierkiewicz

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=3164460.aT5tTxdc17@amdc1032 \
    --to=b.zolnierkie-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=sw0312.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.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).