From: Dinh Nguyen <dinguyen@kernel.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Vinod Koul <vkoul@kernel.org>,
dmaengine@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>
Subject: Re: [PATCH 2/2] dmagengine: pl330: add code to get reset property
Date: Mon, 10 Jun 2019 18:40:52 -0500 [thread overview]
Message-ID: <cf47b2d3-129c-fd1a-2d0a-0b662d86cc1d@kernel.org> (raw)
In-Reply-To: <CAMuHMdWktznAYLTp5t6PJy2+qcbs-5SHy4zCLUXYjRS3DqUZnw@mail.gmail.com>
Hi Geert,
On 6/7/19 2:37 AM, Geert Uytterhoeven wrote:
> Hi Dinh,
>
> On Wed, Jun 5, 2019 at 5:31 PM Dinh Nguyen <dinguyen@kernel.org> wrote:
>> On 6/5/19 9:41 AM, Dinh Nguyen wrote:
>>> On 6/4/19 11:31 AM, Geert Uytterhoeven wrote:
>>>> On Tue, Jun 4, 2019 at 4:21 PM Dinh Nguyen <dinguyen@kernel.org> wrote:
>>>>> On 6/4/19 7:14 AM, Vinod Koul wrote:
>>>>>> On 23-05-19, 19:28, Dinh Nguyen wrote:
>>>>>>> The DMA controller on some SoCs can be held in reset, and thus requires
>>>>>>> the reset signal(s) to deasserted. Most SoCs will have just one reset
>>>>>>> signal, but there are others, i.e. Arria10/Stratix10 will have an
>>>>>>> additional reset signal, referred to as the OCP.
>>>>>>>
>>>>>>> Add code to get the reset property from the device tree for deassert and
>>>>>>> assert.
>>>>>>>
>>>>>>> Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
>
>>>>>>> --- a/drivers/dma/pl330.c
>>>>>>> +++ b/drivers/dma/pl330.c
>
>>>>>>> @@ -3028,6 +3032,30 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
>>>>>>>
>>>>>>> amba_set_drvdata(adev, pl330);
>>>>>>>
>>>>>>> + pl330->rstc = devm_reset_control_get_optional(&adev->dev, "dma");
>>>>>>> + if (IS_ERR(pl330->rstc)) {
>>>>>>> + dev_err(&adev->dev, "No reset controller specified.\n");
>
> "No reset controller specified.\n"
>
>>>>>>
>>>>>> Wasnt this optional??
>>>>>
>>>>> Yes, this is optional. The call devm_reset_control_get_optional() will
>>>>> just return NULL if the reset property is not there, but an error
>>>>> pointer if something really went wrong. Thus, I'm using IS_ERR() for the
>>>>> error checking.
>>>>
>>>> So the error message is incorrect, as this is a real error condition?
>>>
>>> Yes, you're right! Will correct in V2.
>>
>> Looking at this again, I think the error message is correct. The
>> optional call will return NULL if the resets property is not specified,
>> and will return an error pointer if the reset propert is specified, but
>> the pointer to the reset controller is not found.
>>
>> So I think the error message is correct.
>
> Please reread the error message, and what you wrote above.
>
> Error message: "No reset controller specified".
> Rationale: NULL (i.e. no error) if "the resets property is not specified".
>
> If an error pointer is returned, this may be due to probe deferral (to be
> propagated, but further ignored), or due to a real failure.
>
> So IMHO the code should read:
>
> if (IS_ERR(pl330->rstc)) {
> if (PTR_ERR(pl330->rstc) != -EPROBE_DEFER)
> dev_err(&adev->dev, "Failed to get reset.\n");
> return PTR_ERR(pl330->rstc);
> } else { ... }
>
You're right! Will update in v2.
Thanks!
Dinh
prev parent reply other threads:[~2019-06-10 23:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-24 0:28 [PATCH 1/2] dt-bindings: pl330: document the optional resets property Dinh Nguyen
2019-05-24 0:28 ` [PATCH 2/2] dmagengine: pl330: add code to get reset property Dinh Nguyen
2019-06-04 12:14 ` Vinod Koul
2019-06-04 14:21 ` Dinh Nguyen
2019-06-04 16:31 ` Geert Uytterhoeven
2019-06-05 14:41 ` Dinh Nguyen
2019-06-05 15:31 ` Dinh Nguyen
2019-06-07 7:37 ` Geert Uytterhoeven
2019-06-10 23:40 ` 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=cf47b2d3-129c-fd1a-2d0a-0b662d86cc1d@kernel.org \
--to=dinguyen@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=geert@linux-m68k.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=vkoul@kernel.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;
as well as URLs for NNTP newsgroup(s).