mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Philipp Zabel <p.zabel@pengutronix.de>, linux-kernel@vger.kernel.org
Subject: Re: [RFC] reset: add reset_control_bulk API
Date: Tue, 9 Mar 2021 20:05:00 +0300	[thread overview]
Message-ID: <b1704d04-14bf-9950-5bae-d97e357d6832@gmail.com> (raw)
In-Reply-To: <20210303121000.26072-1-p.zabel@pengutronix.de>

03.03.2021 15:10, Philipp Zabel пишет:
> Follow the clock and regulator subsystems' lead and add a bulk API
> for reset controls.
> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---

Hello Philipp,

The patch is almost okay to me. I'll fix the minor issues and include it
in the next version of the Tegra audio patches. Thanks!

> +/**
> + * reset_control_bulk_deassert - asserts the reset lines in order

I'll correct this comment

> + * @num_rstcs: number of entries in rstcs array
> + * @rstcs: array of struct reset_control_bulk_data with reset controls set
> + *
> + * Deassert the reset lines for all provided reset controls, in order.
> + * If a deassertion fails, already deasserted resets are asserted again.
> + *
> + * See also: reset_control_assert()
> + */
> +int reset_control_bulk_deassert(int num_rstcs,
> +				struct reset_control_bulk_data *rstcs)
> +{
> +	int ret, i;
> +
> +	for (i = 0; i < num_rstcs; i++) {
> +		ret = reset_control_deassert(rstcs[i].rstc);
> +		if (ret)
> +			goto err;
> +	}
> +
> +	return 0;
> +
> +err:
> +	while (i--)
> +		reset_control_assert(rstcs[i].rstc);
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(reset_control_bulk_deassert);

and change the bulk_deassert to use the reverse order

...
> +int __reset_control_bulk_get(struct device *dev, int num_rstcs,
> +			     struct reset_control_bulk_data *rstcs,
> +			     bool shared, bool optional, bool acquired)
> +{
> +	int i, ret;
> +
> +	for (i = 0; i < num_rstcs; i++) {
> +		rstcs[i].rstc = __reset_control_get(dev, rstcs[i].id, 0,
> +						    shared, optional, acquired);
> +		if (IS_ERR(rstcs[i].rstc)) {
> +			ret = PTR_ERR(rstcs[i].rstc);
> +			goto err;
> +		}
> +	}
> +

and add the missing "return 0" here.

> +err:
> +	mutex_lock(&reset_list_mutex);
> +	while (i--)
> +		__reset_control_put_internal(rstcs[i].rstc);
> +	mutex_unlock(&reset_list_mutex);
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(__reset_control_bulk_get);
...


      reply	other threads:[~2021-03-09 17:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03 12:10 Philipp Zabel
2021-03-09 17:05 ` Dmitry Osipenko [this message]

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=b1704d04-14bf-9950-5bae-d97e357d6832@gmail.com \
    --to=digetx@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    /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®