Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb commit my workaround for PR 46648 for now, as th...
details: https://anonhg.NetBSD.org/src/rev/33cae3278df2
branches: trunk
changeset: 780215:33cae3278df2
user: mrg <mrg%NetBSD.org@localhost>
date: Sun Jul 15 21:13:31 2012 +0000
description:
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.
diffstat:
sys/dev/usb/usb_subr.c | 6 ++++--
sys/dev/usb/usbdi.c | 20 +++++++++++++-------
sys/dev/usb/usbdi.h | 9 ++++++---
sys/dev/usb/usbdivar.h | 3 ++-
4 files changed, 25 insertions(+), 13 deletions(-)
diffs (136 lines):
diff -r 4fa062455e48 -r 33cae3278df2 sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c Sun Jul 15 20:53:23 2012 +0000
+++ b/sys/dev/usb/usb_subr.c Sun Jul 15 21:13:31 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb_subr.c,v 1.182 2012/06/10 06:15:54 mrg Exp $ */
+/* $NetBSD: usb_subr.c,v 1.183 2012/07/15 21:13:31 mrg Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.182 2012/06/10 06:15:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.183 2012/07/15 21:13:31 mrg Exp $");
#include "opt_compat_netbsd.h"
#include "opt_usbverbose.h"
@@ -765,6 +765,7 @@
free(p, M_USB);
return (err);
}
+ usb_init_task(&p->async_task, usbd_clear_endpoint_stall_async_cb, p);
*pipe = p;
return (USBD_NORMAL_COMPLETION);
}
@@ -779,6 +780,7 @@
usbd_lock_pipe(pipe);
pipe->methods->close(pipe);
usbd_unlock_pipe(pipe);
+ usb_rem_task(pipe->device, &pipe->async_task);
pipe->endpoint->refcnt--;
free(pipe, M_USB);
}
diff -r 4fa062455e48 -r 33cae3278df2 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c Sun Jul 15 20:53:23 2012 +0000
+++ b/sys/dev/usb/usbdi.c Sun Jul 15 21:13:31 2012 +0000
@@ -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 <sys/cdefs.h>
-__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 @@
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 @@
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
diff -r 4fa062455e48 -r 33cae3278df2 sys/dev/usb/usbdi.h
--- a/sys/dev/usb/usbdi.h Sun Jul 15 20:53:23 2012 +0000
+++ b/sys/dev/usb/usbdi.h Sun Jul 15 21:13:31 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdi.h,v 1.83 2012/06/10 06:15:55 mrg Exp $ */
+/* $NetBSD: usbdi.h,v 1.84 2012/07/15 21:13:31 mrg Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $ */
/*
@@ -113,12 +113,12 @@
usbd_status usbd_abort_pipe(usbd_pipe_handle);
usbd_status usbd_abort_default_pipe(usbd_device_handle);
usbd_status usbd_clear_endpoint_stall(usbd_pipe_handle);
-usbd_status usbd_clear_endpoint_stall_async(usbd_pipe_handle);
+void usbd_clear_endpoint_stall_async(usbd_pipe_handle);
void usbd_clear_endpoint_toggle(usbd_pipe_handle);
usbd_status usbd_endpoint_count(usbd_interface_handle, u_int8_t *);
usbd_status usbd_interface_count(usbd_device_handle, u_int8_t *);
void usbd_interface2device_handle(usbd_interface_handle,
- usbd_device_handle *);
+ usbd_device_handle *);
usbd_status usbd_device2interface_handle(usbd_device_handle,
u_int8_t, usbd_interface_handle *);
@@ -188,6 +188,9 @@
void usb_desc_iter_init(usbd_device_handle, usbd_desc_iter_t *);
const usb_descriptor_t *usb_desc_iter_next(usbd_desc_iter_t *);
+/* Used to clear endpoint stalls from the softint */
+void usbd_clear_endpoint_stall_async_cb(void *);
+
/*
* The usb_task structs form a queue of things to run in the USB event
* thread. Normally this is just device discovery when a connect/disconnect
diff -r 4fa062455e48 -r 33cae3278df2 sys/dev/usb/usbdivar.h
--- a/sys/dev/usb/usbdivar.h Sun Jul 15 20:53:23 2012 +0000
+++ b/sys/dev/usb/usbdivar.h Sun Jul 15 21:13:31 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdivar.h,v 1.97 2012/06/10 06:15:55 mrg Exp $ */
+/* $NetBSD: usbdivar.h,v 1.98 2012/07/15 21:13:31 mrg Exp $ */
/*
* Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -212,6 +212,7 @@
char aborting;
SIMPLEQ_HEAD(, usbd_xfer) queue;
LIST_ENTRY(usbd_pipe) next;
+ struct usb_task async_task;
usbd_xfer_handle intrxfer; /* used for repeating requests */
char repeat;
Home |
Main Index |
Thread Index |
Old Index