Date: Mon, 11 Jun 2012 17:22:27 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r236896 - stable/8/sys/dev/usb Message-ID: <201206111722.q5BHMRO1098524@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Mon Jun 11 17:22:27 2012 New Revision: 236896 URL: http://svn.freebsd.org/changeset/base/236896 Log: MFC r236407: Improve support for detaching kernel drivers on a per interface basis. Modified: stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_generic.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Mon Jun 11 17:18:31 2012 (r236895) +++ stable/8/sys/dev/usb/usb_device.c Mon Jun 11 17:22:27 2012 (r236896) @@ -750,10 +750,13 @@ usb_config_parse(struct usb_device *udev if (do_init) { /* setup the USB interface structure */ iface->idesc = id; - /* default setting */ - iface->parent_iface_index = USB_IFACE_INDEX_ANY; /* set alternate index */ iface->alt_index = alt_index; + /* set default interface parent */ + if (iface_index == USB_IFACE_INDEX_ANY) { + iface->parent_iface_index = + USB_IFACE_INDEX_ANY; + } } DPRINTFN(5, "found idesc nendpt=%d\n", id->bNumEndpoints); @@ -1229,10 +1232,13 @@ usbd_set_parent_iface(struct usb_device { struct usb_interface *iface; + if (udev == NULL) { + /* nothing to do */ + return; + } iface = usbd_get_iface(udev, iface_index); - if (iface) { + if (iface != NULL) iface->parent_iface_index = parent_index; - } } static void Modified: stable/8/sys/dev/usb/usb_generic.c ============================================================================== --- stable/8/sys/dev/usb/usb_generic.c Mon Jun 11 17:18:31 2012 (r236895) +++ stable/8/sys/dev/usb/usb_generic.c Mon Jun 11 17:22:27 2012 (r236896) @@ -2166,7 +2166,16 @@ ugen_ioctl_post(struct usb_fifo *f, u_lo break; } + /* + * Detach the currently attached driver. + */ usb_detach_device(f->udev, n, 0); + + /* + * Set parent to self, this should keep attach away + * until the next set configuration event. + */ + usbd_set_parent_iface(f->udev, n, n); break; case USB_SET_POWER_MODE:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206111722.q5BHMRO1098524>