Re: [PATCH] usb: gadget: dummy_hcd: Fix wrong port status macros in dummy_hub_control()

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

 



On Mon, 20 Mar 2017, Yuyang Du wrote:

> This fixes the commit: 1cd8fd2887e162ad3d06715 (usb: gadget: dummy_hcd:
> add SuperSpeed support).
> 
> Signed-off-by: Yuyang Du <yuyang.du@xxxxxxxxx>
> ---
>  drivers/usb/gadget/udc/dummy_hcd.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
> index 8cabc59..56d4e95 100644
> --- a/drivers/usb/gadget/udc/dummy_hcd.c
> +++ b/drivers/usb/gadget/udc/dummy_hcd.c
> @@ -2063,12 +2063,11 @@ static int dummy_hub_control(
>  			break;
>  		case USB_PORT_FEAT_POWER:
>  			if (hcd->speed == HCD_USB3) {
> -				if (dum_hcd->port_status & USB_PORT_STAT_POWER)
> +				if (dum_hcd->port_status & USB_SS_PORT_STAT_POWER)
>  					dev_dbg(dummy_dev(dum_hcd),
>  						"power-off\n");
>  			} else
> -				if (dum_hcd->port_status &
> -							USB_SS_PORT_STAT_POWER)
> +				if (dum_hcd->port_status & USB_PORT_STAT_POWER)
>  					dev_dbg(dummy_dev(dum_hcd),
>  						"power-off\n");
>  			/* FALLS THROUGH */

This certainly is not a complete fix.  Compare the code here with the
code for the SetPortFeature case.  For one speed we need to set the
USB_PORT_STAT_POWER bit and for the other speed we need to set the
USB_SS_PORT_STAT_POWER bit in dum_hcd->port_status.  1 << wValue cannot
be the correct bit in both cases.

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