linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: p.zabel@pengutronix.de (Philipp Zabel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V3 01/19] reset: add of_reset_control_get_by_index()
Date: Fri, 17 Jul 2015 14:08:58 +0200	[thread overview]
Message-ID: <1437134938.3254.3.camel@pengutronix.de> (raw)
In-Reply-To: <1436791197-32358-2-git-send-email-jonathanh@nvidia.com>

Am Montag, den 13.07.2015, 13:39 +0100 schrieb Jon Hunter:
> From: Vince Hsu <vinceh@nvidia.com>
> 
> Add of_reset_control_get_by_index() to allow the drivers to get reset
> device without knowing its name.
> 
> Signed-off-by: Vince Hsu <vinceh@nvidia.com>
> [jonathanh at nvidia.com: Updated stub function to return -ENOTSUPP instead
>  of -ENOSYS which should only be used for system calls.]
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>

Acked-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp

> ---
> v3: addressed comments from Philipp
> v2: minor changes according to Alex's comments
> ---
>  drivers/reset/core.c  | 40 +++++++++++++++++++++++++++++-----------
>  include/linux/reset.h |  9 +++++++++
>  2 files changed, 38 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/reset/core.c b/drivers/reset/core.c
> index 7955e00d04d4..81ae17d15480 100644
> --- a/drivers/reset/core.c
> +++ b/drivers/reset/core.c
> @@ -141,27 +141,24 @@ int reset_control_status(struct reset_control *rstc)
>  EXPORT_SYMBOL_GPL(reset_control_status);
>  
>  /**
> - * of_reset_control_get - Lookup and obtain a reference to a reset controller.
> + * of_reset_control_get_by_index - Lookup and obtain a reference to a reset
> + * controller by index.
>   * @node: device to be reset by the controller
> - * @id: reset line name
> - *
> - * Returns a struct reset_control or IS_ERR() condition containing errno.
> + * @index: index of the reset controller
>   *
> - * Use of id names is optional.
> + * This is to be used to perform a list of resets for a device or power domain
> + * in whatever order. Returns a struct reset_control or IS_ERR() condition
> + * containing errno.
>   */
> -struct reset_control *of_reset_control_get(struct device_node *node,
> -					   const char *id)
> +struct reset_control *of_reset_control_get_by_index(struct device_node *node,
> +					   int index)
>  {
>  	struct reset_control *rstc = ERR_PTR(-EPROBE_DEFER);
>  	struct reset_controller_dev *r, *rcdev;
>  	struct of_phandle_args args;
> -	int index = 0;
>  	int rstc_id;
>  	int ret;
>  
> -	if (id)
> -		index = of_property_match_string(node,
> -						 "reset-names", id);
>  	ret = of_parse_phandle_with_args(node, "resets", "#reset-cells",
>  					 index, &args);
>  	if (ret)
> @@ -202,6 +199,27 @@ struct reset_control *of_reset_control_get(struct device_node *node,
>  
>  	return rstc;
>  }
> +EXPORT_SYMBOL_GPL(of_reset_control_get_by_index);
> +
> +/**
> + * of_reset_control_get - Lookup and obtain a reference to a reset controller.
> + * @node: device to be reset by the controller
> + * @id: reset line name
> + *
> + * Returns a struct reset_control or IS_ERR() condition containing errno.
> + *
> + * Use of id names is optional.
> + */
> +struct reset_control *of_reset_control_get(struct device_node *node,
> +					   const char *id)
> +{
> +	int index = 0;
> +
> +	if (id)
> +		index = of_property_match_string(node,
> +						 "reset-names", id);
> +	return of_reset_control_get_by_index(node, index);
> +}
>  EXPORT_SYMBOL_GPL(of_reset_control_get);
>  
>  /**
> diff --git a/include/linux/reset.h b/include/linux/reset.h
> index da5602bd77d7..26f1b53386d8 100644
> --- a/include/linux/reset.h
> +++ b/include/linux/reset.h
> @@ -38,6 +38,9 @@ static inline struct reset_control *devm_reset_control_get_optional(
>  struct reset_control *of_reset_control_get(struct device_node *node,
>  					   const char *id);
>  
> +struct reset_control *of_reset_control_get_by_index(
> +					struct device_node *node, int index);
> +
>  #else
>  
>  static inline int reset_control_reset(struct reset_control *rstc)
> @@ -92,6 +95,12 @@ static inline struct reset_control *of_reset_control_get(
>  	return ERR_PTR(-ENOSYS);
>  }
>  
> +static inline struct reset_control *of_reset_control_get_by_index(
> +				struct device_node *node, int index)
> +{
> +	return ERR_PTR(-ENOTSUPP);
> +}
> +
>  #endif /* CONFIG_RESET_CONTROLLER */
>  
>  #endif

  reply	other threads:[~2015-07-17 12:08 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13 12:39 [PATCH V3 00/19] Add generic PM domain support for Tegra SoCs Jon Hunter
2015-07-13 12:39 ` [PATCH V3 01/19] reset: add of_reset_control_get_by_index() Jon Hunter
2015-07-17 12:08   ` Philipp Zabel [this message]
2015-07-13 12:39 ` [PATCH V3 02/19] memory: tegra: Add MC flush support Jon Hunter
2015-07-17  9:57   ` Thierry Reding
2015-07-17 10:20     ` Peter De Schrijver
2015-07-17 11:31       ` Thierry Reding
2015-07-20  8:46         ` Jon Hunter
2015-07-20  9:17           ` Thierry Reding
2015-07-20  9:59         ` Peter De Schrijver
2015-07-20 13:14           ` Thierry Reding
2015-07-21 10:57             ` Peter De Schrijver
2015-07-13 12:39 ` [PATCH V3 03/19] memory: tegra: add flush operation for Tegra30 memory clients Jon Hunter
2015-07-17 10:03   ` Thierry Reding
2015-07-21  8:54     ` Jon Hunter
2015-07-13 12:39 ` [PATCH V3 04/19] memory: tegra: add flush operation for Tegra114 " Jon Hunter
2015-07-17 10:05   ` Thierry Reding
2015-07-13 12:39 ` [PATCH V3 05/19] memory: tegra: add flush operation for Tegra124 " Jon Hunter
2015-07-17 10:05   ` Thierry Reding
2015-07-13 12:39 ` [PATCH V3 06/19] clk: tegra: remove TEGRA_PLL_USE_LOCK for PLLD/PLLD2 Jon Hunter
2015-07-13 13:41   ` Peter De Schrijver
2015-07-13 14:02     ` Jon Hunter
2015-07-14 11:59       ` Jon Hunter
2015-07-15  8:16         ` Peter De Schrijver
2015-07-13 12:39 ` [PATCH V3 07/19] soc: tegra: pmc: Wait for powergate state to change Jon Hunter
2015-07-17 10:17   ` Thierry Reding
2015-07-21  9:34     ` Jon Hunter
2015-07-13 12:39 ` [PATCH V3 08/19] soc: tegra: pmc: Clean-up PMC helper functions Jon Hunter
2015-07-17 10:25   ` Thierry Reding
2015-07-21  9:38     ` Jon Hunter
2015-07-13 12:39 ` [PATCH V3 09/19] soc: tegra: pmc: Prepare for migrating to generic PM domains Jon Hunter
2015-07-13 12:39 ` [PATCH V3 10/19] drm/tegra: dc: Prepare for " Jon Hunter
2015-07-17 10:41   ` Thierry Reding
2015-07-28  8:30     ` Jon Hunter
2015-07-28 11:20       ` Thierry Reding
2015-07-28 15:30         ` Jon Hunter
2015-07-13 12:39 ` [PATCH V3 11/19] PCI: tegra: Add support " Jon Hunter
2015-07-17 10:45   ` Thierry Reding
2015-07-28  8:35     ` Jon Hunter
2015-07-13 12:39 ` [PATCH V3 12/19] ata: ahci_tegra: " Jon Hunter
2015-07-13 12:39 ` [PATCH V3 13/19] drm/tegra: gr3d: " Jon Hunter
2015-07-13 12:39 ` [PATCH V3 14/19] Documentation: DT: bindings: Add power domain info for NVIDIA PMC Jon Hunter
2015-07-17  9:38   ` Thierry Reding
2015-07-13 12:39 ` [PATCH V3 15/19] soc: tegra: pmc: Add generic PM domain support Jon Hunter
2015-07-17 11:29   ` Thierry Reding
2015-07-13 12:39 ` [PATCH V3 16/19] soc: tegra: pmc: Remove the deprecated powergate APIs Jon Hunter
2015-07-13 12:39 ` [PATCH V3 17/19] ARM: tegra: Add PM domain device nodes to Tegra124 DT Jon Hunter
2015-07-13 12:39 ` [PATCH V3 18/19] ARM: tegra: add GPU power supply to Jetson TK1 DT Jon Hunter
2015-07-17  9:28   ` Thierry Reding
2015-07-13 12:39 ` [PATCH V3 19/19] ARM: tegra: select PM_GENERIC_DOMAINS Jon Hunter
2015-07-13 13:50   ` Peter De Schrijver
2015-07-13 14:03     ` Jon Hunter
2015-07-14 11:59       ` Jon Hunter
2015-07-15  8:17         ` Peter De Schrijver

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=1437134938.3254.3.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --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 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).