* [1/4] usb: dwc3: gadget: return errors from __dwc3_gadget_start_isoc()
@ 2018-08-20 11:23 Laurent Pinchart
0 siblings, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2018-08-20 11:23 UTC (permalink / raw)
To: Felipe Balbi; +Cc: linux-usb
Hi Felipe,
Thank you for the patch.
On Monday, 20 August 2018 13:29:58 EEST Felipe Balbi wrote:
> Sometimes, errors happen when kicking transfers from
> __dwc3_gadget_start_isoc(). In those cases, we need to pass along the
> error so gadget driver can make informed decisions.
>
> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
> ---
> drivers/usb/dwc3/gadget.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 69bf137aab37..f61a4250c883 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -1255,17 +1255,17 @@ static int __dwc3_gadget_get_frame(struct dwc3 *dwc)
> return DWC3_DSTS_SOFFN(reg);
> }
>
> -static void __dwc3_gadget_start_isoc(struct dwc3_ep *dep)
> +static int __dwc3_gadget_start_isoc(struct dwc3_ep *dep)
> {
> if (list_empty(&dep->pending_list)) {
> dev_info(dep->dwc->dev, "%s: ran out of requests\n",
> dep->name);
> dep->flags |= DWC3_EP_PENDING_REQUEST;
> - return;
> + return -EAGAIN;
> }
>
> dep->frame_number = DWC3_ALIGN_FRAME(dep);
> - __dwc3_gadget_kick_transfer(dep);
> + return __dwc3_gadget_kick_transfer(dep);
> }
>
> static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request
> *req) @@ -1306,8 +1306,7 @@ static int __dwc3_gadget_ep_queue(struct
> dwc3_ep *dep, struct dwc3_request *req)
>
> if ((dep->flags & DWC3_EP_PENDING_REQUEST)) {
> if (!(dep->flags & DWC3_EP_TRANSFER_STARTED)) {
> - __dwc3_gadget_start_isoc(dep);
> - return 0;
> + return __dwc3_gadget_start_isoc(dep);
Do I understandand correctly that the new -EAGAIN error returned above when an
underrun has occurred will never be returned here, as we call
__dwc3_gadget_start_isoc() after adding a request to the pending_list, covered
by the same spinlock that is taken by the IRQ handler to remove requests from
the list ? I don't think that's an issue, but I want to make sure nothing is
overlooked.
> }
> }
> }
> @@ -2427,7 +2426,7 @@ static void
> dwc3_gadget_endpoint_transfer_not_ready(struct dwc3_ep *dep, const struct
> dwc3_event_depevt *event)
> {
> dwc3_gadget_endpoint_frame_from_event(dep, event);
> - __dwc3_gadget_start_isoc(dep);
> + (void) __dwc3_gadget_start_isoc(dep);
No need for a cast here.
> }
>
> static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
^ permalink raw reply [flat|nested] 3+ messages in thread* [1/4] usb: dwc3: gadget: return errors from __dwc3_gadget_start_isoc()
@ 2018-11-08 6:57 Felipe Balbi
0 siblings, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2018-11-08 6:57 UTC (permalink / raw)
To: Linux USB; +Cc: Felipe Balbi
Sometimes, errors happen when kicking transfers from
__dwc3_gadget_start_isoc(). In those cases, we need to pass along the
error so gadget driver can make informed decisions.
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
---
drivers/usb/dwc3/gadget.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 64481da433ae..18c63137348d 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1266,17 +1266,17 @@ static int __dwc3_gadget_get_frame(struct dwc3 *dwc)
return DWC3_DSTS_SOFFN(reg);
}
-static void __dwc3_gadget_start_isoc(struct dwc3_ep *dep)
+static int __dwc3_gadget_start_isoc(struct dwc3_ep *dep)
{
if (list_empty(&dep->pending_list)) {
dev_info(dep->dwc->dev, "%s: ran out of requests\n",
dep->name);
dep->flags |= DWC3_EP_PENDING_REQUEST;
- return;
+ return -EAGAIN;
}
dep->frame_number = DWC3_ALIGN_FRAME(dep);
- __dwc3_gadget_kick_transfer(dep);
+ return __dwc3_gadget_kick_transfer(dep);
}
static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
@@ -1317,8 +1317,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
if ((dep->flags & DWC3_EP_PENDING_REQUEST)) {
if (!(dep->flags & DWC3_EP_TRANSFER_STARTED)) {
- __dwc3_gadget_start_isoc(dep);
- return 0;
+ return __dwc3_gadget_start_isoc(dep);
}
}
}
@@ -2381,7 +2380,7 @@ static void dwc3_gadget_endpoint_transfer_not_ready(struct dwc3_ep *dep,
const struct dwc3_event_depevt *event)
{
dwc3_gadget_endpoint_frame_from_event(dep, event);
- __dwc3_gadget_start_isoc(dep);
+ (void) __dwc3_gadget_start_isoc(dep);
}
static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
^ permalink raw reply related [flat|nested] 3+ messages in thread* [1/4] usb: dwc3: gadget: return errors from __dwc3_gadget_start_isoc()
@ 2018-08-20 10:29 Felipe Balbi
0 siblings, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2018-08-20 10:29 UTC (permalink / raw)
To: linux-usb; +Cc: laurent.pinchart, Felipe Balbi
Sometimes, errors happen when kicking transfers from
__dwc3_gadget_start_isoc(). In those cases, we need to pass along the
error so gadget driver can make informed decisions.
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
---
drivers/usb/dwc3/gadget.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 69bf137aab37..f61a4250c883 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1255,17 +1255,17 @@ static int __dwc3_gadget_get_frame(struct dwc3 *dwc)
return DWC3_DSTS_SOFFN(reg);
}
-static void __dwc3_gadget_start_isoc(struct dwc3_ep *dep)
+static int __dwc3_gadget_start_isoc(struct dwc3_ep *dep)
{
if (list_empty(&dep->pending_list)) {
dev_info(dep->dwc->dev, "%s: ran out of requests\n",
dep->name);
dep->flags |= DWC3_EP_PENDING_REQUEST;
- return;
+ return -EAGAIN;
}
dep->frame_number = DWC3_ALIGN_FRAME(dep);
- __dwc3_gadget_kick_transfer(dep);
+ return __dwc3_gadget_kick_transfer(dep);
}
static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
@@ -1306,8 +1306,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
if ((dep->flags & DWC3_EP_PENDING_REQUEST)) {
if (!(dep->flags & DWC3_EP_TRANSFER_STARTED)) {
- __dwc3_gadget_start_isoc(dep);
- return 0;
+ return __dwc3_gadget_start_isoc(dep);
}
}
}
@@ -2427,7 +2426,7 @@ static void dwc3_gadget_endpoint_transfer_not_ready(struct dwc3_ep *dep,
const struct dwc3_event_depevt *event)
{
dwc3_gadget_endpoint_frame_from_event(dep, event);
- __dwc3_gadget_start_isoc(dep);
+ (void) __dwc3_gadget_start_isoc(dep);
}
static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-08 6:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-20 11:23 [1/4] usb: dwc3: gadget: return errors from __dwc3_gadget_start_isoc() Laurent Pinchart
-- strict thread matches above, loose matches on Subject: below --
2018-11-08 6:57 Felipe Balbi
2018-08-20 10:29 Felipe Balbi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox