From: Vince Hsu <vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Alexandre Courbot <gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Thierry Reding
<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Peter De Schrijver
<pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [RFC PATCH 1/9] reset: add of_reset_control_get_by_index()
Date: Mon, 2 Mar 2015 16:52:53 +0800 [thread overview]
Message-ID: <54F424E5.6020606@nvidia.com> (raw)
In-Reply-To: <CAAVeFuJDfG7skRgyEt1p+NJ1x=s5rtfkL9JV1DR_Df0E=CGjuA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Hi,
On 02/12/2015 04:56 PM, Alexandre Courbot wrote:
> On Wed, Jan 14, 2015 at 3:19 PM, Vince Hsu<vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote:
>> Add of_reset_control_get_by_index() to allow the dirvers to get reset device
> s/dirvers/drivers
>
>> without knowing its name.
>>
>> Signed-off-by: Vince Hsu<vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>> ---
>> drivers/reset/core.c | 47 ++++++++++++++++++++++++++++++++---------------
>> include/linux/reset.h | 9 +++++++++
>> 2 files changed, 41 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/reset/core.c b/drivers/reset/core.c
>> index 7955e00d04d4..25a0da1654f8 100644
>> --- a/drivers/reset/core.c
>> +++ b/drivers/reset/core.c
>> @@ -140,28 +140,15 @@ 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.
>> - * @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)
>> +struct reset_control *__of_reset_control_get(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 +189,36 @@ struct reset_control *of_reset_control_get(struct device_node *node,
>>
>> return rstc;
>> }
>> +
>> +struct reset_control *of_reset_control_get_by_index(struct device_node *node,
>> + int index)
>> +{
>> + if (!node)
>> + return ERR_PTR(-EINVAL);
> Here you are checking node...
Will drop the check here. It's not needed actually.
>> +
>> + return __of_reset_control_get(node, index);
>> +}
>> +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(node, index);
> ... but not here?
>
>> +}
>> EXPORT_SYMBOL_GPL(of_reset_control_get);
>>
>> /**
>> diff --git a/include/linux/reset.h b/include/linux/reset.h
>> index da5602bd77d7..f29fc88c4868 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);
>> }
>>
>> +struct reset_control *of_reset_control_get_by_index(
>> + struct device_node *node, int index)
> Seems like the node argument would fit on the previous line.
Indeed.
Thanks,
Vince
next prev parent reply other threads:[~2015-03-02 8:52 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-14 6:19 [RFC PATCH 0/9] Add generic PM domain support for Tegra SoC Vince Hsu
[not found] ` <1421216372-8025-1-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-01-14 6:19 ` [RFC PATCH 1/9] reset: add of_reset_control_get_by_index() Vince Hsu
[not found] ` <1421216372-8025-2-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-02-12 8:56 ` Alexandre Courbot
[not found] ` <CAAVeFuJDfG7skRgyEt1p+NJ1x=s5rtfkL9JV1DR_Df0E=CGjuA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-02 8:52 ` Vince Hsu [this message]
2015-01-14 6:19 ` [RFC PATCH 2/9] memory: tegra: add mc flush support Vince Hsu
[not found] ` <1421216372-8025-3-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-02-12 8:56 ` Alexandre Courbot
[not found] ` <CAAVeFuLx5fr_kQonRZzTgsw-wND==jNwvMs9LkzhWrE0rRQ76w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-02 8:54 ` Vince Hsu
[not found] ` <54F42549.5040202-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-03-02 9:29 ` Alexandre Courbot
[not found] ` <CAAVeFu+1dS-RXOEg0jmUcP907uErpOv687k=4FBJiGfKytMWPA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-02 11:09 ` Vince Hsu
2015-03-03 8:03 ` Alexandre Courbot
[not found] ` <CAAVeFuJqa-4DqM8W2yXLUS9brfE8VgxT03FEQLSoKh26EddE8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-03 8:09 ` Vince Hsu
[not found] ` <54F56C26.1020202-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-03-03 8:14 ` Alexandre Courbot
[not found] ` <CAAVeFuLfJJz92PdkjO1je-Hwz5smbzFKZ9=EipQ0qJTod1Xp2A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-03 8:18 ` Vince Hsu
[not found] ` <54F56E4E.9070004-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-03-03 8:31 ` Alexandre Courbot
[not found] ` <CAAVeFuK1ZSdBLc5p0xQkcOeGBB2MNtT+k0wg45MdO5bO=YgnnQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-03 8:59 ` Vince Hsu
2015-01-14 6:19 ` [RFC PATCH 3/9] memory: tegra: add flush operation for Tegra124 memory clients Vince Hsu
[not found] ` <1421216372-8025-4-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-02-12 8:56 ` Alexandre Courbot
[not found] ` <CAAVeFuLgT+PPUGR68BE=ac97FyjfmtTHCZqvMoHAwNV8x8KP6w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-02 8:54 ` Vince Hsu
[not found] ` <54F42559.7060901-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-03-02 9:06 ` Alexandre Courbot
2015-01-14 6:19 ` [RFC PATCH 4/9] soc: tegra: pmc: Add generic PM domain support Vince Hsu
[not found] ` <1421216372-8025-5-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-02-12 8:56 ` Alexandre Courbot
[not found] ` <CAAVeFuKAk44_ohL=0Qb47wwK5-8rxjvxExjQbfrshjc1J_zZug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-02 8:55 ` Vince Hsu
2015-01-14 6:19 ` [RFC PATCH 5/9] ARM: tegra: add PM domain device nodes to Tegra124 DT Vince Hsu
2015-01-14 6:19 ` [RFC PATCH 6/9] ARM: tegra: add GPU power supply to Jetson TK1 DT Vince Hsu
2015-01-14 6:19 ` [RFC PATCH 7/9] drm/tegra: dc: remove the power sequence from driver Vince Hsu
2015-01-14 6:19 ` [RFC PATCH 8/9] PCI: tegra: " Vince Hsu
2015-01-14 6:19 ` [RFC PATCH 9/9] ata: ahci_tegra: remove " Vince Hsu
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=54F424E5.6020606@nvidia.com \
--to=vinceh-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
--cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@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 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.