From: Vivek Gautam <vivek.gautam@codeaurora.org>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-usb@vger.kernel.org, swarren@wwwdotorg.org,
thierry.reding@gmail.com, balbi@kernel.org
Subject: Re: [PATCH v2 2/4] reset: Add APIs to manage array of resets
Date: Wed, 5 Apr 2017 12:20:53 +0530 [thread overview]
Message-ID: <7ecfd2bf-812b-f4c2-0b33-c992333b039c@codeaurora.org> (raw)
In-Reply-To: <1491310069.2996.17.camel@pengutronix.de>
Hi Philipp,
On 04/04/2017 06:17 PM, Philipp Zabel wrote:
> Hi Vivek,
>
> On Tue, 2017-04-04 at 16:09 +0530, Vivek Gautam wrote:
> [...]
>>> I'd prefer to mirror the gpiod API a little, and to have the number
>>> contained in the array structure, similar to struct gpio_descs:
> [...]
>> Alright, i can update this.
>> I took regulator_bulk interface as the reference, but now i see
>> gpio_descs has a smaller footprint.
> Ok, understood.
> I think the smaller footprint API is more convenient for the user.
>
> [...]
>>>> + * Returns 0 on success or error number on failure
>>>> + */
>>>> +static int reset_control_array_get(struct device *dev, int num_rsts,
>>>> + struct reset_control_array *resets,
>>>> + bool shared, bool optional)
>>> Can we make this count and return a pointer to the newly created array?
>>>
>>> static struct reset_controls *
>>> reset_control_array_get(struct device *dev, bool shared, bool optional)
>>> {
>>> ...
>>>
>>> That way the consumer doesn't have to care about counting and array
>>> allocation.
>> Just trying to think again in line with the regulator bulk APIs.
>> Can't a user provide a list of reset controls as data and thus
>> request reset controls with a "id" and num_resets available.
>>
>> e.g.
>> const char * const rst_names[] = {
>> "rst1", "rst2" ...
>> };
>> xyz_data = {
>> .resets = rst_names;
>> .num = ARRAY_SIZE(rst_names);
>> };
>> and then the driver making use of reset_control_array APIs
>> to request this list of reset controls and assert/deassert them.
>>
>> I am assuming this case when one user driver is used across a bunch
>> of platforms with different number of resets available.
>> We may not want to rely solely on the device tree entries, since
>> the resets can be mandatory in few cases and we may want to
>> return failure.
> The way I understood the array API was as a method of handling a list of
> anonymous resets, specified as
>
> resets = <&reset 1>, <&reset 2>, <&reset 3>;
> // reset-names = "rst1", "rst2", "rst3"; /* don't care */
>
> in the device tree.
>
> Now if you want to handle a partial list of those as an unordered list,
> with special consideration for others, that could be added as a separate
> API when there is use for it. But I expect that most potential users of
> this array API will not have to make such a distinction.
Alright, I will modify the array APIs as suggested to handle an
unordered list of resets passed from the device tree.
As you said, we can handle the special cases when the need arise.
>
>>>> @@ -85,6 +107,39 @@ static inline struct reset_control *__devm_reset_control_get(
>>>> return -ENOTSUPP;
>>>> }
>>>>
>>>> +static inline int reset_control_array_assert(int num_rsts,
>>>> + struct reset_control_array *resets)
>>>> +{
>>>> + return 0;
>>>> +}
>>>> +
>>>> +static inline int reset_control_array_deassert(int num_rsts,
>>>> + struct reset_control_array *resets)
>>>> +{
>>>> + return 0;
>>>> +}
>>> Is this missing a stub for reset_control_array_get?
>> No, that's supposed to be a static function.
> Oh right, it is static. Please ignore.
Thanks
> regards
> Philipp
>
Best Regards
Vivek
--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2017-04-05 6:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-03 13:41 [PATCH v2 0/4] reset: APIs to manage a list " Vivek Gautam
2017-04-03 13:41 ` [PATCH v2 1/4] reset: Add API to count number of reset available with device Vivek Gautam
2017-04-04 4:22 ` kbuild test robot
2017-04-03 13:42 ` [PATCH v2 2/4] reset: Add APIs to manage array of resets Vivek Gautam
2017-04-03 16:36 ` Philipp Zabel
2017-04-04 10:39 ` Vivek Gautam
2017-04-04 12:47 ` Philipp Zabel
2017-04-05 6:50 ` Vivek Gautam [this message]
2017-04-04 4:12 ` kbuild test robot
2017-04-04 4:14 ` kbuild test robot
2017-04-04 4:23 ` Vivek Gautam
2017-04-03 13:42 ` [PATCH v2 3/4] usb: dwc3: of-simple: Add support to get resets for the device Vivek Gautam
2017-04-04 5:20 ` [PATCH] usb: dwc3: of-simple: fix noderef.cocci warnings kbuild test robot
2017-04-04 5:20 ` [PATCH v2 3/4] usb: dwc3: of-simple: Add support to get resets for the device kbuild test robot
2017-04-04 5:34 ` kbuild test robot
2017-04-03 13:42 ` [PATCH v2 4/4] soc/tegra: pmc: Use the new reset APIs to manage reset controllers Vivek Gautam
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=7ecfd2bf-812b-f4c2-0b33-c992333b039c@codeaurora.org \
--to=vivek.gautam@codeaurora.org \
--cc=balbi@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=swarren@wwwdotorg.org \
--cc=thierry.reding@gmail.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
all inboxes | Powered by JetHome®