| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: bthub.c,v 1.22 2015/05/09 22:23:40 dholland Exp $ */ | | 1 | /* $NetBSD: bthub.c,v 1.23 2020/06/08 20:20:54 thorpej 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 |
| @@ -22,27 +22,27 @@ | | | @@ -22,27 +22,27 @@ |
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
23 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 23 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY | | 24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY |
25 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | | 25 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | | 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | | 27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN | | 28 | * ON ANY THEORY OF LIABILITY, WHETHER IN |
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
31 | * POSSIBILITY OF SUCH DAMAGE. | | 31 | * POSSIBILITY OF SUCH DAMAGE. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | #include <sys/cdefs.h> | | 34 | #include <sys/cdefs.h> |
35 | __KERNEL_RCSID(0, "$NetBSD: bthub.c,v 1.22 2015/05/09 22:23:40 dholland Exp $"); | | 35 | __KERNEL_RCSID(0, "$NetBSD: bthub.c,v 1.23 2020/06/08 20:20:54 thorpej Exp $"); |
36 | | | 36 | |
37 | #include <sys/param.h> | | 37 | #include <sys/param.h> |
38 | #include <sys/conf.h> | | 38 | #include <sys/conf.h> |
39 | #include <sys/device.h> | | 39 | #include <sys/device.h> |
40 | #include <sys/fcntl.h> | | 40 | #include <sys/fcntl.h> |
41 | #include <sys/kernel.h> | | 41 | #include <sys/kernel.h> |
42 | #include <sys/queue.h> | | 42 | #include <sys/queue.h> |
43 | #include <sys/malloc.h> | | 43 | #include <sys/malloc.h> |
44 | #include <sys/mbuf.h> | | 44 | #include <sys/mbuf.h> |
45 | #include <sys/proc.h> | | 45 | #include <sys/proc.h> |
46 | #include <sys/systm.h> | | 46 | #include <sys/systm.h> |
47 | | | 47 | |
48 | #include <prop/proplib.h> | | 48 | #include <prop/proplib.h> |
| @@ -100,27 +100,27 @@ bthub_match(device_t self, cfdata_t cfda | | | @@ -100,27 +100,27 @@ bthub_match(device_t self, cfdata_t cfda |
100 | { | | 100 | { |
101 | | | 101 | |
102 | return 1; | | 102 | return 1; |
103 | } | | 103 | } |
104 | | | 104 | |
105 | static void | | 105 | static void |
106 | bthub_attach(device_t parent, device_t self, void *aux) | | 106 | bthub_attach(device_t parent, device_t self, void *aux) |
107 | { | | 107 | { |
108 | bdaddr_t *addr = aux; | | 108 | bdaddr_t *addr = aux; |
109 | prop_dictionary_t dict; | | 109 | prop_dictionary_t dict; |
110 | prop_object_t obj; | | 110 | prop_object_t obj; |
111 | | | 111 | |
112 | dict = device_properties(self); | | 112 | dict = device_properties(self); |
113 | obj = prop_data_create_data(addr, sizeof(*addr)); | | 113 | obj = prop_data_create_copy(addr, sizeof(*addr)); |
114 | prop_dictionary_set(dict, BTDEVladdr, obj); | | 114 | prop_dictionary_set(dict, BTDEVladdr, obj); |
115 | prop_object_release(obj); | | 115 | prop_object_release(obj); |
116 | | | 116 | |
117 | aprint_verbose(" %s %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x", | | 117 | aprint_verbose(" %s %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x", |
118 | BTDEVladdr, | | 118 | BTDEVladdr, |
119 | addr->b[5], addr->b[4], addr->b[3], | | 119 | addr->b[5], addr->b[4], addr->b[3], |
120 | addr->b[2], addr->b[1], addr->b[0]); | | 120 | addr->b[2], addr->b[1], addr->b[0]); |
121 | | | 121 | |
122 | aprint_normal("\n"); | | 122 | aprint_normal("\n"); |
123 | | | 123 | |
124 | if (!pmf_device_register(self, NULL, NULL)) { | | 124 | if (!pmf_device_register(self, NULL, NULL)) { |
125 | /* | | 125 | /* |
126 | * XXX this should not be allowed to happen, but | | 126 | * XXX this should not be allowed to happen, but |