From: Dinh Nguyen <dinguyen@kernel.org>
To: Philipp Zabel <p.zabel@pengutronix.de>,
Linus Walleij <linus.walleij@linaro.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>, Rob Herring <robh@kernel.org>,
Russell King <linux@armlinux.org.uk>,
Frank Rowand <frowand.list@gmail.com>,
Kees Cook <keescook@chromium.org>,
Anton Vorontsov <anton@enomsg.org>,
Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>,
Daniel Thompson <daniel.thompson@linaro.org>,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [RESEND PATCHv4 1/1] drivers/amba: add reset control to amba bus probe
Date: Mon, 26 Aug 2019 10:27:14 -0500 [thread overview]
Message-ID: <c080d163-720c-7a15-857a-fc619eb8d048@kernel.org> (raw)
In-Reply-To: <1566809829.3842.4.camel@pengutronix.de>
Hi Philipp,
On 8/26/19 3:57 AM, Philipp Zabel wrote:
> Hi Dinh, Linus,
>
> On Fri, 2019-08-23 at 10:42 -0500, Dinh Nguyen wrote:
>>
>> On 8/23/19 4:19 AM, Linus Walleij wrote:
>>> On Tue, Aug 20, 2019 at 4:58 PM Dinh Nguyen <dinguyen@kernel.org> wrote:
>>>
>>>> @@ -401,6 +402,26 @@ static int amba_device_try_add(struct amba_device *dev, struct resource *parent)
>>>> ret = amba_get_enable_pclk(dev);
>>>> if (ret == 0) {
>>>> u32 pid, cid;
>>>> + int count;
>>>> + struct reset_control *rstc;
>>>> +
>>>> + /*
>>>> + * Find reset control(s) of the amba bus and de-assert them.
>>>> + */
>>>> + count = reset_control_get_count(&dev->dev);
>
> The reset_control_get_count() inline stub returns -ENOENT, so the
> compiler can throw away the complete loop.
>
>>>> + while (count > 0) {
>>>> + rstc = of_reset_control_get_shared_by_index(dev->dev.of_node, count - 1);
>
> Since resets are looked up with of_reset_control_get, I'd use
> of_reset_control_get_count() above for consistency. But see below:
>
reset_control_get_count() ultimately calls of_reset_control_get_count()
and it looks like of_reset_control_get_count() is not exported.
>>>> + if (IS_ERR(rstc)) {
>>>> + if (PTR_ERR(rstc) == -EPROBE_DEFER)
>>>> + ret = -EPROBE_DEFER;
>>>> + else
>>>> + dev_err(&dev->dev, "Can't get amba reset!\n");
>>>> + break;
>>>> + }
>>>> + reset_control_deassert(rstc);
>>>> + reset_control_put(rstc);
>>>> + count--;
>>>> + }
>
> It looks like the order of deassertions is irrelevant. If so,
> You can use of_reset_control_array_get() to simplify this:
>
> + rstc = of_reset_control_array_get_optional_shared(dev->dev.of_node);
> + if (IS_ERR(rstc)) {
> + if (PTR_ERR(rstc) != -EPROBE_DEFER)
> + dev_err(&dev->dev, "Can't get amba reset!\n");
> + return PTR_ERR(rstc);
> + }
> + reset_control_deassert(rstc);
> + reset_control_put(rstc);
>
Thanks for the review! I'll post v5 shortly.
Dinh
prev parent reply other threads:[~2019-08-26 15:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-20 14:58 [RESEND PATCHv4 0/1] drivers/amba: add reset control to amba Dinh Nguyen
2019-08-20 14:58 ` [RESEND PATCHv4 1/1] drivers/amba: add reset control to amba bus probe Dinh Nguyen
2019-08-23 9:19 ` Linus Walleij
2019-08-23 15:42 ` Dinh Nguyen
2019-08-26 8:57 ` Philipp Zabel
2019-08-26 15:27 ` Dinh Nguyen [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=c080d163-720c-7a15-857a-fc619eb8d048@kernel.org \
--to=dinguyen@kernel.org \
--cc=anton@enomsg.org \
--cc=ccross@android.com \
--cc=daniel.thompson@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=keescook@chromium.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=manivannan.sadhasivam@linaro.org \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=tony.luck@intel.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;
as well as URLs for NNTP newsgroup(s).