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

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

 



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).

> 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]);
>  	}
>  }

Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

This should be marked for the -stable kernels as well.

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