From f946ca01f76d5bf2cb1b56888587c9a119062b0e Mon Sep 17 00:00:00 2001 From: Martin Pieuchot Date: Thu, 8 Aug 2013 09:37:03 +0000 Subject: Use the same functions to abort and close the control pipe of a device as for every other pipes instead of having another function calling the host controller method. --- sys/dev/usb/usb_subr.c | 19 +++++-------------- sys/dev/usb/usbdi.c | 6 ++++-- 2 files changed, 9 insertions(+), 16 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 4fe7b513230..deaa56c05ea 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_subr.c,v 1.89 2013/04/15 09:23:02 mglocker Exp $ */ +/* $OpenBSD: usb_subr.c,v 1.90 2013/08/08 09:37:02 mpi Exp $ */ /* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -68,7 +68,6 @@ int usbd_getnewaddr(struct usbd_bus *); int usbd_print(void *, const char *); int usbd_submatch(struct device *, void *, void *); void usbd_free_iface_data(struct usbd_device *, int); -void usbd_kill_pipe(struct usbd_pipe *); usbd_status usbd_probe_and_attach(struct device *, struct usbd_device *, int, int); @@ -820,16 +819,6 @@ usbd_setup_pipe(struct usbd_device *dev, struct usbd_interface *iface, return (USBD_NORMAL_COMPLETION); } -/* Abort the device control pipe. */ -void -usbd_kill_pipe(struct usbd_pipe *pipe) -{ - usbd_abort_pipe(pipe); - pipe->methods->close(pipe); - pipe->endpoint->refcnt--; - free(pipe, M_USB); -} - int usbd_getnewaddr(struct usbd_bus *bus) { @@ -1427,8 +1416,10 @@ usb_free_device(struct usbd_device *dev, struct usbd_port *up) DPRINTF(("usb_free_device: %p\n", dev)); - if (dev->default_pipe != NULL) - usbd_kill_pipe(dev->default_pipe); + if (dev->default_pipe != NULL) { + usbd_abort_pipe(dev->default_pipe); + usbd_close_pipe(dev->default_pipe); + } if (dev->ifaces != NULL) { nifc = dev->cdesc->bNumInterface; for (ifcidx = 0; ifcidx < nifc; ifcidx++) diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index 1f7b9594236..c9db98f697d 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdi.c,v 1.55 2013/04/26 14:19:25 mpi Exp $ */ +/* $OpenBSD: usbdi.c,v 1.56 2013/08/08 09:37:02 mpi Exp $ */ /* $NetBSD: usbdi.c,v 1.103 2002/09/27 15:37:38 provos Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */ @@ -277,7 +277,9 @@ usbd_close_pipe(struct usbd_pipe *pipe) return (USBD_NORMAL_COMPLETION); if (! SIMPLEQ_EMPTY(&pipe->queue)) return (USBD_PENDING_REQUESTS); - LIST_REMOVE(pipe, next); + /* Default pipes are never linked */ + if (pipe->iface != NULL) + LIST_REMOVE(pipe, next); pipe->endpoint->refcnt--; pipe->methods->close(pipe); if (pipe->intrxfer != NULL) -- cgit v1.2.3