Re: [PATCH 1/4] usb: dwc3: gadget: Don't send unintended link state change

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

 



Hi Thinh,

Thinh Nguyen <Thinh.Nguyen@xxxxxxxxxxxx> writes:
> DCTL.ULSTCHNGREQ is a write-only field. When doing a read-modify-write
> to DCTL, the driver must make sure that there's no unintended link state
> change request from whatever is read from DCTL.ULSTCHNGREQ. Set link
> state change to no-action when the driver writes to DCTL.
>
> Signed-off-by: Thinh Nguyen <thinhn@xxxxxxxxxxxx>

WHAT A GREAT CATCH!!! However, let's do one small change here:

> ---
>  drivers/usb/dwc3/gadget.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 86dc1db788a9..24178b4b9d46 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -57,6 +57,8 @@ int dwc3_gadget_set_test_mode(struct dwc3 *dwc, int mode)
>  		return -EINVAL;
>  	}
>  
> +	/* Don't send link state change request */
> +	reg &= ~DWC3_DCTL_ULSTCHNGREQ_MASK;
>  	dwc3_writel(dwc->regs, DWC3_DCTL, reg);

Let's a small macro or a little function to wrap this. Something
dwc3_dctl_write_safe() or something long those line.

Then that macro/function will make sure to clear those bits.

-- 
balbi

Attachment: signature.asc
Description: PGP signature


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

  Powered by Linux