linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: "Måns Rullgård" <mans@mansr.com>
Cc: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Markus Reichl <m.reichl@fivetechno.de>,
	Krzysztof Kozlowski <krzk@kernel.org>
Subject: Re: [PATCH] usb: core: verify devicetree nodes for disabled interfaces
Date: Wed, 8 May 2019 12:14:20 +0200	[thread overview]
Message-ID: <106fc58c-1a4f-6605-41d7-b6031c5751a3@samsung.com> (raw)
In-Reply-To: <yw1xy33iv1lq.fsf@mansr.com>

Hi

On 2019-05-07 15:24, Måns Rullgård wrote:
> Marek Szyprowski <m.szyprowski@samsung.com> writes:
>> Commit 01fdf179f4b0 ("usb: core: skip interfaces disabled in devicetree")
>> add support for disabling given USB device interface by adding nodes to
>> the USB host controller device. The mentioned commit however identifies
>> the given USB interface node only by the 'reg' property in the host
>> controller children nodes and then checks for their the 'status'. The USB
>> device interface nodes however also has to have a 'compatible' property as
>> described in Documentation/devicetree/bindings/usb/usb-device.txt. This is
>> important, because USB host controller might have child-nodes for other
>> purposes. For example, Exynos EHCI and OHCI drivers already define
>> child-nodes for each physical root hub port and assigns respective PHY
>> controller and parameters for them. This conflicts with the proposed
>> approach and verifying for the presence of the compatible property fixes
>> this issue without changing the devicetree bindings and the way the PHY
>> controllers are handled by Exynos EHCI/OHCI drivers.
>>
>> Reported-by: Markus Reichl <m.reichl@fivetechno.de>
>> Fixes: 01fdf179f4b0 ("usb: core: skip interfaces disabled in devicetree")
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> ---
>>   drivers/usb/core/message.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
>> index 82239f27c4cc..cd455c4add25 100644
>> --- a/drivers/usb/core/message.c
>> +++ b/drivers/usb/core/message.c
>> @@ -2007,6 +2007,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
>>   		struct usb_interface *intf = cp->interface[i];
>>
>>   		if (intf->dev.of_node &&
>> +		    of_device_is_compatible(intf->dev.of_node, NULL) &&
>>   		    !of_device_is_available(intf->dev.of_node)) {
>>   			dev_info(&dev->dev, "skipping disabled interface %d\n",
>>   				 intf->cur_altsetting->desc.bInterfaceNumber);
>> -- 
> This doesn't look right.  of_device_is_compatible() with a NULL compat
> argument always returns zero.

Right, my fault. I missed that. of_find_property(intf->dev.of_node, 
"compatible", NULL) is the correct check.


> There also seems to be a broader incompatibility between the generic USB
> bindings and the use of child nodes in the Exynos bindings.

True, but frankly I have no idea how to fix this in a better way.

Exynos EHCI/OHCI bindings predates the generic USB device bindings and 
now we can only mitigate the damage caused by this conflict.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


  reply	other threads:[~2019-05-08 10:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190507125630eucas1p1c5fd171a8dc2a6b8eb9dd317fe245f0c@eucas1p1.samsung.com>
2019-05-07 12:56 ` [PATCH] usb: core: verify devicetree nodes for disabled interfaces Marek Szyprowski
2019-05-07 13:24   ` Måns Rullgård
2019-05-08 10:14     ` Marek Szyprowski [this message]
     [not found]       ` <CGME20190508104442eucas1p2ebdffa348465f2c28177601014614853@eucas1p2.samsung.com>
2019-05-08 10:44         ` [PATCH v2] " Marek Szyprowski
2019-05-08 11:46           ` Måns Rullgård
2019-05-08 13:49             ` Marek Szyprowski
2019-05-08 15:27               ` Måns Rullgård
     [not found]                 ` <CGME20190509084827eucas1p294962744fe70745c50b69a5349b5de68@eucas1p2.samsung.com>
2019-05-09  8:47                   ` [PATCH v3] usb: core: verify devicetree nodes for USB devices Marek Szyprowski
2019-05-09 18:55                     ` Måns Rullgård
2019-05-10  3:10                       ` Peter Chen
2019-05-10  9:43                         ` Marek Szyprowski
2019-05-13  9:00                           ` Peter Chen
2019-05-13  9:07                             ` Marek Szyprowski
2019-05-13  9:23                               ` Peter Chen
2019-05-13 10:03                                 ` Marek Szyprowski
2019-05-13 10:06                                   ` Måns Rullgård
2019-05-17 11:15                                     ` Marek Szyprowski
2019-05-13 10:03                           ` Måns Rullgård
2019-05-17 11:18                             ` Marek Szyprowski
2019-05-09 19:04                     ` Tobias Jakobi

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=106fc58c-1a4f-6605-41d7-b6031c5751a3@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.reichl@fivetechno.de \
    --cc=mans@mansr.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).