From 5f2196bd7c72cbead9d47da32816dd69a06b692e Mon Sep 17 00:00:00 2001 From: Mian Yousaf Kaukab Date: Fri, 9 Jan 2015 13:38:56 +0100 Subject: [PATCH] usb: dwc2: gadget: consider all tx fifos When matching tx fifo to endpoint, consider all fifos instead of hard limiting to 8 Moreover, print error in case no fifo could be found. Tested-by: Robert Baldyga Acked-by: Paul Zimmerman Signed-off-by: Mian Yousaf Kaukab Signed-off-by: Felipe Balbi --- drivers/usb/dwc2/gadget.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 7dfda954aba1..cd8880d6be53 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2540,7 +2540,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep, */ if (dir_in && hsotg->dedicated_fifos) { size = hs_ep->ep.maxpacket*hs_ep->mc; - for (i = 1; i <= 8; ++i) { + for (i = 1; i < hsotg->num_of_eps; ++i) { if (hsotg->fifo_map & (1<regs + DPTXFSIZN(i)); @@ -2554,7 +2554,9 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep, hs_ep->fifo_size = val; break; } - if (i == 8) { + if (i == hsotg->num_of_eps) { + dev_err(hsotg->dev, + "%s: No suitable fifo found\n", __func__); ret = -ENOMEM; goto error; } -- 2.39.5