2021-08-12 03:34:50

by Chunfeng Yun

[permalink] [raw]
Subject: [PATCH 2/6] usb: mtu3: fix the wrong HS mult value

Use usb_endpoint_maxp() and usb_endpoint_maxp_mult() seperately
to get maxpacket and mult.
Meanwhile fix the bug that should use @mult but not @burst
to save mult value.

Fixes: 4d79e042ed8b ("usb: mtu3: add support for usb3.1 IP")
Cc: stable <[email protected]>
Signed-off-by: Chunfeng Yun <[email protected]>
---
drivers/usb/mtu3/mtu3_gadget.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index 5e21ba05ebf0..a399fd84c71f 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -64,14 +64,12 @@ static int mtu3_ep_enable(struct mtu3_ep *mep)
u32 interval = 0;
u32 mult = 0;
u32 burst = 0;
- int max_packet;
int ret;

desc = mep->desc;
comp_desc = mep->comp_desc;
mep->type = usb_endpoint_type(desc);
- max_packet = usb_endpoint_maxp(desc);
- mep->maxp = max_packet & GENMASK(10, 0);
+ mep->maxp = usb_endpoint_maxp(desc);

switch (mtu->g.speed) {
case USB_SPEED_SUPER:
@@ -92,7 +90,7 @@ static int mtu3_ep_enable(struct mtu3_ep *mep)
usb_endpoint_xfer_int(desc)) {
interval = desc->bInterval;
interval = clamp_val(interval, 1, 16) - 1;
- burst = (max_packet & GENMASK(12, 11)) >> 11;
+ mult = usb_endpoint_maxp_mult(desc) - 1;
}
break;
default:
--
2.25.1


2021-08-12 06:58:06

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH 2/6] usb: mtu3: fix the wrong HS mult value


Chunfeng Yun <[email protected]> writes:

> Use usb_endpoint_maxp() and usb_endpoint_maxp_mult() seperately
> to get maxpacket and mult.
> Meanwhile fix the bug that should use @mult but not @burst
> to save mult value.

I really think you should split this into two patches. One which *only*
fixes the bug and another (patch 2) which *only* corrects the use
usb_endpoint_maxp()

--
balbi

2021-08-12 12:35:31

by Chunfeng Yun

[permalink] [raw]
Subject: Re: [PATCH 2/6] usb: mtu3: fix the wrong HS mult value

On Thu, 2021-08-12 at 09:49 +0300, Felipe Balbi wrote:
> Chunfeng Yun <[email protected]> writes:
>
> > Use usb_endpoint_maxp() and usb_endpoint_maxp_mult() seperately
> > to get maxpacket and mult.
> > Meanwhile fix the bug that should use @mult but not @burst
> > to save mult value.
>
> I really think you should split this into two patches. One which
> *only*
> fixes the bug and another (patch 2) which *only* corrects the use
> usb_endpoint_maxp()
Ok, thanks
>