Fix the build of ALL kernel (hi matt@).diff -r1.26 -r1.27 src/sys/dev/usb/ubsa.c
(rmind)
--- src/sys/dev/usb/ubsa.c 2010/11/03 22:34:23 1.26
+++ src/sys/dev/usb/ubsa.c 2011/06/12 03:26:20 1.27
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ubsa.c,v 1.26 2010/11/03 22:34:23 dyoung Exp $ */ | 1 | /* $NetBSD: ubsa.c,v 1.27 2011/06/12 03:26:20 rmind Exp $ */ | |
2 | /*- | 2 | /*- | |
3 | * Copyright (c) 2002, Alexander Kabaev <kan.FreeBSD.org>. | 3 | * Copyright (c) 2002, Alexander Kabaev <kan.FreeBSD.org>. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * | 14 | * | |
@@ -44,27 +44,27 @@ | @@ -44,27 +44,27 @@ | |||
44 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 44 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
45 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 45 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
46 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 46 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
47 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 47 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
48 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 48 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
49 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 49 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
50 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 50 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
51 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 51 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
52 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 52 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
53 | * POSSIBILITY OF SUCH DAMAGE. | 53 | * POSSIBILITY OF SUCH DAMAGE. | |
54 | */ | 54 | */ | |
55 | 55 | |||
56 | #include <sys/cdefs.h> | 56 | #include <sys/cdefs.h> | |
57 | __KERNEL_RCSID(0, "$NetBSD: ubsa.c,v 1.26 2010/11/03 22:34:23 dyoung Exp $"); | 57 | __KERNEL_RCSID(0, "$NetBSD: ubsa.c,v 1.27 2011/06/12 03:26:20 rmind Exp $"); | |
58 | 58 | |||
59 | #include <sys/param.h> | 59 | #include <sys/param.h> | |
60 | #include <sys/systm.h> | 60 | #include <sys/systm.h> | |
61 | #include <sys/kernel.h> | 61 | #include <sys/kernel.h> | |
62 | #include <sys/malloc.h> | 62 | #include <sys/malloc.h> | |
63 | #ifdef __FreeBSD__ | 63 | #ifdef __FreeBSD__ | |
64 | #include <sys/bus.h> | 64 | #include <sys/bus.h> | |
65 | #endif | 65 | #endif | |
66 | #include <sys/ioccom.h> | 66 | #include <sys/ioccom.h> | |
67 | #include <sys/fcntl.h> | 67 | #include <sys/fcntl.h> | |
68 | #include <sys/conf.h> | 68 | #include <sys/conf.h> | |
69 | #include <sys/tty.h> | 69 | #include <sys/tty.h> | |
70 | #include <sys/file.h> | 70 | #include <sys/file.h> | |
@@ -80,27 +80,27 @@ __KERNEL_RCSID(0, "$NetBSD: ubsa.c,v 1.2 | @@ -80,27 +80,27 @@ __KERNEL_RCSID(0, "$NetBSD: ubsa.c,v 1.2 | |||
80 | 80 | |||
81 | #include <dev/usb/usb.h> | 81 | #include <dev/usb/usb.h> | |
82 | #include <dev/usb/usbcdc.h> | 82 | #include <dev/usb/usbcdc.h> | |
83 | 83 | |||
84 | #include <dev/usb/usbdi.h> | 84 | #include <dev/usb/usbdi.h> | |
85 | #include <dev/usb/usbdi_util.h> | 85 | #include <dev/usb/usbdi_util.h> | |
86 | #include <dev/usb/usbdevs.h> | 86 | #include <dev/usb/usbdevs.h> | |
87 | #include <dev/usb/usb_quirks.h> | 87 | #include <dev/usb/usb_quirks.h> | |
88 | 88 | |||
89 | #include <dev/usb/ucomvar.h> | 89 | #include <dev/usb/ucomvar.h> | |
90 | #include <dev/usb/ubsavar.h> | 90 | #include <dev/usb/ubsavar.h> | |
91 | 91 | |||
92 | #ifdef UBSA_DEBUG | 92 | #ifdef UBSA_DEBUG | |
93 | Static int ubsadebug = 0; | 93 | int ubsadebug = 0; | |
94 | #ifdef __FreeBSD__ | 94 | #ifdef __FreeBSD__ | |
95 | SYSCTL_NODE(_hw_usb, OID_AUTO, ubsa, CTLFLAG_RW, 0, "USB ubsa"); | 95 | SYSCTL_NODE(_hw_usb, OID_AUTO, ubsa, CTLFLAG_RW, 0, "USB ubsa"); | |
96 | SYSCTL_INT(_hw_usb_ubsa, OID_AUTO, debug, CTLFLAG_RW, | 96 | SYSCTL_INT(_hw_usb_ubsa, OID_AUTO, debug, CTLFLAG_RW, | |
97 | &ubsadebug, 0, "ubsa debug level"); | 97 | &ubsadebug, 0, "ubsa debug level"); | |
98 | #endif | 98 | #endif | |
99 | 99 | |||
100 | #define DPRINTFN(n, x) do { \ | 100 | #define DPRINTFN(n, x) do { \ | |
101 | if (ubsadebug > (n)) \ | 101 | if (ubsadebug > (n)) \ | |
102 | printf x; \ | 102 | printf x; \ | |
103 | } while (0) | 103 | } while (0) | |
104 | #else | 104 | #else | |
105 | #define DPRINTFN(n, x) | 105 | #define DPRINTFN(n, x) | |
106 | #endif | 106 | #endif |
--- src/sys/dev/usb/usb_mem.c 2011/06/09 19:08:32 1.48
+++ src/sys/dev/usb/usb_mem.c 2011/06/12 03:26:20 1.49
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: usb_mem.c,v 1.48 2011/06/09 19:08:32 matt Exp $ */ | 1 | /* $NetBSD: usb_mem.c,v 1.49 2011/06/12 03:26:20 rmind Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1998 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Lennart Augustsson (lennart@augustsson.net) at | 8 | * by Lennart Augustsson (lennart@augustsson.net) at | |
9 | * Carlstedt Research & Technology. | 9 | * Carlstedt Research & Technology. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -28,27 +28,27 @@ | @@ -28,27 +28,27 @@ | |||
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
30 | * POSSIBILITY OF SUCH DAMAGE. | 30 | * POSSIBILITY OF SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | /* | 33 | /* | |
34 | * USB DMA memory allocation. | 34 | * USB DMA memory allocation. | |
35 | * We need to allocate a lot of small (many 8 byte, some larger) | 35 | * We need to allocate a lot of small (many 8 byte, some larger) | |
36 | * memory blocks that can be used for DMA. Using the bus_dma | 36 | * memory blocks that can be used for DMA. Using the bus_dma | |
37 | * routines directly would incur large overheads in space and time. | 37 | * routines directly would incur large overheads in space and time. | |
38 | */ | 38 | */ | |
39 | 39 | |||
40 | #include <sys/cdefs.h> | 40 | #include <sys/cdefs.h> | |
41 | __KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.48 2011/06/09 19:08:32 matt Exp $"); | 41 | __KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.49 2011/06/12 03:26:20 rmind Exp $"); | |
42 | 42 | |||
43 | #ifdef _KERNEL_OPT | 43 | #ifdef _KERNEL_OPT | |
44 | #include "opt_usb.h" | 44 | #include "opt_usb.h" | |
45 | #endif | 45 | #endif | |
46 | 46 | |||
47 | #include <sys/param.h> | 47 | #include <sys/param.h> | |
48 | #include <sys/systm.h> | 48 | #include <sys/systm.h> | |
49 | #include <sys/kernel.h> | 49 | #include <sys/kernel.h> | |
50 | #include <sys/malloc.h> | 50 | #include <sys/malloc.h> | |
51 | #include <sys/queue.h> | 51 | #include <sys/queue.h> | |
52 | #include <sys/device.h> /* for usbdivar.h */ | 52 | #include <sys/device.h> /* for usbdivar.h */ | |
53 | #include <sys/bus.h> | 53 | #include <sys/bus.h> | |
54 | #include <sys/cpu.h> | 54 | #include <sys/cpu.h> | |
@@ -120,27 +120,27 @@ usb_block_allocmem(bus_dma_tag_t tag, si | @@ -120,27 +120,27 @@ usb_block_allocmem(bus_dma_tag_t tag, si | |||
120 | (unsigned long) size); | 120 | (unsigned long) size); | |
121 | } | 121 | } | |
122 | #endif | 122 | #endif | |
123 | 123 | |||
124 | s = splusb(); | 124 | s = splusb(); | |
125 | /* First check the free list. */ | 125 | /* First check the free list. */ | |
126 | LIST_FOREACH(b, &usb_blk_freelist, next) { | 126 | LIST_FOREACH(b, &usb_blk_freelist, next) { | |
127 | if (b->tag == tag && b->size >= size && b->align >= align) { | 127 | if (b->tag == tag && b->size >= size && b->align >= align) { | |
128 | LIST_REMOVE(b, next); | 128 | LIST_REMOVE(b, next); | |
129 | usb_blk_nfree--; | 129 | usb_blk_nfree--; | |
130 | splx(s); | 130 | splx(s); | |
131 | *dmap = b; | 131 | *dmap = b; | |
132 | DPRINTFN(6,("usb_block_allocmem: free list size=%zu\n", | 132 | DPRINTFN(6,("usb_block_allocmem: free list size=%zu\n", | |
133 | p->size)); | 133 | b->size)); | |
134 | return (USBD_NORMAL_COMPLETION); | 134 | return (USBD_NORMAL_COMPLETION); | |
135 | } | 135 | } | |
136 | } | 136 | } | |
137 | splx(s); | 137 | splx(s); | |
138 | 138 | |||
139 | #ifdef DIAGNOSTIC | 139 | #ifdef DIAGNOSTIC | |
140 | if (cpu_intr_p()) { | 140 | if (cpu_intr_p()) { | |
141 | printf("usb_block_allocmem: in interrupt context, failed\n"); | 141 | printf("usb_block_allocmem: in interrupt context, failed\n"); | |
142 | return (USBD_NOMEM); | 142 | return (USBD_NOMEM); | |
143 | } | 143 | } | |
144 | #endif | 144 | #endif | |
145 | 145 | |||
146 | DPRINTFN(6, ("usb_block_allocmem: no free\n")); | 146 | DPRINTFN(6, ("usb_block_allocmem: no free\n")); | |
@@ -198,27 +198,27 @@ usb_block_real_freemem(usb_dma_block_t * | @@ -198,27 +198,27 @@ usb_block_real_freemem(usb_dma_block_t * | |||
198 | printf("usb_block_real_freemem: in interrupt context\n"); | 198 | printf("usb_block_real_freemem: in interrupt context\n"); | |
199 | return; | 199 | return; | |
200 | } | 200 | } | |
201 | #endif | 201 | #endif | |
202 | bus_dmamap_unload(b->tag, b->map); | 202 | bus_dmamap_unload(b->tag, b->map); | |
203 | bus_dmamap_destroy(b->tag, b->map); | 203 | bus_dmamap_destroy(b->tag, b->map); | |
204 | bus_dmamem_unmap(b->tag, b->kaddr, b->size); | 204 | bus_dmamem_unmap(b->tag, b->kaddr, b->size); | |
205 | bus_dmamem_free(b->tag, b->segs, b->nsegs); | 205 | bus_dmamem_free(b->tag, b->segs, b->nsegs); | |
206 | free(p, M_USB); | 206 | free(p, M_USB); | |
207 | } | 207 | } | |
208 | #endif | 208 | #endif | |
209 | 209 | |||
210 | #ifdef DEBUG | 210 | #ifdef DEBUG | |
211 | Static bool | 211 | static bool | |
212 | usb_valid_block_p(usb_dma_block_t *b, struct usb_dma_block_qh *qh) | 212 | usb_valid_block_p(usb_dma_block_t *b, struct usb_dma_block_qh *qh) | |
213 | { | 213 | { | |
214 | usb_dma_block_t *xb; | 214 | usb_dma_block_t *xb; | |
215 | LIST_FOREACH(xb, qh, next) { | 215 | LIST_FOREACH(xb, qh, next) { | |
216 | if (xb == b) | 216 | if (xb == b) | |
217 | return true; | 217 | return true; | |
218 | } | 218 | } | |
219 | return false; | 219 | return false; | |
220 | } | 220 | } | |
221 | #endif | 221 | #endif | |
222 | 222 | |||
223 | /* | 223 | /* | |
224 | * Do not free the memory unconditionally since we might be called | 224 | * Do not free the memory unconditionally since we might be called |