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.
This commit is contained in:
parent
fc6225f872
commit
dd3d2239c3
@ -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 @@ usbd_setup_pipe(usbd_device_handle dev, usbd_interface_handle iface,
|
||||
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_kill_pipe(usbd_pipe_handle pipe)
|
||||
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);
|
||||
}
|
||||
|
@ -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 @@ 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
|
||||
|
@ -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 @@ usb_endpoint_descriptor_t *usbd_interface2endpoint_descriptor
|
||||
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 @@ typedef struct {
|
||||
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
|
||||
|
@ -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 @@ struct usbd_pipe {
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user