Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1404565

Re: [PATCH] usb: echi-hcd: Add ehci_setup check before echi_shutdown

From Alan Stern <stern@rowland.harvard.edu>
Newsgroups linux.kernel
Subject Re: [PATCH] usb: echi-hcd: Add ehci_setup check before echi_shutdown
Date 2016-05-20 18:00 +0200
Message-ID <rAV0e-7mk-9@gated-at.bofh.it> (permalink)
References <rAUGR-7fU-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 20 May 2016, Andy Gross wrote:

> On 20 May 2016 at 09:31, Alan Stern <stern@rowland.harvard.edu> wrote:
> > On Thu, 19 May 2016, Andy Gross wrote:
> >
> >> On 19 May 2016 at 05:12, Srinivas Kandagatla
> >> <srinivas.kandagatla@linaro.org> wrote:
> >>
> >> <snip>
> >>
> >> > +++ b/drivers/usb/host/ehci-hcd.c
> >> > @@ -368,6 +368,15 @@ static void ehci_shutdown(struct usb_hcd *hcd)
> >> >  {
> >> >         struct ehci_hcd *ehci = hcd_to_ehci(hcd);
> >> >
> >> > +       /**
> >> > +        * Protect the system from crashing at system shutdown in cases where
> >> > +        * usb host is not added yet from OTG controller driver.
> >> > +        * As ehci_setup() not done yet, so stop accessing registers or
> >> > +        * variables initialized in ehci_setup()
> >> > +        */
> >> > +       if (!ehci->sbrn)
> >> > +               return;
> >> > +
> >> >         spin_lock_irq(&ehci->lock);
> >> >         ehci->shutdown = true;
> >> >         ehci->rh_state = EHCI_RH_STOPPING;
> >>
> >>
> >> Should we also not check this in ehci_suspend and ehci_resume?  If I
> >> do suspend/resume, it crashes in a similar manner.  I know this goes
> >> beyond the problem scope of the patch.  Perhaps I should send in an
> >> additional patch with the code?
> >>
> >> Are there any other places in the ehci-hcd where this needs to be checked?
> >
> > Really, this is an indication that the problem lies not in ehci-hcd but
> > rather in the platform glue code.  The platform code allows itself to
> > be registered as the driver of the controller device but does not
> > initialize the ehci-hcd parts.
> >
> > Neither ehci_suspend nor ehci_resume is called directly by the driver
> > core; the calls all have to pass through the glue code.  So maybe the
> > glue layer needs to be careful about invoking these routines in
> > ehci-hcd before ehci-hcd has been initialized.
> 
> That's a good point.  Perhaps all of this should be in the glue,
> including the shutdown case.

Many of the platform glue files set usb_hcd_platform_shutdown() as 
their shutdown callback, which makes it impossible for them to include 
a controller-specific test.

Alan Stern

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] usb: echi-hcd: Add ehci_setup check before echi_shutdown Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2016-05-19 12:20 +0200
  Re: [PATCH] usb: echi-hcd: Add ehci_setup check before echi_shutdown Alan Stern <stern@rowland.harvard.edu> - 2016-05-19 16:10 +0200
  Re: [PATCH] usb: echi-hcd: Add ehci_setup check before echi_shutdown Andy Gross <andy.gross@linaro.org> - 2016-05-19 22:50 +0200
  Re: [PATCH] usb: echi-hcd: Add ehci_setup check before echi_shutdown Andy Gross <andy.gross@linaro.org> - 2016-05-19 23:30 +0200
    Re: [PATCH] usb: echi-hcd: Add ehci_setup check before echi_shutdown Alan Stern <stern@rowland.harvard.edu> - 2016-05-20 16:40 +0200
      Re: [PATCH] usb: echi-hcd: Add ehci_setup check before echi_shutdown Andy Gross <andy.gross@linaro.org> - 2016-05-20 17:40 +0200
        Re: [PATCH] usb: echi-hcd: Add ehci_setup check before echi_shutdown Alan Stern <stern@rowland.harvard.edu> - 2016-05-20 18:00 +0200
          Re: [PATCH] usb: echi-hcd: Add ehci_setup check before echi_shutdown Andy Gross <andy.gross@linaro.org> - 2016-05-20 18:10 +0200
  Re: [PATCH] usb: echi-hcd: Add ehci_setup check before echi_shutdown Pramod Gurav <pramod.gurav@linaro.org> - 2016-05-30 15:30 +0200

csiph-web