public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Vivek Gautam <vivek.gautam@codeaurora.org>
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: Tue, 04 Apr 2017 14:47:49 +0200	[thread overview]
Message-ID: <1491310069.2996.17.camel@pengutronix.de> (raw)
In-Reply-To: <52efd58a-e4f2-d3a7-0145-4c2f60ef6dd6@codeaurora.org>

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.

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

regards
Philipp

  reply	other threads:[~2017-04-04 12:47 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 of resets Vivek Gautam
2017-04-03 13:41 ` [PATCH v2 1/4] reset: Add API to count number of reset available with device Vivek Gautam
     [not found]   ` <1491226922-20307-2-git-send-email-vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
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
     [not found]   ` <1491226922-20307-3-git-send-email-vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-04-03 16:36     ` Philipp Zabel
2017-04-04 10:39       ` Vivek Gautam
2017-04-04 12:47         ` Philipp Zabel [this message]
2017-04-05  6:50           ` Vivek Gautam
2017-04-04  4:12     ` kbuild test robot
2017-04-04  4:14     ` kbuild test robot
     [not found]       ` <201704041257.siy13sYK%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-04-04  4:23         ` Vivek Gautam
     [not found] ` <1491226922-20307-1-git-send-email-vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-04-03 13:42   ` [PATCH v2 3/4] usb: dwc3: of-simple: Add support to get resets for the device Vivek Gautam
     [not found]     ` <1491226922-20307-4-git-send-email-vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
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=1491310069.2996.17.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=balbi@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=swarren@wwwdotorg.org \
    --cc=thierry.reding@gmail.com \
    --cc=vivek.gautam@codeaurora.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