Re: [PATCH] usb: ehci: change order of register cleanup during shutdown

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2 Aug 2016, Marc Ohlf wrote:

> On Mon, Aug 01, 2016 at 06:07:17PM +0200, Alan Stern wrote:
> > On Mon, 1 Aug 2016, Marc Ohlf wrote:
> > 
> > > In ehci_turn_off_all_ports() all EHCI port register bits
> > > (except the PORT_RWC_BITS) are set to zero.
> > 
> > Even the PORT_WRC_BITS are set to 0.  Oddly enough, the way to set 
> > those bits to 0 is to write a 1 to them (see Table 2-16 in the EHCI 
> > spec).
> 
> Thanks for correction, i will improve that in an v2.
> 
> > 
> > > On some hardware, this can lead to an system hang,
> > > when ehci_port_power() accesses the already cleaned registers.
> > > 
> > > This patch changes the order of cleanup.
> > > First call ehci_port_power() which respects the current bits in
> > > port status registers
> > > and afterwards cleanup the hard way by setting everything else to zero.
> > > 
> > > Signed-off-by: Marc Ohlf <ohlf@xxxxxxxxxx>
> > > ---
> > >  drivers/usb/host/ehci-hcd.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> > > index a962b89..1e5f529 100644
> > > --- a/drivers/usb/host/ehci-hcd.c
> > > +++ b/drivers/usb/host/ehci-hcd.c
> > > @@ -332,11 +332,11 @@ static void ehci_turn_off_all_ports(struct ehci_hcd *ehci)
> > >  	int	port = HCS_N_PORTS(ehci->hcs_params);
> > >  
> > >  	while (port--) {
> > > -		ehci_writel(ehci, PORT_RWC_BITS,
> > > -				&ehci->regs->port_status[port]);
> > >  		spin_unlock_irq(&ehci->lock);
> > >  		ehci_port_power(ehci, port, false);
> > >  		spin_lock_irq(&ehci->lock);
> > > +		ehci_writel(ehci, PORT_RWC_BITS,
> > > +				&ehci->regs->port_status[port]);
> > >  	}
> > >  }
> > 
> 
> I'm new to the mailing lists, so I've some questions.
> 
> > Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> 
> I should include your Ack in my v2 patch signoff area, right?

Yes.

> > 
> > This should be marked for the -stable kernels as well.
> 
> Marking this for -stable kernels means cc it to stable mailing list, right?

No, it means adding:

CC: <stable@xxxxxxxxxxxxxxx>

in among the Signed-off-by: and Acked-by: lines.  This tag will 
automatically cause the patch to be added to the -stable queue when it 
gets accepted.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux