From: Jack Pham <quic_jackp@quicinc.com>
To: Alan Stern <stern@rowland.harvard.edu>,
Heiner Kallweit <hkallweit1@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Linux USB Mailing List <linux-usb@vger.kernel.org>,
"open list:ARM/Amlogic Meson..."
<linux-amlogic@lists.infradead.org>,
Tung Nguyen <tunguyen@apm.com>,
"Mathias Nyman" <mathias.nyman@intel.com>
Subject: Re: [PATCH] usb: core: improve handling of hubs with no ports
Date: Thu, 24 Feb 2022 12:06:38 -0800 [thread overview]
Message-ID: <20220224200637.GE13801@jackp-linux.qualcomm.com> (raw)
In-Reply-To: <Yhaxb0OvMwLtd6vr@rowland.harvard.edu>
On Wed, Feb 23, 2022 at 05:13:03PM -0500, Alan Stern wrote:
> On Wed, Feb 23, 2022 at 09:58:56PM +0100, Heiner Kallweit wrote:
> > On 23.02.2022 15:17, Alan Stern wrote:
> > > Don't change register_root_hub(). Just change xhci_plat_probe(); make
> > > it skip the second call to usb_add_hcd() if there are no USB-3 ports.
I believe this had been attempted in the past, but it does not appear
that patch was ever accepted:
https://lore.kernel.org/linux-usb/1517221474-19627-1-git-send-email-tqnguyen@apm.com/
Jack
> > This works on my system. However a consequence is that xhci->shared_hcd
> > is NULL.
>
> Why is that? xhci->shared_hcd doesn't get set in usb_add_hcd(), so
> skipping that call shouldn't cause it to be NULL.
>
> Note: If you skip calling usb_add_hcd(), you will also have to skip the
> corresponding call to usb_remove_hcd(). There may be a few more
> subtleties involved as well; like I said before, I'm not an expert on
> this driver. You should ask the xhci-hcd maintainer for advice.
>
> Alan Stern
>
> > There are a few places like the following in xhci.c where
> > this may result in a NPE. Not knowing the USB subsystem in detail
> > I can't say whether these places are in any relevant path.
> >
> > static int xhci_run_finished(struct xhci_hcd *xhci)
> > {
> > if (xhci_start(xhci)) {
> > xhci_halt(xhci);
> > return -ENODEV;
> > }
> > xhci->shared_hcd->state = HC_STATE_RUNNING;
> >
> >
> >
> > > Alan Stern
> > >
> > >> What I can do: submit my patches as RFC, then there's a better basis
> > >> for a discussion.
> > >>
> > >>> Alan Stern
> > >>
> > >> Heiner
> >
> > Heiner
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
WARNING: multiple messages have this Message-ID (diff)
From: Jack Pham <quic_jackp@quicinc.com>
To: Alan Stern <stern@rowland.harvard.edu>,
Heiner Kallweit <hkallweit1@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Linux USB Mailing List <linux-usb@vger.kernel.org>,
"open list:ARM/Amlogic Meson..."
<linux-amlogic@lists.infradead.org>,
Tung Nguyen <tunguyen@apm.com>,
"Mathias Nyman" <mathias.nyman@intel.com>
Subject: Re: [PATCH] usb: core: improve handling of hubs with no ports
Date: Thu, 24 Feb 2022 12:06:38 -0800 [thread overview]
Message-ID: <20220224200637.GE13801@jackp-linux.qualcomm.com> (raw)
In-Reply-To: <Yhaxb0OvMwLtd6vr@rowland.harvard.edu>
On Wed, Feb 23, 2022 at 05:13:03PM -0500, Alan Stern wrote:
> On Wed, Feb 23, 2022 at 09:58:56PM +0100, Heiner Kallweit wrote:
> > On 23.02.2022 15:17, Alan Stern wrote:
> > > Don't change register_root_hub(). Just change xhci_plat_probe(); make
> > > it skip the second call to usb_add_hcd() if there are no USB-3 ports.
I believe this had been attempted in the past, but it does not appear
that patch was ever accepted:
https://lore.kernel.org/linux-usb/1517221474-19627-1-git-send-email-tqnguyen@apm.com/
Jack
> > This works on my system. However a consequence is that xhci->shared_hcd
> > is NULL.
>
> Why is that? xhci->shared_hcd doesn't get set in usb_add_hcd(), so
> skipping that call shouldn't cause it to be NULL.
>
> Note: If you skip calling usb_add_hcd(), you will also have to skip the
> corresponding call to usb_remove_hcd(). There may be a few more
> subtleties involved as well; like I said before, I'm not an expert on
> this driver. You should ask the xhci-hcd maintainer for advice.
>
> Alan Stern
>
> > There are a few places like the following in xhci.c where
> > this may result in a NPE. Not knowing the USB subsystem in detail
> > I can't say whether these places are in any relevant path.
> >
> > static int xhci_run_finished(struct xhci_hcd *xhci)
> > {
> > if (xhci_start(xhci)) {
> > xhci_halt(xhci);
> > return -ENODEV;
> > }
> > xhci->shared_hcd->state = HC_STATE_RUNNING;
> >
> >
> >
> > > Alan Stern
> > >
> > >> What I can do: submit my patches as RFC, then there's a better basis
> > >> for a discussion.
> > >>
> > >>> Alan Stern
> > >>
> > >> Heiner
> >
> > Heiner
next prev parent reply other threads:[~2022-02-24 20:07 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-22 21:13 [PATCH] usb: core: improve handling of hubs with no ports Heiner Kallweit
2022-02-22 21:13 ` Heiner Kallweit
2022-02-23 2:10 ` Alan Stern
2022-02-23 2:10 ` Alan Stern
2022-02-23 12:26 ` Heiner Kallweit
2022-02-23 12:26 ` Heiner Kallweit
2022-02-23 14:17 ` Alan Stern
2022-02-23 14:17 ` Alan Stern
2022-02-23 14:58 ` Heiner Kallweit
2022-02-23 14:58 ` Heiner Kallweit
2022-02-23 15:37 ` Alan Stern
2022-02-23 15:37 ` Alan Stern
2022-02-23 20:58 ` Heiner Kallweit
2022-02-23 20:58 ` Heiner Kallweit
2022-02-23 22:13 ` Alan Stern
2022-02-23 22:13 ` Alan Stern
2022-02-24 20:06 ` Jack Pham [this message]
2022-02-24 20:06 ` Jack Pham
2022-02-24 20:16 ` Heiner Kallweit
2022-02-24 20:16 ` Heiner Kallweit
2022-02-24 20:21 ` Alan Stern
2022-02-24 20:21 ` Alan Stern
2022-03-03 11:50 ` Mathias Nyman
2022-03-03 11:50 ` Mathias Nyman
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=20220224200637.GE13801@jackp-linux.qualcomm.com \
--to=quic_jackp@quicinc.com \
--cc=gregkh@linuxfoundation.org \
--cc=hkallweit1@gmail.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=stern@rowland.harvard.edu \
--cc=tunguyen@apm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.