Message ID | 20220228150843.870809-2-m.grzeschik@pengutronix.de (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | usb: dwc3: gadget: simple refactoring patches | expand |
Michael Grzeschik wrote: > To improve reading the code this patch moves the cases to start_isoc or > return the function under one common condition check. > > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> > --- > drivers/usb/dwc3/gadget.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > index 183b90923f51ba..0ed837323f6bd3 100644 > --- a/drivers/usb/dwc3/gadget.c > +++ b/drivers/usb/dwc3/gadget.c > @@ -1913,13 +1913,11 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) > * errors which will force us issue EndTransfer command. > */ > if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { > - if (!(dep->flags & DWC3_EP_PENDING_REQUEST) && > - !(dep->flags & DWC3_EP_TRANSFER_STARTED)) > - return 0; > - > - if ((dep->flags & DWC3_EP_PENDING_REQUEST)) { > - if (!(dep->flags & DWC3_EP_TRANSFER_STARTED)) > + if (!(dep->flags & DWC3_EP_TRANSFER_STARTED)) { > + if ((dep->flags & DWC3_EP_PENDING_REQUEST)) > return __dwc3_gadget_start_isoc(dep); > + > + return 0; > } > } > This looks much better. Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Thanks! Thinh
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 183b90923f51ba..0ed837323f6bd3 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1913,13 +1913,11 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) * errors which will force us issue EndTransfer command. */ if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { - if (!(dep->flags & DWC3_EP_PENDING_REQUEST) && - !(dep->flags & DWC3_EP_TRANSFER_STARTED)) - return 0; - - if ((dep->flags & DWC3_EP_PENDING_REQUEST)) { - if (!(dep->flags & DWC3_EP_TRANSFER_STARTED)) + if (!(dep->flags & DWC3_EP_TRANSFER_STARTED)) { + if ((dep->flags & DWC3_EP_PENDING_REQUEST)) return __dwc3_gadget_start_isoc(dep); + + return 0; } }
To improve reading the code this patch moves the cases to start_isoc or return the function under one common condition check. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> --- drivers/usb/dwc3/gadget.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)