lkml.org 
[lkml]   [2021]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v1] usb: xhci: tegra: Check padctrl interrupt presence in device tree
From
Date
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.

\
 
 \ /
  Last update: 2021-10-22 11:36    [W:0.058 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site