From 0c0edd664f3fb899052d02d0bb06b19efd1f68db Mon Sep 17 00:00:00 2001 From: mrg Date: Sun, 15 Jul 2012 21:13:31 +0000 Subject: commit my workaround for PR 46648 for now, as the more involved fix is not ready yet: move the clear endpoint stall async call into the task thread, to avoid trying to call kmem_alloc() from a softint thread. XXX ideally moving callbacks into the task thread (or perhaps a different high priority task thread) would be better than this workaround, once that method is working. --- sys/dev/usb/usbdi.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'sys/dev/usb/usbdi.c') diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index 7ece5ea319a..1c7ab27bc5c 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.c,v 1.138 2012/06/10 06:15:55 mrg Exp $ */ +/* $NetBSD: usbdi.c,v 1.139 2012/07/15 21:13:31 mrg Exp $ */ /* * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.138 2012/06/10 06:15:55 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.139 2012/07/15 21:13:31 mrg Exp $"); #include "opt_compat_netbsd.h" #include "opt_usb.h" @@ -599,12 +599,12 @@ XXX should we do this? return (err); } -usbd_status -usbd_clear_endpoint_stall_async(usbd_pipe_handle pipe) +void +usbd_clear_endpoint_stall_async_cb(void *arg) { + usbd_pipe_handle pipe = arg; usbd_device_handle dev = pipe->device; usb_device_request_t req; - usbd_status err; pipe->methods->cleartoggle(pipe); @@ -613,8 +613,14 @@ usbd_clear_endpoint_stall_async(usbd_pipe_handle pipe) USETW(req.wValue, UF_ENDPOINT_HALT); USETW(req.wIndex, pipe->endpoint->edesc->bEndpointAddress); USETW(req.wLength, 0); - err = usbd_do_request_async(dev, &req, 0); - return (err); + (void)usbd_do_request_async(dev, &req, 0); +} + +void +usbd_clear_endpoint_stall_async(usbd_pipe_handle pipe) +{ + + usb_add_task(pipe->device, &pipe->async_task, USB_TASKQ_DRIVER); } void -- cgit