| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ubt.c,v 1.43 2012/01/14 21:37:17 plunky Exp $ */ | | 1 | /* $NetBSD: ubt.c,v 1.44 2012/01/23 08:30:24 plunky Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2006 Itronix Inc. | | 4 | * Copyright (c) 2006 Itronix Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Written by Iain Hibbert for Itronix Inc. | | 7 | * Written by Iain Hibbert for Itronix Inc. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -57,27 +57,27 @@ | | | @@ -57,27 +57,27 @@ |
57 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 57 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
58 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 58 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
59 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 59 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
60 | * POSSIBILITY OF SUCH DAMAGE. | | 60 | * POSSIBILITY OF SUCH DAMAGE. |
61 | */ | | 61 | */ |
62 | /* | | 62 | /* |
63 | * This driver originally written by Lennart Augustsson and David Sainty, | | 63 | * This driver originally written by Lennart Augustsson and David Sainty, |
64 | * but was mostly rewritten for the NetBSD Bluetooth protocol stack by | | 64 | * but was mostly rewritten for the NetBSD Bluetooth protocol stack by |
65 | * Iain Hibbert for Itronix, Inc using the FreeBSD ng_ubt.c driver as a | | 65 | * Iain Hibbert for Itronix, Inc using the FreeBSD ng_ubt.c driver as a |
66 | * reference. | | 66 | * reference. |
67 | */ | | 67 | */ |
68 | | | 68 | |
69 | #include <sys/cdefs.h> | | 69 | #include <sys/cdefs.h> |
70 | __KERNEL_RCSID(0, "$NetBSD: ubt.c,v 1.43 2012/01/14 21:37:17 plunky Exp $"); | | 70 | __KERNEL_RCSID(0, "$NetBSD: ubt.c,v 1.44 2012/01/23 08:30:24 plunky Exp $"); |
71 | | | 71 | |
72 | #include <sys/param.h> | | 72 | #include <sys/param.h> |
73 | #include <sys/device.h> | | 73 | #include <sys/device.h> |
74 | #include <sys/ioctl.h> | | 74 | #include <sys/ioctl.h> |
75 | #include <sys/kernel.h> | | 75 | #include <sys/kernel.h> |
76 | #include <sys/malloc.h> | | 76 | #include <sys/malloc.h> |
77 | #include <sys/mbuf.h> | | 77 | #include <sys/mbuf.h> |
78 | #include <sys/proc.h> | | 78 | #include <sys/proc.h> |
79 | #include <sys/sysctl.h> | | 79 | #include <sys/sysctl.h> |
80 | #include <sys/systm.h> | | 80 | #include <sys/systm.h> |
81 | | | 81 | |
82 | #include <dev/usb/usb.h> | | 82 | #include <dev/usb/usb.h> |
83 | #include <dev/usb/usbdi.h> | | 83 | #include <dev/usb/usbdi.h> |
| @@ -717,28 +717,31 @@ ubt_sysctl_config(SYSCTLFN_ARGS) | | | @@ -717,28 +717,31 @@ ubt_sysctl_config(SYSCTLFN_ARGS) |
717 | t = sc->sc_config; | | 717 | t = sc->sc_config; |
718 | node.sysctl_data = &t; | | 718 | node.sysctl_data = &t; |
719 | error = sysctl_lookup(SYSCTLFN_CALL(&node)); | | 719 | error = sysctl_lookup(SYSCTLFN_CALL(&node)); |
720 | if (error || newp == NULL) | | 720 | if (error || newp == NULL) |
721 | return error; | | 721 | return error; |
722 | | | 722 | |
723 | if (t < 0 || t >= sc->sc_alt_config) | | 723 | if (t < 0 || t >= sc->sc_alt_config) |
724 | return EINVAL; | | 724 | return EINVAL; |
725 | | | 725 | |
726 | /* This may not change when the unit is enabled */ | | 726 | /* This may not change when the unit is enabled */ |
727 | if (sc->sc_enabled) | | 727 | if (sc->sc_enabled) |
728 | return EBUSY; | | 728 | return EBUSY; |
729 | | | 729 | |
| | | 730 | KERNEL_LOCK(1, curlwp); |
730 | sc->sc_config = t; | | 731 | sc->sc_config = t; |
731 | return ubt_set_isoc_config(sc); | | 732 | error = ubt_set_isoc_config(sc); |
| | | 733 | KERNEL_UNLOCK_ONE(curlwp); |
| | | 734 | return error; |
732 | } | | 735 | } |
733 | | | 736 | |
734 | static void | | 737 | static void |
735 | ubt_abortdealloc(struct ubt_softc *sc) | | 738 | ubt_abortdealloc(struct ubt_softc *sc) |
736 | { | | 739 | { |
737 | int i; | | 740 | int i; |
738 | | | 741 | |
739 | DPRINTFN(1, "sc=%p\n", sc); | | 742 | DPRINTFN(1, "sc=%p\n", sc); |
740 | | | 743 | |
741 | /* Abort all pipes */ | | 744 | /* Abort all pipes */ |
742 | usbd_abort_default_pipe(sc->sc_udev); | | 745 | usbd_abort_default_pipe(sc->sc_udev); |
743 | | | 746 | |
744 | if (sc->sc_evt_pipe != NULL) { | | 747 | if (sc->sc_evt_pipe != NULL) { |