From: Dmitry Osipenko <digetx@gmail.com>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Thierry Reding <treding@nvidia.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Mathias Nyman <mathias.nyman@intel.com>,
JC Kuo <jckuo@nvidia.com>, Nicolas Chauvet <kwizart@gmail.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-tegra@vger.kernel.org
Subject: Re: [PATCH v1] usb: xhci: tegra: Check padctrl interrupt presence in device tree
Date: Fri, 22 Oct 2021 12:35:37 +0300 [thread overview]
Message-ID: <2e40f008-7a46-e6ec-a2d5-a5e6501bff78@gmail.com> (raw)
In-Reply-To: <YXKEZyweVxvNyl8K@qmqm.qmqm.pl>
22.10.2021 12:29, Michał Mirosław пишет:
> On Fri, Oct 22, 2021 at 08:58:02AM +0300, Dmitry Osipenko wrote:
>> 22.10.2021 01:14, Michał Mirosław пишет:
>>> On Fri, Oct 22, 2021 at 12:46:23AM +0300, Dmitry Osipenko wrote:
>>>> 22.10.2021 00:37, Michał Mirosław пишет:
>>>>> On Thu, Oct 21, 2021 at 02:55:01PM +0300, Dmitry Osipenko wrote:
>>>>>> Older device-trees don't specify padctrl interrupt and xhci-tegra driver
>>>>>> now fails to probe with -EINVAL using those device-trees. Check interrupt
>>>>>> presence and disallow runtime PM suspension if it's missing to fix the
>>>>>> trouble.
>>>>> [...]
>>>>>> --- a/drivers/usb/host/xhci-tegra.c
>>>>>> +++ b/drivers/usb/host/xhci-tegra.c
>>>>>> @@ -1454,10 +1454,13 @@ static int tegra_xusb_probe(struct platform_device *pdev)
>>>>>> goto put_padctl;
>>>>>> }
>>>>>>
>>>>>> - tegra->padctl_irq = of_irq_get(np, 0);
>>>>>> - if (tegra->padctl_irq <= 0) {
>>>>>> - err = (tegra->padctl_irq == 0) ? -ENODEV : tegra->padctl_irq;
>>>>>> - goto put_padctl;
>>>>>> + /* Older device-trees don't specify padctrl interrupt */
>>>>>> + if (of_property_read_bool(np, "interrupts")) {
>>>>>
>>>>> Does this catch "interrupts-extended"?
>>>>
>>>> No, Tegra doesn't use interrupts-extended.
>>>
>>> I believe it is generic and equivalent to "interrupt-parent" +
>>> "interrupts" properties, so people might as well put this in
>>> the DT to save (or loose) a few bytes.
>>>
>>> You could just check if of_irq_get() returned -EINVAL instead of
>>> matching "interrupts" property.
>>
>> It should be a bad idea to rely on -EINVAL since it's ambiguous error code.
>>
>> Perhaps it's fine to assume that today of_irq_get() may only return
>> -EINVAL in a case of a missing DT property, but then it should be two
>> patches here:
>>
>> 1. Use -EINVAL and backport this fix to stable kernel.
>> 2. Change of_irq_get() to return -ENOENT for a missing property and
>> change tegra_xusb_probe() accordingly.
>
> I would love to see the part 2 done, but I'm afraid you will need to
> change a lot of callsites before that can happen.
At a quick glance there are only couple drivers which explicitly check
for -EINVAL, others only check whether returned value is negative. Seems
not that bad.
prev parent reply other threads:[~2021-10-22 9:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-21 11:55 [PATCH v1] usb: xhci: tegra: Check padctrl interrupt presence in device tree Dmitry Osipenko
2021-10-21 14:01 ` Thierry Reding
2021-10-21 14:57 ` Dmitry Osipenko
2021-10-21 15:08 ` Dmitry Osipenko
2021-10-21 15:20 ` Alan Stern
2021-10-21 17:13 ` Dmitry Osipenko
2021-10-21 17:16 ` Dmitry Osipenko
2021-10-21 19:14 ` Alan Stern
2021-10-21 19:17 ` Dmitry Osipenko
2021-10-26 7:23 ` Dmitry Osipenko
2021-10-21 21:37 ` Michał Mirosław
2021-10-21 21:46 ` Dmitry Osipenko
2021-10-21 22:14 ` Michał Mirosław
2021-10-22 5:58 ` Dmitry Osipenko
2021-10-22 9:29 ` Michał Mirosław
2021-10-22 9:35 ` 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=2e40f008-7a46-e6ec-a2d5-a5e6501bff78@gmail.com \
--to=digetx@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jckuo@nvidia.com \
--cc=jonathanh@nvidia.com \
--cc=kwizart@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=mirq-linux@rere.qmqm.pl \
--cc=treding@nvidia.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