Thu Jun 11 02:39:31 2020 UTC ()
Update for proplib(3) API changes.


(thorpej)
diff -r1.6 -r1.7 src/sys/dev/acpi/acpi_i2c.c
diff -r1.31 -r1.32 src/sys/dev/bluetooth/bthidev.c
diff -r1.23 -r1.24 src/sys/dev/bluetooth/bthub.c
diff -r1.18 -r1.19 src/sys/dev/bluetooth/btmagic.c
diff -r1.41 -r1.42 src/sys/dev/bluetooth/btsco.c
diff -r1.33 -r1.34 src/sys/dev/fdt/fdtbus.c
diff -r1.22 -r1.23 src/sys/dev/hdaudio/hdafg.c
diff -r1.10 -r1.11 src/sys/dev/hdaudio/hdaudio.c
diff -r1.72 -r1.73 src/sys/dev/i2c/i2c.c
diff -r1.34 -r1.35 src/sys/dev/ofw/ofw_subr.c
diff -r1.66 -r1.67 src/sys/dev/pci/if_ixl.c
diff -r1.120 -r1.121 src/sys/dev/pci/if_tl.c
diff -r1.676 -r1.677 src/sys/dev/pci/if_wm.c
diff -r1.13 -r1.14 src/sys/dev/spi/spi.c
diff -r1.17 -r1.18 src/sys/dev/sysmon/swsensor.c
diff -r1.146 -r1.147 src/sys/dev/sysmon/sysmon_envsys.c
diff -r1.6 -r1.7 src/sys/dev/sysmon/sysmon_envsys_util.c
diff -r1.63 -r1.64 src/sys/dev/sysmon/sysmon_power.c
diff -r1.247 -r1.248 src/sys/dev/usb/usb_subr.c
diff -r1.2 -r1.3 src/sys/dev/wscons/wsdisplay_util.c
diff -r1.73 -r1.74 src/sys/dev/wsfb/genfb.c

cvs diff -r1.6 -r1.7 src/sys/dev/acpi/acpi_i2c.c (expand / switch to unified diff)

--- src/sys/dev/acpi/acpi_i2c.c 2020/06/08 20:21:56 1.6
+++ src/sys/dev/acpi/acpi_i2c.c 2020/06/11 02:39:30 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi_i2c.c,v 1.6 2020/06/08 20:21:56 thorpej Exp $ */ 1/* $NetBSD: acpi_i2c.c,v 1.7 2020/06/11 02:39:30 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2017 The NetBSD Foundation, Inc. 4 * Copyright (c) 2017 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 Manuel Bouyer. 8 * by Manuel Bouyer.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: acpi_i2c.c,v 1.6 2020/06/08 20:21:56 thorpej Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: acpi_i2c.c,v 1.7 2020/06/11 02:39:30 thorpej Exp $");
34 34
35#include <dev/acpi/acpireg.h> 35#include <dev/acpi/acpireg.h>
36#include <dev/acpi/acpivar.h> 36#include <dev/acpi/acpivar.h>
37#include <dev/acpi/acpi_i2c.h> 37#include <dev/acpi/acpi_i2c.h>
38 38
39#define _COMPONENT ACPI_BUS_COMPONENT 39#define _COMPONENT ACPI_BUS_COMPONENT
40ACPI_MODULE_NAME ("acpi_i2c") 40ACPI_MODULE_NAME ("acpi_i2c")
41 41
42static void 42static void
43acpi_enter_i2c_hid(struct acpi_devnode *devnode, prop_dictionary_t dev) 43acpi_enter_i2c_hid(struct acpi_devnode *devnode, prop_dictionary_t dev)
44{ 44{
45 ACPI_OBJECT_LIST arg; 45 ACPI_OBJECT_LIST arg;
46 ACPI_OBJECT obj[4]; 46 ACPI_OBJECT obj[4];
@@ -193,27 +193,27 @@ acpi_enter_i2c_device(struct acpi_devnod @@ -193,27 +193,27 @@ acpi_enter_i2c_device(struct acpi_devnod
193 prop_dictionary_set_uint32(dev, "addr", i2cc.i2c_addr); 193 prop_dictionary_set_uint32(dev, "addr", i2cc.i2c_addr);
194 prop_dictionary_set_uint64(dev, "cookie", (uintptr_t)ad->ad_handle); 194 prop_dictionary_set_uint64(dev, "cookie", (uintptr_t)ad->ad_handle);
195 /* first search by name, then by CID */ 195 /* first search by name, then by CID */
196 i2c_id = acpi_i2c_search(name); 196 i2c_id = acpi_i2c_search(name);
197 idlist = &ad->ad_devinfo->CompatibleIdList; 197 idlist = &ad->ad_devinfo->CompatibleIdList;
198 for (cidi = 0; 198 for (cidi = 0;
199 cidi < idlist->Count && i2c_id == NULL; 199 cidi < idlist->Count && i2c_id == NULL;
200 cidi++) { 200 cidi++) {
201 i2c_id = acpi_i2c_search(idlist->Ids[cidi].String); 201 i2c_id = acpi_i2c_search(idlist->Ids[cidi].String);
202 } 202 }
203 if (i2c_id != NULL) { 203 if (i2c_id != NULL) {
204 if (i2c_id->compat != NULL) { 204 if (i2c_id->compat != NULL) {
205 prop_data_t data; 205 prop_data_t data;
206 data = prop_data_create_data(i2c_id->compat, 206 data = prop_data_create_copy(i2c_id->compat,
207 i2c_id->compatlen); 207 i2c_id->compatlen);
208 prop_dictionary_set(dev, "compatible", data); 208 prop_dictionary_set(dev, "compatible", data);
209 prop_object_release(data); 209 prop_object_release(data);
210 } 210 }
211 if (i2c_id->parse != NULL) 211 if (i2c_id->parse != NULL)
212 i2c_id->parse(ad, dev); 212 i2c_id->parse(ad, dev);
213 } 213 }
214 prop_array_add(array, dev); 214 prop_array_add(array, dev);
215 prop_object_release(dev); 215 prop_object_release(dev);
216} 216}
217 217
218 218
219prop_array_t 219prop_array_t

cvs diff -r1.31 -r1.32 src/sys/dev/bluetooth/bthidev.c (expand / switch to unified diff)

--- src/sys/dev/bluetooth/bthidev.c 2018/11/15 23:01:45 1.31
+++ src/sys/dev/bluetooth/bthidev.c 2020/06/11 02:39:31 1.32
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bthidev.c,v 1.31 2018/11/15 23:01:45 jakllsch Exp $ */ 1/* $NetBSD: bthidev.c,v 1.32 2020/06/11 02:39:31 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: bthidev.c,v 1.31 2018/11/15 23:01:45 jakllsch Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.32 2020/06/11 02:39:31 thorpej Exp $");
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/condvar.h> 38#include <sys/condvar.h>
39#include <sys/conf.h> 39#include <sys/conf.h>
40#include <sys/device.h> 40#include <sys/device.h>
41#include <sys/fcntl.h> 41#include <sys/fcntl.h>
42#include <sys/kernel.h> 42#include <sys/kernel.h>
43#include <sys/kthread.h> 43#include <sys/kthread.h>
44#include <sys/queue.h> 44#include <sys/queue.h>
45#include <sys/malloc.h> 45#include <sys/malloc.h>
46#include <sys/mbuf.h> 46#include <sys/mbuf.h>
47#include <sys/mutex.h> 47#include <sys/mutex.h>
48#include <sys/proc.h> 48#include <sys/proc.h>
@@ -162,27 +162,27 @@ static const struct btproto bthidev_int_ @@ -162,27 +162,27 @@ static const struct btproto bthidev_int_
162 162
163/***************************************************************************** 163/*****************************************************************************
164 * 164 *
165 * bthidev autoconf(9) routines 165 * bthidev autoconf(9) routines
166 */ 166 */
167 167
168static int 168static int
169bthidev_match(device_t self, cfdata_t cfdata, void *aux) 169bthidev_match(device_t self, cfdata_t cfdata, void *aux)
170{ 170{
171 prop_dictionary_t dict = aux; 171 prop_dictionary_t dict = aux;
172 prop_object_t obj; 172 prop_object_t obj;
173 173
174 obj = prop_dictionary_get(dict, BTDEVservice); 174 obj = prop_dictionary_get(dict, BTDEVservice);
175 if (prop_string_equals_cstring(obj, "HID")) 175 if (prop_string_equals_string(obj, "HID"))
176 return 1; 176 return 1;
177 177
178 return 0; 178 return 0;
179} 179}
180 180
181static void 181static void
182bthidev_attach(device_t parent, device_t self, void *aux) 182bthidev_attach(device_t parent, device_t self, void *aux)
183{ 183{
184 struct bthidev_softc *sc = device_private(self); 184 struct bthidev_softc *sc = device_private(self);
185 prop_dictionary_t dict = aux; 185 prop_dictionary_t dict = aux;
186 prop_object_t obj; 186 prop_object_t obj;
187 device_t dev; 187 device_t dev;
188 struct bthidev_attach_args bha; 188 struct bthidev_attach_args bha;
@@ -206,77 +206,77 @@ bthidev_attach(device_t parent, device_t @@ -206,77 +206,77 @@ bthidev_attach(device_t parent, device_t
206 sc->sc_state = BTHID_CLOSED; 206 sc->sc_state = BTHID_CLOSED;
207 sc->sc_flags = BTHID_CONNECTING; 207 sc->sc_flags = BTHID_CONNECTING;
208 sc->sc_ctlpsm = L2CAP_PSM_HID_CNTL; 208 sc->sc_ctlpsm = L2CAP_PSM_HID_CNTL;
209 sc->sc_intpsm = L2CAP_PSM_HID_INTR; 209 sc->sc_intpsm = L2CAP_PSM_HID_INTR;
210 210
211 sockopt_init(&sc->sc_mode, BTPROTO_L2CAP, SO_L2CAP_LM, 0); 211 sockopt_init(&sc->sc_mode, BTPROTO_L2CAP, SO_L2CAP_LM, 0);
212 mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE); 212 mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
213 cv_init(&sc->sc_cv, device_xname(self)); 213 cv_init(&sc->sc_cv, device_xname(self));
214 214
215 /* 215 /*
216 * extract config from proplist 216 * extract config from proplist
217 */ 217 */
218 obj = prop_dictionary_get(dict, BTDEVladdr); 218 obj = prop_dictionary_get(dict, BTDEVladdr);
219 bdaddr_copy(&sc->sc_laddr, prop_data_data_nocopy(obj)); 219 bdaddr_copy(&sc->sc_laddr, prop_data_value(obj));
220 220
221 obj = prop_dictionary_get(dict, BTDEVraddr); 221 obj = prop_dictionary_get(dict, BTDEVraddr);
222 bdaddr_copy(&sc->sc_raddr, prop_data_data_nocopy(obj)); 222 bdaddr_copy(&sc->sc_raddr, prop_data_value(obj));
223 223
224 obj = prop_dictionary_get(dict, BTDEVvendor); 224 obj = prop_dictionary_get(dict, BTDEVvendor);
225 vendor = (int)prop_number_integer_value(obj); 225 vendor = (int)prop_number_signed_value(obj);
226 226
227 obj = prop_dictionary_get(dict, BTDEVproduct); 227 obj = prop_dictionary_get(dict, BTDEVproduct);
228 product = (int)prop_number_integer_value(obj); 228 product = (int)prop_number_signed_value(obj);
229 229
230 obj = prop_dictionary_get(dict, BTDEVmode); 230 obj = prop_dictionary_get(dict, BTDEVmode);
231 if (prop_object_type(obj) == PROP_TYPE_STRING) { 231 if (prop_object_type(obj) == PROP_TYPE_STRING) {
232 if (prop_string_equals_cstring(obj, BTDEVauth)) 232 if (prop_string_equals_string(obj, BTDEVauth))
233 sockopt_setint(&sc->sc_mode, L2CAP_LM_AUTH); 233 sockopt_setint(&sc->sc_mode, L2CAP_LM_AUTH);
234 else if (prop_string_equals_cstring(obj, BTDEVencrypt)) 234 else if (prop_string_equals_string(obj, BTDEVencrypt))
235 sockopt_setint(&sc->sc_mode, L2CAP_LM_ENCRYPT); 235 sockopt_setint(&sc->sc_mode, L2CAP_LM_ENCRYPT);
236 else if (prop_string_equals_cstring(obj, BTDEVsecure)) 236 else if (prop_string_equals_string(obj, BTDEVsecure))
237 sockopt_setint(&sc->sc_mode, L2CAP_LM_SECURE); 237 sockopt_setint(&sc->sc_mode, L2CAP_LM_SECURE);
238 else { 238 else {
239 aprint_error(" unknown %s\n", BTDEVmode); 239 aprint_error(" unknown %s\n", BTDEVmode);
240 return; 240 return;
241 } 241 }
242 242
243 aprint_verbose(" %s %s", BTDEVmode, 243 aprint_verbose(" %s %s", BTDEVmode,
244 prop_string_cstring_nocopy(obj)); 244 prop_string_value(obj));
245 } else 245 } else
246 sockopt_setint(&sc->sc_mode, 0); 246 sockopt_setint(&sc->sc_mode, 0);
247 247
248 obj = prop_dictionary_get(dict, BTHIDEVcontrolpsm); 248 obj = prop_dictionary_get(dict, BTHIDEVcontrolpsm);
249 if (prop_object_type(obj) == PROP_TYPE_NUMBER) { 249 if (prop_object_type(obj) == PROP_TYPE_NUMBER) {
250 sc->sc_ctlpsm = prop_number_integer_value(obj); 250 sc->sc_ctlpsm = prop_number_signed_value(obj);
251 if (L2CAP_PSM_INVALID(sc->sc_ctlpsm)) { 251 if (L2CAP_PSM_INVALID(sc->sc_ctlpsm)) {
252 aprint_error(" invalid %s\n", BTHIDEVcontrolpsm); 252 aprint_error(" invalid %s\n", BTHIDEVcontrolpsm);
253 return; 253 return;
254 } 254 }
255 } 255 }
256 256
257 obj = prop_dictionary_get(dict, BTHIDEVinterruptpsm); 257 obj = prop_dictionary_get(dict, BTHIDEVinterruptpsm);
258 if (prop_object_type(obj) == PROP_TYPE_NUMBER) { 258 if (prop_object_type(obj) == PROP_TYPE_NUMBER) {
259 sc->sc_intpsm = prop_number_integer_value(obj); 259 sc->sc_intpsm = prop_number_signed_value(obj);
260 if (L2CAP_PSM_INVALID(sc->sc_intpsm)) { 260 if (L2CAP_PSM_INVALID(sc->sc_intpsm)) {
261 aprint_error(" invalid %s\n", BTHIDEVinterruptpsm); 261 aprint_error(" invalid %s\n", BTHIDEVinterruptpsm);
262 return; 262 return;
263 } 263 }
264 } 264 }
265 265
266 obj = prop_dictionary_get(dict, BTHIDEVdescriptor); 266 obj = prop_dictionary_get(dict, BTHIDEVdescriptor);
267 if (prop_object_type(obj) == PROP_TYPE_DATA) { 267 if (prop_object_type(obj) == PROP_TYPE_DATA) {
268 dlen = prop_data_size(obj); 268 dlen = prop_data_size(obj);
269 desc = prop_data_data_nocopy(obj); 269 desc = prop_data_value(obj);
270 } else { 270 } else {
271 aprint_error(" no %s\n", BTHIDEVdescriptor); 271 aprint_error(" no %s\n", BTHIDEVdescriptor);
272 return; 272 return;
273 } 273 }
274 274
275 obj = prop_dictionary_get(dict, BTHIDEVreconnect); 275 obj = prop_dictionary_get(dict, BTHIDEVreconnect);
276 if (prop_object_type(obj) == PROP_TYPE_BOOL 276 if (prop_object_type(obj) == PROP_TYPE_BOOL
277 && !prop_bool_true(obj)) 277 && !prop_bool_true(obj))
278 sc->sc_flags |= BTHID_RECONNECT; 278 sc->sc_flags |= BTHID_RECONNECT;
279 279
280 /* 280 /*
281 * Parse the descriptor and attach child devices, one per report. 281 * Parse the descriptor and attach child devices, one per report.
282 */ 282 */

cvs diff -r1.23 -r1.24 src/sys/dev/bluetooth/bthub.c (expand / switch to unified diff)

--- src/sys/dev/bluetooth/bthub.c 2020/06/08 20:20:54 1.23
+++ src/sys/dev/bluetooth/bthub.c 2020/06/11 02:39:31 1.24
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bthub.c,v 1.23 2020/06/08 20:20:54 thorpej Exp $ */ 1/* $NetBSD: bthub.c,v 1.24 2020/06/11 02:39:31 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.23 2020/06/08 20:20:54 thorpej Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: bthub.c,v 1.24 2020/06/11 02:39:31 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>
@@ -195,27 +195,27 @@ bthub_pioctl(dev_t devno, unsigned long  @@ -195,27 +195,27 @@ bthub_pioctl(dev_t devno, unsigned long
195 self = device_lookup(&bthub_cd, unit); 195 self = device_lookup(&bthub_cd, unit);
196 if (self == NULL) 196 if (self == NULL)
197 continue; 197 continue;
198 198
199 prop = device_properties(self); 199 prop = device_properties(self);
200 obj = prop_dictionary_get(prop, BTDEVladdr); 200 obj = prop_dictionary_get(prop, BTDEVladdr);
201 if (prop_data_equals(laddr, obj)) 201 if (prop_data_equals(laddr, obj))
202 break; 202 break;
203 } 203 }
204 204
205 /* validate remote address */ 205 /* validate remote address */
206 raddr = prop_dictionary_get(dict, BTDEVraddr); 206 raddr = prop_dictionary_get(dict, BTDEVraddr);
207 if (prop_data_size(raddr) != sizeof(bdaddr_t) 207 if (prop_data_size(raddr) != sizeof(bdaddr_t)
208 || bdaddr_any(prop_data_data_nocopy(raddr))) 208 || bdaddr_any(prop_data_value(raddr)))
209 return EINVAL; 209 return EINVAL;
210 210
211 /* validate service name */ 211 /* validate service name */
212 service = prop_dictionary_get(dict, BTDEVservice); 212 service = prop_dictionary_get(dict, BTDEVservice);
213 if (prop_object_type(service) != PROP_TYPE_STRING) 213 if (prop_object_type(service) != PROP_TYPE_STRING)
214 return EINVAL; 214 return EINVAL;
215 215
216 /* locate matching child device, if any */ 216 /* locate matching child device, if any */
217 deviter_init(&di, 0); 217 deviter_init(&di, 0);
218 while ((dev = deviter_next(&di)) != NULL) { 218 while ((dev = deviter_next(&di)) != NULL) {
219 if (device_parent(dev) != self) 219 if (device_parent(dev) != self)
220 continue; 220 continue;
221 221
@@ -259,26 +259,26 @@ bthub_pioctl(dev_t devno, unsigned long  @@ -259,26 +259,26 @@ bthub_pioctl(dev_t devno, unsigned long
259 return 0; 259 return 0;
260} 260}
261 261
262static int 262static int
263bthub_print(void *aux, const char *pnp) 263bthub_print(void *aux, const char *pnp)
264{ 264{
265 prop_dictionary_t dict = aux; 265 prop_dictionary_t dict = aux;
266 prop_object_t obj; 266 prop_object_t obj;
267 const bdaddr_t *raddr; 267 const bdaddr_t *raddr;
268 268
269 if (pnp != NULL) { 269 if (pnp != NULL) {
270 obj = prop_dictionary_get(dict, BTDEVtype); 270 obj = prop_dictionary_get(dict, BTDEVtype);
271 aprint_normal("%s: %s '%s',", pnp, BTDEVtype, 271 aprint_normal("%s: %s '%s',", pnp, BTDEVtype,
272 prop_string_cstring_nocopy(obj)); 272 prop_string_value(obj));
273 } 273 }
274 274
275 obj = prop_dictionary_get(dict, BTDEVraddr); 275 obj = prop_dictionary_get(dict, BTDEVraddr);
276 raddr = prop_data_data_nocopy(obj); 276 raddr = prop_data_value(obj);
277 277
278 aprint_verbose(" %s %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x", 278 aprint_verbose(" %s %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x",
279 BTDEVraddr, 279 BTDEVraddr,
280 raddr->b[5], raddr->b[4], raddr->b[3], 280 raddr->b[5], raddr->b[4], raddr->b[3],
281 raddr->b[2], raddr->b[1], raddr->b[0]); 281 raddr->b[2], raddr->b[1], raddr->b[0]);
282 282
283 return UNCONF; 283 return UNCONF;
284} 284}

cvs diff -r1.18 -r1.19 src/sys/dev/bluetooth/btmagic.c (expand / switch to unified diff)

--- src/sys/dev/bluetooth/btmagic.c 2018/09/03 16:29:30 1.18
+++ src/sys/dev/bluetooth/btmagic.c 2020/06/11 02:39:31 1.19
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: btmagic.c,v 1.18 2018/09/03 16:29:30 riastradh Exp $ */ 1/* $NetBSD: btmagic.c,v 1.19 2020/06/11 02:39:31 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2010 The NetBSD Foundation, Inc. 4 * Copyright (c) 2010 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 Iain Hibbert. 8 * by Iain Hibbert.
9 * 9 *
10 * This code is derived from software contributed to The NetBSD Foundation 10 * This code is derived from software contributed to The NetBSD Foundation
11 * by Lennart Augustsson (lennart@augustsson.net) at 11 * by Lennart Augustsson (lennart@augustsson.net) at
12 * Carlstedt Research & Technology. 12 * Carlstedt Research & Technology.
13 * 13 *
14 * Redistribution and use in source and binary forms, with or without 14 * Redistribution and use in source and binary forms, with or without
@@ -75,27 +75,27 @@ @@ -75,27 +75,27 @@
75 * for such complications. 75 * for such complications.
76 * 76 *
77 * This driver interprets the touch reports only as far as emulating a 77 * This driver interprets the touch reports only as far as emulating a
78 * middle mouse button and providing horizontal and vertical scroll action. 78 * middle mouse button and providing horizontal and vertical scroll action.
79 * Full gesture support would be more complicated and is left as an exercise 79 * Full gesture support would be more complicated and is left as an exercise
80 * for the reader. 80 * for the reader.
81 * 81 *
82 * Credit for decoding the proprietary touch reports goes to Michael Poole 82 * Credit for decoding the proprietary touch reports goes to Michael Poole
83 * who wrote the Linux hid-magicmouse input driver. 83 * who wrote the Linux hid-magicmouse input driver.
84 * 84 *
85 *****************************************************************************/ 85 *****************************************************************************/
86 86
87#include <sys/cdefs.h> 87#include <sys/cdefs.h>
88__KERNEL_RCSID(0, "$NetBSD: btmagic.c,v 1.18 2018/09/03 16:29:30 riastradh Exp $"); 88__KERNEL_RCSID(0, "$NetBSD: btmagic.c,v 1.19 2020/06/11 02:39:31 thorpej Exp $");
89 89
90#include <sys/param.h> 90#include <sys/param.h>
91#include <sys/conf.h> 91#include <sys/conf.h>
92#include <sys/device.h> 92#include <sys/device.h>
93#include <sys/fcntl.h> 93#include <sys/fcntl.h>
94#include <sys/kernel.h> 94#include <sys/kernel.h>
95#include <sys/malloc.h> 95#include <sys/malloc.h>
96#include <sys/mbuf.h> 96#include <sys/mbuf.h>
97#include <sys/proc.h> 97#include <sys/proc.h>
98#include <sys/socketvar.h> 98#include <sys/socketvar.h>
99#include <sys/systm.h> 99#include <sys/systm.h>
100#include <sys/sysctl.h> 100#include <sys/sysctl.h>
101 101
@@ -301,46 +301,46 @@ btmagic_attach(device_t parent, device_t @@ -301,46 +301,46 @@ btmagic_attach(device_t parent, device_t
301 sc->sc_state = BTMAGIC_CLOSED; 301 sc->sc_state = BTMAGIC_CLOSED;
302 sc->sc_mb_id = -1; 302 sc->sc_mb_id = -1;
303 sc->sc_tapmb_id = -1; 303 sc->sc_tapmb_id = -1;
304 callout_init(&sc->sc_timeout, 0); 304 callout_init(&sc->sc_timeout, 0);
305 callout_setfunc(&sc->sc_timeout, btmagic_timeout, sc); 305 callout_setfunc(&sc->sc_timeout, btmagic_timeout, sc);
306 callout_init(&sc->sc_tapcallout, 0); 306 callout_init(&sc->sc_tapcallout, 0);
307 callout_setfunc(&sc->sc_tapcallout, btmagic_tapcallout, sc); 307 callout_setfunc(&sc->sc_tapcallout, btmagic_tapcallout, sc);
308 sockopt_init(&sc->sc_mode, BTPROTO_L2CAP, SO_L2CAP_LM, 0); 308 sockopt_init(&sc->sc_mode, BTPROTO_L2CAP, SO_L2CAP_LM, 0);
309 309
310 /* 310 /*
311 * extract config from proplist 311 * extract config from proplist
312 */ 312 */
313 obj = prop_dictionary_get(aux, BTDEVladdr); 313 obj = prop_dictionary_get(aux, BTDEVladdr);
314 bdaddr_copy(&sc->sc_laddr, prop_data_data_nocopy(obj)); 314 bdaddr_copy(&sc->sc_laddr, prop_data_value(obj));
315 315
316 obj = prop_dictionary_get(aux, BTDEVraddr); 316 obj = prop_dictionary_get(aux, BTDEVraddr);
317 bdaddr_copy(&sc->sc_raddr, prop_data_data_nocopy(obj)); 317 bdaddr_copy(&sc->sc_raddr, prop_data_value(obj));
318 318
319 obj = prop_dictionary_get(aux, BTDEVmode); 319 obj = prop_dictionary_get(aux, BTDEVmode);
320 if (prop_object_type(obj) == PROP_TYPE_STRING) { 320 if (prop_object_type(obj) == PROP_TYPE_STRING) {
321 if (prop_string_equals_cstring(obj, BTDEVauth)) 321 if (prop_string_equals_string(obj, BTDEVauth))
322 sockopt_setint(&sc->sc_mode, L2CAP_LM_AUTH); 322 sockopt_setint(&sc->sc_mode, L2CAP_LM_AUTH);
323 else if (prop_string_equals_cstring(obj, BTDEVencrypt)) 323 else if (prop_string_equals_string(obj, BTDEVencrypt))
324 sockopt_setint(&sc->sc_mode, L2CAP_LM_ENCRYPT); 324 sockopt_setint(&sc->sc_mode, L2CAP_LM_ENCRYPT);
325 else if (prop_string_equals_cstring(obj, BTDEVsecure)) 325 else if (prop_string_equals_string(obj, BTDEVsecure))
326 sockopt_setint(&sc->sc_mode, L2CAP_LM_SECURE); 326 sockopt_setint(&sc->sc_mode, L2CAP_LM_SECURE);
327 else { 327 else {
328 aprint_error(" unknown %s\n", BTDEVmode); 328 aprint_error(" unknown %s\n", BTDEVmode);
329 return; 329 return;
330 } 330 }
331 331
332 aprint_verbose(" %s %s", BTDEVmode, 332 aprint_verbose(" %s %s", BTDEVmode,
333 prop_string_cstring_nocopy(obj)); 333 prop_string_value(obj));
334 } else 334 } else
335 sockopt_setint(&sc->sc_mode, 0); 335 sockopt_setint(&sc->sc_mode, 0);
336 336
337 aprint_normal(": 3 buttons, W and Z dirs\n"); 337 aprint_normal(": 3 buttons, W and Z dirs\n");
338 aprint_naive("\n"); 338 aprint_naive("\n");
339 339
340 /* 340 /*
341 * set defaults 341 * set defaults
342 */ 342 */
343 sc->sc_resolution = 650; 343 sc->sc_resolution = 650;
344 sc->sc_firm = 6; 344 sc->sc_firm = 6;
345 sc->sc_dist = 130; 345 sc->sc_dist = 130;
346 sc->sc_scale = 20; 346 sc->sc_scale = 20;

cvs diff -r1.41 -r1.42 src/sys/dev/bluetooth/btsco.c (expand / switch to unified diff)

--- src/sys/dev/bluetooth/btsco.c 2019/06/08 08:02:38 1.41
+++ src/sys/dev/bluetooth/btsco.c 2020/06/11 02:39:31 1.42
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: btsco.c,v 1.41 2019/06/08 08:02:38 isaki Exp $ */ 1/* $NetBSD: btsco.c,v 1.42 2020/06/11 02:39:31 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: btsco.c,v 1.41 2019/06/08 08:02:38 isaki Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: btsco.c,v 1.42 2020/06/11 02:39:31 thorpej Exp $");
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/audioio.h> 38#include <sys/audioio.h>
39#include <sys/conf.h> 39#include <sys/conf.h>
40#include <sys/device.h> 40#include <sys/device.h>
41#include <sys/fcntl.h> 41#include <sys/fcntl.h>
42#include <sys/kernel.h> 42#include <sys/kernel.h>
43#include <sys/queue.h> 43#include <sys/queue.h>
44#include <sys/kmem.h> 44#include <sys/kmem.h>
45#include <sys/mbuf.h> 45#include <sys/mbuf.h>
46#include <sys/proc.h> 46#include <sys/proc.h>
47#include <sys/socketvar.h> 47#include <sys/socketvar.h>
48#include <sys/systm.h> 48#include <sys/systm.h>
@@ -248,75 +248,75 @@ static void btsco_intr(void *); @@ -248,75 +248,75 @@ static void btsco_intr(void *);
248 248
249/***************************************************************************** 249/*****************************************************************************
250 * 250 *
251 * btsco autoconf(9) routines 251 * btsco autoconf(9) routines
252 */ 252 */
253 253
254static int 254static int
255btsco_match(device_t self, cfdata_t cfdata, void *aux) 255btsco_match(device_t self, cfdata_t cfdata, void *aux)
256{ 256{
257 prop_dictionary_t dict = aux; 257 prop_dictionary_t dict = aux;
258 prop_object_t obj; 258 prop_object_t obj;
259 259
260 obj = prop_dictionary_get(dict, BTDEVservice); 260 obj = prop_dictionary_get(dict, BTDEVservice);
261 if (prop_string_equals_cstring(obj, "HSET")) 261 if (prop_string_equals_string(obj, "HSET"))
262 return 1; 262 return 1;
263 263
264 if (prop_string_equals_cstring(obj, "HF")) 264 if (prop_string_equals_string(obj, "HF"))
265 return 1; 265 return 1;
266 266
267 return 0; 267 return 0;
268} 268}
269 269
270static void 270static void
271btsco_attach(device_t parent, device_t self, void *aux) 271btsco_attach(device_t parent, device_t self, void *aux)
272{ 272{
273 struct btsco_softc *sc = device_private(self); 273 struct btsco_softc *sc = device_private(self);
274 prop_dictionary_t dict = aux; 274 prop_dictionary_t dict = aux;
275 prop_object_t obj; 275 prop_object_t obj;
276 276
277 /* 277 /*
278 * Init softc 278 * Init softc
279 */ 279 */
280 sc->sc_vgs = 200; 280 sc->sc_vgs = 200;
281 sc->sc_vgm = 200; 281 sc->sc_vgm = 200;
282 sc->sc_state = BTSCO_CLOSED; 282 sc->sc_state = BTSCO_CLOSED;
283 sc->sc_name = device_xname(self); 283 sc->sc_name = device_xname(self);
284 cv_init(&sc->sc_connect, "connect"); 284 cv_init(&sc->sc_connect, "connect");
285 mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE); 285 mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
286 286
287 /* 287 /*
288 * copy in our configuration info 288 * copy in our configuration info
289 */ 289 */
290 obj = prop_dictionary_get(dict, BTDEVladdr); 290 obj = prop_dictionary_get(dict, BTDEVladdr);
291 bdaddr_copy(&sc->sc_laddr, prop_data_data_nocopy(obj)); 291 bdaddr_copy(&sc->sc_laddr, prop_data_value(obj));
292 292
293 obj = prop_dictionary_get(dict, BTDEVraddr); 293 obj = prop_dictionary_get(dict, BTDEVraddr);
294 bdaddr_copy(&sc->sc_raddr, prop_data_data_nocopy(obj)); 294 bdaddr_copy(&sc->sc_raddr, prop_data_value(obj));
295 295
296 obj = prop_dictionary_get(dict, BTDEVservice); 296 obj = prop_dictionary_get(dict, BTDEVservice);
297 if (prop_string_equals_cstring(obj, "HF")) { 297 if (prop_string_equals_string(obj, "HF")) {
298 sc->sc_flags |= BTSCO_LISTEN; 298 sc->sc_flags |= BTSCO_LISTEN;
299 aprint_verbose(" listen mode"); 299 aprint_verbose(" listen mode");
300 } 300 }
301 301
302 obj = prop_dictionary_get(dict, BTSCOchannel); 302 obj = prop_dictionary_get(dict, BTSCOchannel);
303 if (prop_object_type(obj) != PROP_TYPE_NUMBER 303 if (prop_object_type(obj) != PROP_TYPE_NUMBER
304 || prop_number_integer_value(obj) < RFCOMM_CHANNEL_MIN 304 || prop_number_signed_value(obj) < RFCOMM_CHANNEL_MIN
305 || prop_number_integer_value(obj) > RFCOMM_CHANNEL_MAX) { 305 || prop_number_signed_value(obj) > RFCOMM_CHANNEL_MAX) {
306 aprint_error(" invalid %s", BTSCOchannel); 306 aprint_error(" invalid %s", BTSCOchannel);
307 return; 307 return;
308 } 308 }
309 sc->sc_channel = prop_number_integer_value(obj); 309 sc->sc_channel = prop_number_signed_value(obj);
310 310
311 aprint_verbose(" channel %d", sc->sc_channel); 311 aprint_verbose(" channel %d", sc->sc_channel);
312 aprint_normal("\n"); 312 aprint_normal("\n");
313 313
314 DPRINTF("sc=%p\n", sc); 314 DPRINTF("sc=%p\n", sc);
315 315
316 /* 316 /*
317 * set up transmit interrupt 317 * set up transmit interrupt
318 */ 318 */
319 sc->sc_intr = softint_establish(SOFTINT_NET, btsco_intr, sc); 319 sc->sc_intr = softint_establish(SOFTINT_NET, btsco_intr, sc);
320 if (sc->sc_intr == NULL) { 320 if (sc->sc_intr == NULL) {
321 aprint_error_dev(self, "softint_establish failed\n"); 321 aprint_error_dev(self, "softint_establish failed\n");
322 return; 322 return;

cvs diff -r1.33 -r1.34 src/sys/dev/fdt/fdtbus.c (expand / switch to unified diff)

--- src/sys/dev/fdt/fdtbus.c 2020/02/20 01:35:55 1.33
+++ src/sys/dev/fdt/fdtbus.c 2020/06/11 02:39:30 1.34
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fdtbus.c,v 1.33 2020/02/20 01:35:55 jmcneill Exp $ */ 1/* $NetBSD: fdtbus.c,v 1.34 2020/06/11 02:39:30 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.33 2020/02/20 01:35:55 jmcneill Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.34 2020/06/11 02:39:30 thorpej Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/systm.h> 33#include <sys/systm.h>
34#include <sys/device.h> 34#include <sys/device.h>
35#include <sys/kmem.h> 35#include <sys/kmem.h>
36#include <sys/cpu.h> 36#include <sys/cpu.h>
37 37
38#include <sys/bus.h> 38#include <sys/bus.h>
39 39
40#include <dev/ofw/openfirm.h> 40#include <dev/ofw/openfirm.h>
41 41
42#include <dev/fdt/fdtvar.h> 42#include <dev/fdt/fdtvar.h>
43 43
@@ -396,27 +396,27 @@ fdt_scan(struct fdt_softc *sc, int pass) @@ -396,27 +396,27 @@ fdt_scan(struct fdt_softc *sc, int pass)
396 /* 396 /*
397 * Default pass. 397 * Default pass.
398 */ 398 */
399 fdt_pre_attach(node); 399 fdt_pre_attach(node);
400 node->n_dev = config_found_sm_loc(node->n_bus, "fdt", locs, 400 node->n_dev = config_found_sm_loc(node->n_bus, "fdt", locs,
401 &faa, fdtbus_print, fdt_scan_submatch); 401 &faa, fdtbus_print, fdt_scan_submatch);
402 if (node->n_dev != NULL) 402 if (node->n_dev != NULL)
403 fdt_post_attach(node); 403 fdt_post_attach(node);
404 } 404 }
405 405
406 if (node->n_dev) { 406 if (node->n_dev) {
407 dict = device_properties(node->n_dev); 407 dict = device_properties(node->n_dev);
408 if (fdtbus_get_path(node->n_phandle, buf, sizeof(buf))) 408 if (fdtbus_get_path(node->n_phandle, buf, sizeof(buf)))
409 prop_dictionary_set_cstring(dict, "fdt-path", buf); 409 prop_dictionary_set_string(dict, "fdt-path", buf);
410 } 410 }
411 } 411 }
412} 412}
413 413
414static void 414static void
415fdt_pre_attach(struct fdt_node *node) 415fdt_pre_attach(struct fdt_node *node)
416{ 416{
417 const char *cfgname; 417 const char *cfgname;
418 int error; 418 int error;
419 419
420 node->n_pinctrl_init = fdtbus_pinctrl_has_config(node->n_phandle, "init"); 420 node->n_pinctrl_init = fdtbus_pinctrl_has_config(node->n_phandle, "init");
421 421
422 cfgname = node->n_pinctrl_init ? "init" : "default"; 422 cfgname = node->n_pinctrl_init ? "init" : "default";

cvs diff -r1.22 -r1.23 src/sys/dev/hdaudio/hdafg.c (expand / switch to unified diff)

--- src/sys/dev/hdaudio/hdafg.c 2020/04/19 04:13:09 1.22
+++ src/sys/dev/hdaudio/hdafg.c 2020/06/11 02:39:30 1.23
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: hdafg.c,v 1.22 2020/04/19 04:13:09 isaki Exp $ */ 1/* $NetBSD: hdafg.c,v 1.23 2020/06/11 02:39:30 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk> 4 * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk>
5 * Copyright (c) 2009-2011 Jared D. McNeill <jmcneill@invisible.ca> 5 * Copyright (c) 2009-2011 Jared D. McNeill <jmcneill@invisible.ca>
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Precedence Technologies Ltd 9 * by Precedence Technologies Ltd
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
@@ -50,27 +50,27 @@ @@ -50,27 +50,27 @@
50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 52 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE. 59 * SUCH DAMAGE.
60 */ 60 */
61 61
62#include <sys/cdefs.h> 62#include <sys/cdefs.h>
63__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.22 2020/04/19 04:13:09 isaki Exp $"); 63__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.23 2020/06/11 02:39:30 thorpej Exp $");
64 64
65#include <sys/types.h> 65#include <sys/types.h>
66#include <sys/param.h> 66#include <sys/param.h>
67#include <sys/systm.h> 67#include <sys/systm.h>
68#include <sys/kernel.h> 68#include <sys/kernel.h>
69#include <sys/device.h> 69#include <sys/device.h>
70#include <sys/conf.h> 70#include <sys/conf.h>
71#include <sys/bus.h> 71#include <sys/bus.h>
72#include <sys/kmem.h> 72#include <sys/kmem.h>
73#include <sys/module.h> 73#include <sys/module.h>
74 74
75#include <sys/audioio.h> 75#include <sys/audioio.h>
76#include <dev/audio/audio_if.h> 76#include <dev/audio/audio_if.h>
@@ -4361,40 +4361,40 @@ hdafg_widget_info(void *opaque, prop_dic @@ -4361,40 +4361,40 @@ hdafg_widget_info(void *opaque, prop_dic
4361 if (prop_dictionary_get_uint16(request, "index", &index) == false) 4361 if (prop_dictionary_get_uint16(request, "index", &index) == false)
4362 return EINVAL; 4362 return EINVAL;
4363 4363
4364 nid = sc->sc_startnode + index; 4364 nid = sc->sc_startnode + index;
4365 if (nid >= sc->sc_endnode) 4365 if (nid >= sc->sc_endnode)
4366 return EINVAL; 4366 return EINVAL;
4367 4367
4368 w = hdafg_widget_lookup(sc, nid); 4368 w = hdafg_widget_lookup(sc, nid);
4369 if (w == NULL) 4369 if (w == NULL)
4370 return ENXIO; 4370 return ENXIO;
4371 wcap = hda_get_wparam(w, PIN_CAPABILITIES); 4371 wcap = hda_get_wparam(w, PIN_CAPABILITIES);
4372 config = hdaudio_command(sc->sc_codec, w->w_nid, 4372 config = hdaudio_command(sc->sc_codec, w->w_nid,
4373 CORB_GET_CONFIGURATION_DEFAULT, 0); 4373 CORB_GET_CONFIGURATION_DEFAULT, 0);
4374 prop_dictionary_set_cstring_nocopy(response, "name", w->w_name); 4374 prop_dictionary_set_string_nocopy(response, "name", w->w_name);
4375 prop_dictionary_set_bool(response, "enable", w->w_enable); 4375 prop_dictionary_set_bool(response, "enable", w->w_enable);
4376 prop_dictionary_set_uint8(response, "nid", w->w_nid); 4376 prop_dictionary_set_uint8(response, "nid", w->w_nid);
4377 prop_dictionary_set_uint8(response, "type", w->w_type); 4377 prop_dictionary_set_uint8(response, "type", w->w_type);
4378 prop_dictionary_set_uint32(response, "config", config); 4378 prop_dictionary_set_uint32(response, "config", config);
4379 prop_dictionary_set_uint32(response, "cap", wcap); 4379 prop_dictionary_set_uint32(response, "cap", wcap);
4380 if (w->w_nconns == 0) 4380 if (w->w_nconns == 0)
4381 return 0; 4381 return 0;
4382 connlist = prop_array_create(); 4382 connlist = prop_array_create();
4383 for (i = 0; i < w->w_nconns; i++) { 4383 for (i = 0; i < w->w_nconns; i++) {
4384 if (w->w_conns[i] == 0) 4384 if (w->w_conns[i] == 0)
4385 continue; 4385 continue;
4386 prop_array_add(connlist, 4386 prop_array_add_and_rel(connlist,
4387 prop_number_create_unsigned_integer(w->w_conns[i])); 4387 prop_number_create_unsigned(w->w_conns[i]));
4388 } 4388 }
4389 prop_dictionary_set(response, "connlist", connlist); 4389 prop_dictionary_set(response, "connlist", connlist);
4390 prop_object_release(connlist); 4390 prop_object_release(connlist);
4391 return 0; 4391 return 0;
4392} 4392}
4393 4393
4394static int 4394static int
4395hdafg_codec_info(void *opaque, prop_dictionary_t request, 4395hdafg_codec_info(void *opaque, prop_dictionary_t request,
4396 prop_dictionary_t response) 4396 prop_dictionary_t response)
4397{ 4397{
4398 struct hdafg_softc *sc = opaque; 4398 struct hdafg_softc *sc = opaque;
4399 prop_dictionary_set_uint16(response, "vendor-id", 4399 prop_dictionary_set_uint16(response, "vendor-id",
4400 sc->sc_vendor); 4400 sc->sc_vendor);

cvs diff -r1.10 -r1.11 src/sys/dev/hdaudio/hdaudio.c (expand / switch to unified diff)

--- src/sys/dev/hdaudio/hdaudio.c 2020/02/08 00:14:06 1.10
+++ src/sys/dev/hdaudio/hdaudio.c 2020/06/11 02:39:30 1.11
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: hdaudio.c,v 1.10 2020/02/08 00:14:06 jmcneill Exp $ */ 1/* $NetBSD: hdaudio.c,v 1.11 2020/06/11 02:39:30 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk> 4 * Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk>
5 * Copyright (c) 2009 Jared D. McNeill <jmcneill@invisible.ca> 5 * Copyright (c) 2009 Jared D. McNeill <jmcneill@invisible.ca>
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Precedence Technologies Ltd 9 * by Precedence Technologies Ltd
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
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.10 2020/02/08 00:14:06 jmcneill Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.11 2020/06/11 02:39:30 thorpej Exp $");
34 34
35#include <sys/types.h> 35#include <sys/types.h>
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/device.h> 38#include <sys/device.h>
39#include <sys/conf.h> 39#include <sys/conf.h>
40#include <sys/bus.h> 40#include <sys/bus.h>
41#include <sys/kmem.h> 41#include <sys/kmem.h>
42#include <sys/module.h> 42#include <sys/module.h>
43 43
44#include "hdaudiovar.h" 44#include "hdaudiovar.h"
45#include "hdaudioreg.h" 45#include "hdaudioreg.h"
46#include "hdaudioio.h" 46#include "hdaudioio.h"
@@ -1341,41 +1341,41 @@ hdaudioioctl_fgrp_info(struct hdaudio_so @@ -1341,41 +1341,41 @@ hdaudioioctl_fgrp_info(struct hdaudio_so
1341 array = prop_array_create(); 1341 array = prop_array_create();
1342 if (array == NULL) 1342 if (array == NULL)
1343 return ENOMEM; 1343 return ENOMEM;
1344 1344
1345 for (codecid = 0; codecid < HDAUDIO_MAX_CODECS; codecid++) { 1345 for (codecid = 0; codecid < HDAUDIO_MAX_CODECS; codecid++) {
1346 co = &sc->sc_codec[codecid]; 1346 co = &sc->sc_codec[codecid];
1347 if (co->co_valid == false) 1347 if (co->co_valid == false)
1348 continue; 1348 continue;
1349 for (fgid = 0; fgid < co->co_nfg; fgid++) { 1349 for (fgid = 0; fgid < co->co_nfg; fgid++) {
1350 fg = &co->co_fg[fgid]; 1350 fg = &co->co_fg[fgid];
1351 dict = prop_dictionary_create(); 1351 dict = prop_dictionary_create();
1352 if (dict == NULL) 1352 if (dict == NULL)
1353 return ENOMEM; 1353 return ENOMEM;
1354 prop_dictionary_set_cstring_nocopy(dict, 1354 prop_dictionary_set_string_nocopy(dict,
1355 "type", hdaudioioctl_fgrp_to_cstr(fg->fg_type)); 1355 "type", hdaudioioctl_fgrp_to_cstr(fg->fg_type));
1356 prop_dictionary_set_int16(dict, "nid", fg->fg_nid); 1356 prop_dictionary_set_int16(dict, "nid", fg->fg_nid);
1357 prop_dictionary_set_int16(dict, "codecid", codecid); 1357 prop_dictionary_set_int16(dict, "codecid", codecid);
1358 prop_dictionary_set_uint16(dict, "vendor-id", 1358 prop_dictionary_set_uint16(dict, "vendor-id",
1359 fg->fg_vendor); 1359 fg->fg_vendor);
1360 prop_dictionary_set_uint16(dict, "product-id", 1360 prop_dictionary_set_uint16(dict, "product-id",
1361 fg->fg_product); 1361 fg->fg_product);
1362 prop_dictionary_set_uint32(dict, "subsystem-id", 1362 prop_dictionary_set_uint32(dict, "subsystem-id",
1363 sc->sc_subsystem); 1363 sc->sc_subsystem);
1364 if (fg->fg_device) 1364 if (fg->fg_device)
1365 prop_dictionary_set_cstring(dict, "device", 1365 prop_dictionary_set_string(dict, "device",
1366 device_xname(fg->fg_device)); 1366 device_xname(fg->fg_device));
1367 else 1367 else
1368 prop_dictionary_set_cstring_nocopy(dict, 1368 prop_dictionary_set_string_nocopy(dict,
1369 "device", "<none>"); 1369 "device", "<none>");
1370 prop_array_add(array, dict); 1370 prop_array_add(array, dict);
1371 } 1371 }
1372 } 1372 }
1373 1373
1374 prop_dictionary_set(response, "function-group-info", array); 1374 prop_dictionary_set(response, "function-group-info", array);
1375 return 0; 1375 return 0;
1376} 1376}
1377 1377
1378static int 1378static int
1379hdaudioioctl_fgrp_getconfig(struct hdaudio_softc *sc, 1379hdaudioioctl_fgrp_getconfig(struct hdaudio_softc *sc,
1380 prop_dictionary_t request, prop_dictionary_t response) 1380 prop_dictionary_t request, prop_dictionary_t response)
1381{ 1381{

cvs diff -r1.72 -r1.73 src/sys/dev/i2c/i2c.c (expand / switch to unified diff)

--- src/sys/dev/i2c/i2c.c 2019/12/23 18:27:11 1.72
+++ src/sys/dev/i2c/i2c.c 2020/06/11 02:39:30 1.73
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: i2c.c,v 1.72 2019/12/23 18:27:11 thorpej Exp $ */ 1/* $NetBSD: i2c.c,v 1.73 2020/06/11 02:39:30 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2003 Wasabi Systems, Inc. 4 * Copyright (c) 2003 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 7 * Written by Jason R. Thorpe for Wasabi Systems, 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
@@ -30,27 +30,27 @@ @@ -30,27 +30,27 @@
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 35 * POSSIBILITY OF SUCH DAMAGE.
36 */ 36 */
37 37
38#ifdef _KERNEL_OPT 38#ifdef _KERNEL_OPT
39#include "opt_i2c.h" 39#include "opt_i2c.h"
40#endif 40#endif
41 41
42#include <sys/cdefs.h> 42#include <sys/cdefs.h>
43__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.72 2019/12/23 18:27:11 thorpej Exp $"); 43__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.73 2020/06/11 02:39:30 thorpej Exp $");
44 44
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/systm.h> 46#include <sys/systm.h>
47#include <sys/device.h> 47#include <sys/device.h>
48#include <sys/event.h> 48#include <sys/event.h>
49#include <sys/conf.h> 49#include <sys/conf.h>
50#include <sys/malloc.h> 50#include <sys/malloc.h>
51#include <sys/kmem.h> 51#include <sys/kmem.h>
52#include <sys/kthread.h> 52#include <sys/kthread.h>
53#include <sys/proc.h> 53#include <sys/proc.h>
54#include <sys/kernel.h> 54#include <sys/kernel.h>
55#include <sys/fcntl.h> 55#include <sys/fcntl.h>
56#include <sys/module.h> 56#include <sys/module.h>
@@ -221,27 +221,27 @@ iic_indirect_driver_is_whitelisted(struc @@ -221,27 +221,27 @@ iic_indirect_driver_is_whitelisted(struc
221 /* No whitelist -> everything allowed */ 221 /* No whitelist -> everything allowed */
222 return (true); 222 return (true);
223 } 223 }
224 224
225 if ((ptype = prop_object_type(whitelist)) != PROP_TYPE_ARRAY) { 225 if ((ptype = prop_object_type(whitelist)) != PROP_TYPE_ARRAY) {
226 aprint_error_dev(sc->sc_dev, 226 aprint_error_dev(sc->sc_dev,
227 "invalid property type (%d) for '%s'; must be array (%d)\n", 227 "invalid property type (%d) for '%s'; must be array (%d)\n",
228 ptype, I2C_PROP_INDIRECT_DEVICE_WHITELIST, PROP_TYPE_ARRAY); 228 ptype, I2C_PROP_INDIRECT_DEVICE_WHITELIST, PROP_TYPE_ARRAY);
229 return (false); 229 return (false);
230 } 230 }
231 231
232 iter = prop_array_iterator(whitelist); 232 iter = prop_array_iterator(whitelist);
233 while ((pstr = prop_object_iterator_next(iter)) != NULL) { 233 while ((pstr = prop_object_iterator_next(iter)) != NULL) {
234 if (prop_string_equals_cstring(pstr, cf->cf_name)) { 234 if (prop_string_equals_string(pstr, cf->cf_name)) {
235 rv = true; 235 rv = true;
236 break; 236 break;
237 } 237 }
238 } 238 }
239 prop_object_iterator_release(iter); 239 prop_object_iterator_release(iter);
240 240
241 return (rv); 241 return (rv);
242} 242}
243 243
244static int 244static int
245iic_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) 245iic_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
246{ 246{
247 struct iic_softc *sc = device_private(parent); 247 struct iic_softc *sc = device_private(parent);
@@ -255,39 +255,39 @@ iic_search(device_t parent, cfdata_t cf, @@ -255,39 +255,39 @@ iic_search(device_t parent, cfdata_t cf,
255 * Before we do any more work, consult the allowed-driver 255 * Before we do any more work, consult the allowed-driver
256 * white-list for this bus (if any). 256 * white-list for this bus (if any).
257 */ 257 */
258 if (iic_indirect_driver_is_whitelisted(sc, cf) == false) 258 if (iic_indirect_driver_is_whitelisted(sc, cf) == false)
259 return (0); 259 return (0);
260 260
261 /* default to "quick write". */ 261 /* default to "quick write". */
262 probe_func = iic_probe_smbus_quick_write; 262 probe_func = iic_probe_smbus_quick_write;
263 263
264 pstr = prop_dictionary_get(device_properties(sc->sc_dev), 264 pstr = prop_dictionary_get(device_properties(sc->sc_dev),
265 I2C_PROP_INDIRECT_PROBE_STRATEGY); 265 I2C_PROP_INDIRECT_PROBE_STRATEGY);
266 if (pstr == NULL) { 266 if (pstr == NULL) {
267 /* Use the default. */ 267 /* Use the default. */
268 } else if (prop_string_equals_cstring(pstr, 268 } else if (prop_string_equals_string(pstr,
269 I2C_PROBE_STRATEGY_QUICK_WRITE)) { 269 I2C_PROBE_STRATEGY_QUICK_WRITE)) {
270 probe_func = iic_probe_smbus_quick_write; 270 probe_func = iic_probe_smbus_quick_write;
271 } else if (prop_string_equals_cstring(pstr, 271 } else if (prop_string_equals_string(pstr,
272 I2C_PROBE_STRATEGY_RECEIVE_BYTE)) { 272 I2C_PROBE_STRATEGY_RECEIVE_BYTE)) {
273 probe_func = iic_probe_smbus_receive_byte; 273 probe_func = iic_probe_smbus_receive_byte;
274 } else if (prop_string_equals_cstring(pstr, 274 } else if (prop_string_equals_string(pstr,
275 I2C_PROBE_STRATEGY_NONE)) { 275 I2C_PROBE_STRATEGY_NONE)) {
276 probe_func = iic_probe_none; 276 probe_func = iic_probe_none;
277 } else { 277 } else {
278 aprint_error_dev(sc->sc_dev, 278 aprint_error_dev(sc->sc_dev,
279 "unknown probe strategy '%s'; defaulting to '%s'\n", 279 "unknown probe strategy '%s'; defaulting to '%s'\n",
280 prop_string_cstring_nocopy(pstr), 280 prop_string_value(pstr),
281 I2C_PROBE_STRATEGY_QUICK_WRITE); 281 I2C_PROBE_STRATEGY_QUICK_WRITE);
282 282
283 /* Use the default. */ 283 /* Use the default. */
284 } 284 }
285 285
286 ia.ia_tag = sc->sc_tag; 286 ia.ia_tag = sc->sc_tag;
287 287
288 ia.ia_name = NULL; 288 ia.ia_name = NULL;
289 ia.ia_ncompat = 0; 289 ia.ia_ncompat = 0;
290 ia.ia_compat = NULL; 290 ia.ia_compat = NULL;
291 ia.ia_prop = NULL; 291 ia.ia_prop = NULL;
292 292
293 if (cf->cf_loc[IICCF_ADDR] == IICCF_ADDR_DEFAULT) { 293 if (cf->cf_loc[IICCF_ADDR] == IICCF_ADDR_DEFAULT) {
@@ -460,27 +460,27 @@ iic_attach(device_t parent, device_t sel @@ -460,27 +460,27 @@ iic_attach(device_t parent, device_t sel
460 loc[IICCF_ADDR] = addr; 460 loc[IICCF_ADDR] = addr;
461 461
462 memset(&ia, 0, sizeof ia); 462 memset(&ia, 0, sizeof ia);
463 ia.ia_addr = addr; 463 ia.ia_addr = addr;
464 ia.ia_tag = ic; 464 ia.ia_tag = ic;
465 ia.ia_name = name; 465 ia.ia_name = name;
466 ia.ia_cookie = cookie; 466 ia.ia_cookie = cookie;
467 ia.ia_prop = dev; 467 ia.ia_prop = dev;
468 468
469 buf = NULL; 469 buf = NULL;
470 cdata = prop_dictionary_get(dev, "compatible"); 470 cdata = prop_dictionary_get(dev, "compatible");
471 if (cdata) 471 if (cdata)
472 iic_fill_compat(&ia, 472 iic_fill_compat(&ia,
473 prop_data_data_nocopy(cdata), 473 prop_data_value(cdata),
474 prop_data_size(cdata), &buf); 474 prop_data_size(cdata), &buf);
475 475
476 if (name == NULL && cdata == NULL) { 476 if (name == NULL && cdata == NULL) {
477 aprint_error_dev(self, 477 aprint_error_dev(self,
478 "WARNING: ignoring bad child device entry " 478 "WARNING: ignoring bad child device entry "
479 "for address 0x%02x\n", addr); 479 "for address 0x%02x\n", addr);
480 } else { 480 } else {
481 if (addr > I2C_MAX_ADDR) { 481 if (addr > I2C_MAX_ADDR) {
482 aprint_error_dev(self, 482 aprint_error_dev(self,
483 "WARNING: ignoring bad device " 483 "WARNING: ignoring bad device "
484 "address @ 0x%02x\n", addr); 484 "address @ 0x%02x\n", addr);
485 } else if (sc->sc_devices[addr] == NULL) { 485 } else if (sc->sc_devices[addr] == NULL) {
486 sc->sc_devices[addr] = 486 sc->sc_devices[addr] =

cvs diff -r1.34 -r1.35 src/sys/dev/ofw/ofw_subr.c (expand / switch to unified diff)

--- src/sys/dev/ofw/ofw_subr.c 2019/08/06 18:17:52 1.34
+++ src/sys/dev/ofw/ofw_subr.c 2020/06/11 02:39:30 1.35
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ofw_subr.c,v 1.34 2019/08/06 18:17:52 tnn Exp $ */ 1/* $NetBSD: ofw_subr.c,v 1.35 2020/06/11 02:39:30 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright 1998 4 * Copyright 1998
5 * Digital Equipment Corporation. All rights reserved. 5 * Digital Equipment Corporation. All rights reserved.
6 * 6 *
7 * This software is furnished under license and may be used and 7 * This software is furnished under license and may be used and
8 * copied only in accordance with the following terms and conditions. 8 * copied only in accordance with the following terms and conditions.
9 * Subject to these conditions, you may download, copy, install, 9 * Subject to these conditions, you may download, copy, install,
10 * use, modify and distribute this software in source and/or binary 10 * use, modify and distribute this software in source and/or binary
11 * form. No title or ownership is transferred hereby. 11 * form. No title or ownership is transferred hereby.
12 * 12 *
13 * 1) Any source code used, modified or distributed must reproduce 13 * 1) Any source code used, modified or distributed must reproduce
14 * and retain this copyright notice and list of conditions as 14 * and retain this copyright notice and list of conditions as
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * 3) This software is provided "AS-IS" and any express or implied 24 * 3) This software is provided "AS-IS" and any express or implied
25 * warranties, including but not limited to, any implied warranties 25 * warranties, including but not limited to, any implied warranties
26 * of merchantability, fitness for a particular purpose, or 26 * of merchantability, fitness for a particular purpose, or
27 * non-infringement are disclaimed. In no event shall DIGITAL be 27 * non-infringement are disclaimed. In no event shall DIGITAL be
28 * liable for any damages whatsoever, and in particular, DIGITAL 28 * liable for any damages whatsoever, and in particular, DIGITAL
29 * shall not be liable for special, indirect, consequential, or 29 * shall not be liable for special, indirect, consequential, or
30 * incidental damages or damages for lost profits, loss of 30 * incidental damages or damages for lost profits, loss of
31 * revenue or loss of use, whether such damages arise in contract, 31 * revenue or loss of use, whether such damages arise in contract,
32 * negligence, tort, under statute, in equity, at law or otherwise, 32 * negligence, tort, under statute, in equity, at law or otherwise,
33 * even if advised of the possibility of such damage. 33 * even if advised of the possibility of such damage.
34 */ 34 */
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.34 2019/08/06 18:17:52 tnn Exp $"); 37__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.35 2020/06/11 02:39:30 thorpej Exp $");
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/malloc.h> 41#include <sys/malloc.h>
42#include <dev/ofw/openfirm.h> 42#include <dev/ofw/openfirm.h>
43 43
44#define OFW_MAX_STACK_BUF_SIZE 256 44#define OFW_MAX_STACK_BUF_SIZE 256
45#define OFW_PATH_BUF_SIZE 512 45#define OFW_PATH_BUF_SIZE 512
46 46
47/* 47/*
48 * int of_decode_int(p) 48 * int of_decode_int(p)
49 * 49 *
50 * This routine converts OFW encoded-int datums 50 * This routine converts OFW encoded-int datums
@@ -479,27 +479,27 @@ of_enter_i2c_devs(prop_dictionary_t prop @@ -479,27 +479,27 @@ of_enter_i2c_devs(prop_dictionary_t prop
479 < sizeof(reg32)) 479 < sizeof(reg32))
480 continue; 480 continue;
481 addr = be32toh(reg32); 481 addr = be32toh(reg32);
482 } else { 482 } else {
483 continue; 483 continue;
484 } 484 }
485 addr >>= addr_shift; 485 addr >>= addr_shift;
486 if (addr == 0) continue; 486 if (addr == 0) continue;
487 487
488 if (array == NULL) 488 if (array == NULL)
489 array = prop_array_create(); 489 array = prop_array_create();
490 490
491 dev = prop_dictionary_create(); 491 dev = prop_dictionary_create();
492 prop_dictionary_set_cstring(dev, "name", name); 492 prop_dictionary_set_string(dev, "name", name);
493 prop_dictionary_set_uint32(dev, "addr", addr); 493 prop_dictionary_set_uint32(dev, "addr", addr);
494 prop_dictionary_set_uint64(dev, "cookie", node); 494 prop_dictionary_set_uint64(dev, "cookie", node);
495 of_to_dataprop(dev, node, "compatible", "compatible"); 495 of_to_dataprop(dev, node, "compatible", "compatible");
496 prop_array_add(array, dev); 496 prop_array_add(array, dev);
497 prop_object_release(dev); 497 prop_object_release(dev);
498 } 498 }
499 499
500 if (array != NULL) { 500 if (array != NULL) {
501 prop_dictionary_set(props, "i2c-child-devices", array); 501 prop_dictionary_set(props, "i2c-child-devices", array);
502 prop_object_release(array); 502 prop_object_release(array);
503 } 503 }
504} 504}
505 505
@@ -533,27 +533,27 @@ of_enter_spi_devs(prop_dictionary_t prop @@ -533,27 +533,27 @@ of_enter_spi_devs(prop_dictionary_t prop
533 slave = be32toh(reg32); 533 slave = be32toh(reg32);
534 } else { 534 } else {
535 continue; 535 continue;
536 } 536 }
537 if (of_getprop_uint32(node, "spi-max-frequency", &maxfreq)) { 537 if (of_getprop_uint32(node, "spi-max-frequency", &maxfreq)) {
538 maxfreq = 0; 538 maxfreq = 0;
539 } 539 }
540 mode = ((int)of_hasprop(node, "cpol") << 1) | (int)of_hasprop(node, "cpha"); 540 mode = ((int)of_hasprop(node, "cpol") << 1) | (int)of_hasprop(node, "cpha");
541 541
542 if (array == NULL) 542 if (array == NULL)
543 array = prop_array_create(); 543 array = prop_array_create();
544 544
545 dev = prop_dictionary_create(); 545 dev = prop_dictionary_create();
546 prop_dictionary_set_cstring(dev, "name", name); 546 prop_dictionary_set_string(dev, "name", name);
547 prop_dictionary_set_uint32(dev, "slave", slave); 547 prop_dictionary_set_uint32(dev, "slave", slave);
548 prop_dictionary_set_uint32(dev, "mode", mode); 548 prop_dictionary_set_uint32(dev, "mode", mode);
549 if (maxfreq > 0) 549 if (maxfreq > 0)
550 prop_dictionary_set_uint32(dev, "spi-max-frequency", maxfreq); 550 prop_dictionary_set_uint32(dev, "spi-max-frequency", maxfreq);
551 prop_dictionary_set_uint64(dev, "cookie", node); 551 prop_dictionary_set_uint64(dev, "cookie", node);
552 of_to_dataprop(dev, node, "compatible", "compatible"); 552 of_to_dataprop(dev, node, "compatible", "compatible");
553 prop_array_add(array, dev); 553 prop_array_add(array, dev);
554 prop_object_release(dev); 554 prop_object_release(dev);
555 } 555 }
556 556
557 if (array != NULL) { 557 if (array != NULL) {
558 prop_dictionary_set(props, "spi-child-devices", array); 558 prop_dictionary_set(props, "spi-child-devices", array);
559 prop_object_release(array); 559 prop_object_release(array);

cvs diff -r1.66 -r1.67 src/sys/dev/pci/if_ixl.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_ixl.c 2020/05/14 08:34:18 1.66
+++ src/sys/dev/pci/if_ixl.c 2020/06/11 02:39:30 1.67
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_ixl.c,v 1.66 2020/05/14 08:34:18 msaitoh Exp $ */ 1/* $NetBSD: if_ixl.c,v 1.67 2020/06/11 02:39:30 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2013-2015, Intel Corporation 4 * Copyright (c) 2013-2015, Intel Corporation
5 * All rights reserved. 5 * All rights reserved.
6 6
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met: 8 * modification, are permitted provided that the following conditions are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright notice, 10 * 1. Redistributions of source code must retain the above copyright notice,
11 * this list of conditions and the following disclaimer. 11 * this list of conditions and the following disclaimer.
12 * 12 *
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -64,27 +64,27 @@ @@ -64,27 +64,27 @@
64 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 64 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
65 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 65 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
66 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 66 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
67 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 67 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
68 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 68 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
69 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 69 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
70 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 70 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
71 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 71 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
72 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 72 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
73 * POSSIBILITY OF SUCH DAMAGE. 73 * POSSIBILITY OF SUCH DAMAGE.
74 */ 74 */
75 75
76#include <sys/cdefs.h> 76#include <sys/cdefs.h>
77__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.66 2020/05/14 08:34:18 msaitoh Exp $"); 77__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.67 2020/06/11 02:39:30 thorpej Exp $");
78 78
79#ifdef _KERNEL_OPT 79#ifdef _KERNEL_OPT
80#include "opt_net_mpsafe.h" 80#include "opt_net_mpsafe.h"
81#include "opt_if_ixl.h" 81#include "opt_if_ixl.h"
82#endif 82#endif
83 83
84#include <sys/param.h> 84#include <sys/param.h>
85#include <sys/types.h> 85#include <sys/types.h>
86 86
87#include <sys/cpu.h> 87#include <sys/cpu.h>
88#include <sys/device.h> 88#include <sys/device.h>
89#include <sys/evcnt.h> 89#include <sys/evcnt.h>
90#include <sys/interrupt.h> 90#include <sys/interrupt.h>
@@ -7055,37 +7055,37 @@ ixl_parse_modprop(prop_dictionary_t dict @@ -7055,37 +7055,37 @@ ixl_parse_modprop(prop_dictionary_t dict
7055 int64_t val; 7055 int64_t val;
7056 uint64_t uval; 7056 uint64_t uval;
7057 7057
7058 if (dict == NULL) 7058 if (dict == NULL)
7059 return; 7059 return;
7060 7060
7061 obj = prop_dictionary_get(dict, "nomsix"); 7061 obj = prop_dictionary_get(dict, "nomsix");
7062 if (obj != NULL && prop_object_type(obj) == PROP_TYPE_BOOL) { 7062 if (obj != NULL && prop_object_type(obj) == PROP_TYPE_BOOL) {
7063 ixl_param_nomsix = prop_bool_true((prop_bool_t)obj); 7063 ixl_param_nomsix = prop_bool_true((prop_bool_t)obj);
7064 } 7064 }
7065 7065
7066 obj = prop_dictionary_get(dict, "stats_interval"); 7066 obj = prop_dictionary_get(dict, "stats_interval");
7067 if (obj != NULL && prop_object_type(obj) == PROP_TYPE_NUMBER) { 7067 if (obj != NULL && prop_object_type(obj) == PROP_TYPE_NUMBER) {
7068 val = prop_number_integer_value((prop_number_t)obj); 7068 val = prop_number_signed_value((prop_number_t)obj);
7069 7069
7070 /* the range has no reason */ 7070 /* the range has no reason */
7071 if (100 < val && val < 180000) { 7071 if (100 < val && val < 180000) {
7072 ixl_param_stats_interval = val; 7072 ixl_param_stats_interval = val;
7073 } 7073 }
7074 } 7074 }
7075 7075
7076 obj = prop_dictionary_get(dict, "nqps_limit"); 7076 obj = prop_dictionary_get(dict, "nqps_limit");
7077 if (obj != NULL && prop_object_type(obj) == PROP_TYPE_NUMBER) { 7077 if (obj != NULL && prop_object_type(obj) == PROP_TYPE_NUMBER) {
7078 val = prop_number_integer_value((prop_number_t)obj); 7078 val = prop_number_signed_value((prop_number_t)obj);
7079 7079
7080 if (val <= INT32_MAX) 7080 if (val <= INT32_MAX)
7081 ixl_param_nqps_limit = val; 7081 ixl_param_nqps_limit = val;
7082 } 7082 }
7083 7083
7084 obj = prop_dictionary_get(dict, "rx_ndescs"); 7084 obj = prop_dictionary_get(dict, "rx_ndescs");
7085 if (obj != NULL && prop_object_type(obj) == PROP_TYPE_NUMBER) { 7085 if (obj != NULL && prop_object_type(obj) == PROP_TYPE_NUMBER) {
7086 uval = prop_number_unsigned_integer_value((prop_number_t)obj); 7086 uval = prop_number_unsigned_integer_value((prop_number_t)obj);
7087 7087
7088 if (uval > 8) 7088 if (uval > 8)
7089 ixl_param_rx_ndescs = uval; 7089 ixl_param_rx_ndescs = uval;
7090 } 7090 }
7091 7091

cvs diff -r1.120 -r1.121 src/sys/dev/pci/if_tl.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_tl.c 2020/02/28 06:53:22 1.120
+++ src/sys/dev/pci/if_tl.c 2020/06/11 02:39:30 1.121
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_tl.c,v 1.120 2020/02/28 06:53:22 msaitoh Exp $ */ 1/* $NetBSD: if_tl.c,v 1.121 2020/06/11 02:39:30 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1997 Manuel Bouyer. All rights reserved. 4 * Copyright (c) 1997 Manuel Bouyer. 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 *
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27/* 27/*
28 * Texas Instruments ThunderLAN ethernet controller 28 * Texas Instruments ThunderLAN ethernet controller
29 * ThunderLAN Programmer's Guide (TI Literature Number SPWU013A) 29 * ThunderLAN Programmer's Guide (TI Literature Number SPWU013A)
30 * available from www.ti.com 30 * available from www.ti.com
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: if_tl.c,v 1.120 2020/02/28 06:53:22 msaitoh Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: if_tl.c,v 1.121 2020/06/11 02:39:30 thorpej Exp $");
35 35
36#undef TLDEBUG 36#undef TLDEBUG
37#define TL_PRIV_STATS 37#define TL_PRIV_STATS
38#undef TLDEBUG_RX 38#undef TLDEBUG_RX
39#undef TLDEBUG_TX 39#undef TLDEBUG_TX
40#undef TLDEBUG_ADDR 40#undef TLDEBUG_ADDR
41 41
42#include "opt_inet.h" 42#include "opt_inet.h"
43 43
44#include <sys/param.h> 44#include <sys/param.h>
45#include <sys/systm.h> 45#include <sys/systm.h>
46#include <sys/mbuf.h> 46#include <sys/mbuf.h>
47#include <sys/protosw.h> 47#include <sys/protosw.h>
@@ -635,27 +635,27 @@ tl_init(struct ifnet *ifp) @@ -635,27 +635,27 @@ tl_init(struct ifnet *ifp)
635 errstring = "out of memory for lists"; 635 errstring = "out of memory for lists";
636 error = ENOMEM; 636 error = ENOMEM;
637 goto bad; 637 goto bad;
638 } 638 }
639 639
640 /* 640 /*
641 * Some boards (Set Engineering GFE) do not permit DMA transfers 641 * Some boards (Set Engineering GFE) do not permit DMA transfers
642 * across page boundaries. 642 * across page boundaries.
643 */ 643 */
644 prop_boundary = prop_dictionary_get(device_properties(sc->sc_dev), 644 prop_boundary = prop_dictionary_get(device_properties(sc->sc_dev),
645 "tl-dma-page-boundary"); 645 "tl-dma-page-boundary");
646 if (prop_boundary != NULL) { 646 if (prop_boundary != NULL) {
647 KASSERT(prop_object_type(prop_boundary) == PROP_TYPE_NUMBER); 647 KASSERT(prop_object_type(prop_boundary) == PROP_TYPE_NUMBER);
648 boundary = (bus_size_t)prop_number_integer_value(prop_boundary); 648 boundary = (bus_size_t)prop_number_unsigned_value(prop_boundary);
649 } else { 649 } else {
650 boundary = 0; 650 boundary = 0;
651 } 651 }
652 652
653 error = bus_dmamap_create(sc->tl_dmatag, 653 error = bus_dmamap_create(sc->tl_dmatag,
654 sizeof(struct tl_Rx_list) * TL_NBUF, 1, 654 sizeof(struct tl_Rx_list) * TL_NBUF, 1,
655 sizeof(struct tl_Rx_list) * TL_NBUF, 0, BUS_DMA_WAITOK, 655 sizeof(struct tl_Rx_list) * TL_NBUF, 0, BUS_DMA_WAITOK,
656 &sc->Rx_dmamap); 656 &sc->Rx_dmamap);
657 if (error == 0) 657 if (error == 0)
658 error = bus_dmamap_create(sc->tl_dmatag, 658 error = bus_dmamap_create(sc->tl_dmatag,
659 sizeof(struct tl_Tx_list) * TL_NBUF, 1, 659 sizeof(struct tl_Tx_list) * TL_NBUF, 1,
660 sizeof(struct tl_Tx_list) * TL_NBUF, boundary, 660 sizeof(struct tl_Tx_list) * TL_NBUF, boundary,
661 BUS_DMA_WAITOK, &sc->Tx_dmamap); 661 BUS_DMA_WAITOK, &sc->Tx_dmamap);

cvs diff -r1.676 -r1.677 src/sys/dev/pci/if_wm.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_wm.c 2020/04/30 03:42:10 1.676
+++ src/sys/dev/pci/if_wm.c 2020/06/11 02:39:30 1.677
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_wm.c,v 1.676 2020/04/30 03:42:10 riastradh Exp $ */ 1/* $NetBSD: if_wm.c,v 1.677 2020/06/11 02:39:30 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. 4 * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 7 * Written by Jason R. Thorpe for Wasabi Systems, 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
@@ -72,27 +72,27 @@ @@ -72,27 +72,27 @@
72 * 72 *
73 * TODO (in order of importance): 73 * TODO (in order of importance):
74 * 74 *
75 * - Check XXX'ed comments 75 * - Check XXX'ed comments
76 * - TX Multi queue improvement (refine queue selection logic) 76 * - TX Multi queue improvement (refine queue selection logic)
77 * - Split header buffer for newer descriptors 77 * - Split header buffer for newer descriptors
78 * - EEE (Energy Efficiency Ethernet) for I354 78 * - EEE (Energy Efficiency Ethernet) for I354
79 * - Virtual Function 79 * - Virtual Function
80 * - Set LED correctly (based on contents in EEPROM) 80 * - Set LED correctly (based on contents in EEPROM)
81 * - Rework how parameters are loaded from the EEPROM. 81 * - Rework how parameters are loaded from the EEPROM.
82 */ 82 */
83 83
84#include <sys/cdefs.h> 84#include <sys/cdefs.h>
85__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.676 2020/04/30 03:42:10 riastradh Exp $"); 85__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.677 2020/06/11 02:39:30 thorpej Exp $");
86 86
87#ifdef _KERNEL_OPT 87#ifdef _KERNEL_OPT
88#include "opt_net_mpsafe.h" 88#include "opt_net_mpsafe.h"
89#include "opt_if_wm.h" 89#include "opt_if_wm.h"
90#endif 90#endif
91 91
92#include <sys/param.h> 92#include <sys/param.h>
93#include <sys/systm.h> 93#include <sys/systm.h>
94#include <sys/callout.h> 94#include <sys/callout.h>
95#include <sys/mbuf.h> 95#include <sys/mbuf.h>
96#include <sys/malloc.h> 96#include <sys/malloc.h>
97#include <sys/kmem.h> 97#include <sys/kmem.h>
98#include <sys/kernel.h> 98#include <sys/kernel.h>
@@ -2550,38 +2550,38 @@ alloc_retry: @@ -2550,38 +2550,38 @@ alloc_retry:
2550 } 2550 }
2551 } 2551 }
2552 2552
2553 aprint_normal_dev(sc->sc_dev, "Ethernet address %s\n", 2553 aprint_normal_dev(sc->sc_dev, "Ethernet address %s\n",
2554 ether_sprintf(enaddr)); 2554 ether_sprintf(enaddr));
2555 2555
2556 /* 2556 /*
2557 * Read the config info from the EEPROM, and set up various 2557 * Read the config info from the EEPROM, and set up various
2558 * bits in the control registers based on their contents. 2558 * bits in the control registers based on their contents.
2559 */ 2559 */
2560 pn = prop_dictionary_get(dict, "i82543-cfg1"); 2560 pn = prop_dictionary_get(dict, "i82543-cfg1");
2561 if (pn != NULL) { 2561 if (pn != NULL) {
2562 KASSERT(prop_object_type(pn) == PROP_TYPE_NUMBER); 2562 KASSERT(prop_object_type(pn) == PROP_TYPE_NUMBER);
2563 cfg1 = (uint16_t) prop_number_integer_value(pn); 2563 cfg1 = (uint16_t) prop_number_signed_value(pn);
2564 } else { 2564 } else {
2565 if (wm_nvm_read(sc, NVM_OFF_CFG1, 1, &cfg1)) { 2565 if (wm_nvm_read(sc, NVM_OFF_CFG1, 1, &cfg1)) {
2566 aprint_error_dev(sc->sc_dev, "unable to read CFG1\n"); 2566 aprint_error_dev(sc->sc_dev, "unable to read CFG1\n");
2567 goto out; 2567 goto out;
2568 } 2568 }
2569 } 2569 }
2570 2570
2571 pn = prop_dictionary_get(dict, "i82543-cfg2"); 2571 pn = prop_dictionary_get(dict, "i82543-cfg2");
2572 if (pn != NULL) { 2572 if (pn != NULL) {
2573 KASSERT(prop_object_type(pn) == PROP_TYPE_NUMBER); 2573 KASSERT(prop_object_type(pn) == PROP_TYPE_NUMBER);
2574 cfg2 = (uint16_t) prop_number_integer_value(pn); 2574 cfg2 = (uint16_t) prop_number_signed_value(pn);
2575 } else { 2575 } else {
2576 if (wm_nvm_read(sc, NVM_OFF_CFG2, 1, &cfg2)) { 2576 if (wm_nvm_read(sc, NVM_OFF_CFG2, 1, &cfg2)) {
2577 aprint_error_dev(sc->sc_dev, "unable to read CFG2\n"); 2577 aprint_error_dev(sc->sc_dev, "unable to read CFG2\n");
2578 goto out; 2578 goto out;
2579 } 2579 }
2580 } 2580 }
2581 2581
2582 /* check for WM_F_WOL */ 2582 /* check for WM_F_WOL */
2583 switch (sc->sc_type) { 2583 switch (sc->sc_type) {
2584 case WM_T_82542_2_0: 2584 case WM_T_82542_2_0:
2585 case WM_T_82542_2_1: 2585 case WM_T_82542_2_1:
2586 case WM_T_82543: 2586 case WM_T_82543:
2587 /* dummy? */ 2587 /* dummy? */
@@ -2690,27 +2690,27 @@ alloc_retry: @@ -2690,27 +2690,27 @@ alloc_retry:
2690 } 2690 }
2691 } 2691 }
2692 } 2692 }
2693 2693
2694 /* 2694 /*
2695 * XXX need special handling for some multiple port cards 2695 * XXX need special handling for some multiple port cards
2696 * to disable a paticular port. 2696 * to disable a paticular port.
2697 */ 2697 */
2698 2698
2699 if (sc->sc_type >= WM_T_82544) { 2699 if (sc->sc_type >= WM_T_82544) {
2700 pn = prop_dictionary_get(dict, "i82543-swdpin"); 2700 pn = prop_dictionary_get(dict, "i82543-swdpin");
2701 if (pn != NULL) { 2701 if (pn != NULL) {
2702 KASSERT(prop_object_type(pn) == PROP_TYPE_NUMBER); 2702 KASSERT(prop_object_type(pn) == PROP_TYPE_NUMBER);
2703 swdpin = (uint16_t) prop_number_integer_value(pn); 2703 swdpin = (uint16_t) prop_number_signed_value(pn);
2704 } else { 2704 } else {
2705 if (wm_nvm_read(sc, NVM_OFF_SWDPIN, 1, &swdpin)) { 2705 if (wm_nvm_read(sc, NVM_OFF_SWDPIN, 1, &swdpin)) {
2706 aprint_error_dev(sc->sc_dev, 2706 aprint_error_dev(sc->sc_dev,
2707 "unable to read SWDPIN\n"); 2707 "unable to read SWDPIN\n");
2708 goto out; 2708 goto out;
2709 } 2709 }
2710 } 2710 }
2711 } 2711 }
2712 2712
2713 if (cfg1 & NVM_CFG1_ILOS) 2713 if (cfg1 & NVM_CFG1_ILOS)
2714 sc->sc_ctrl |= CTRL_ILOS; 2714 sc->sc_ctrl |= CTRL_ILOS;
2715 2715
2716 /* 2716 /*

cvs diff -r1.13 -r1.14 src/sys/dev/spi/spi.c (expand / switch to unified diff)

--- src/sys/dev/spi/spi.c 2019/11/27 07:26:08 1.13
+++ src/sys/dev/spi/spi.c 2020/06/11 02:39:30 1.14
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: spi.c,v 1.13 2019/11/27 07:26:08 hkenken Exp $ */ 1/* $NetBSD: spi.c,v 1.14 2020/06/11 02:39:30 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2006 Urbana-Champaign Independent Media Center. 4 * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
5 * Copyright (c) 2006 Garrett D'Amore. 5 * Copyright (c) 2006 Garrett D'Amore.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Portions of this code were written by Garrett D'Amore for the 8 * Portions of this code were written by Garrett D'Amore for the
9 * Champaign-Urbana Community Wireless Network Project. 9 * Champaign-Urbana Community Wireless Network Project.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or 11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following 12 * without modification, are permitted provided that the following
13 * conditions are met: 13 * conditions are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -32,27 +32,27 @@ @@ -32,27 +32,27 @@
32 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 32 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 * ARE DISCLAIMED. IN NO EVENT SHALL THE URBANA-CHAMPAIGN INDEPENDENT 33 * ARE DISCLAIMED. IN NO EVENT SHALL THE URBANA-CHAMPAIGN INDEPENDENT
34 * MEDIA CENTER OR GARRETT D'AMORE BE LIABLE FOR ANY DIRECT, INDIRECT, 34 * MEDIA CENTER OR GARRETT D'AMORE BE LIABLE FOR ANY DIRECT, INDIRECT,
35 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 35 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
36 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
37 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 37 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
38 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 38 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
41 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 */ 42 */
43 43
44#include <sys/cdefs.h> 44#include <sys/cdefs.h>
45__KERNEL_RCSID(0, "$NetBSD: spi.c,v 1.13 2019/11/27 07:26:08 hkenken Exp $"); 45__KERNEL_RCSID(0, "$NetBSD: spi.c,v 1.14 2020/06/11 02:39:30 thorpej Exp $");
46 46
47#include "locators.h" 47#include "locators.h"
48 48
49#include <sys/param.h> 49#include <sys/param.h>
50#include <sys/systm.h> 50#include <sys/systm.h>
51#include <sys/device.h> 51#include <sys/device.h>
52#include <sys/conf.h> 52#include <sys/conf.h>
53#include <sys/malloc.h> 53#include <sys/malloc.h>
54#include <sys/mutex.h> 54#include <sys/mutex.h>
55#include <sys/condvar.h> 55#include <sys/condvar.h>
56#include <sys/errno.h> 56#include <sys/errno.h>
57 57
58#include <dev/spi/spivar.h> 58#include <dev/spi/spivar.h>
@@ -237,27 +237,27 @@ spi_direct_attach_child_devices(device_t @@ -237,27 +237,27 @@ spi_direct_attach_child_devices(device_t
237 continue; 237 continue;
238 loc[SPICF_SLAVE] = slave; 238 loc[SPICF_SLAVE] = slave;
239 239
240 memset(&sa, 0, sizeof sa); 240 memset(&sa, 0, sizeof sa);
241 sa.sa_handle = &sc->sc_slaves[i]; 241 sa.sa_handle = &sc->sc_slaves[i];
242 sa.sa_prop = child; 242 sa.sa_prop = child;
243 sa.sa_cookie = cookie; 243 sa.sa_cookie = cookie;
244 if (ISSET(sa.sa_handle->sh_flags, SPIH_ATTACHED)) 244 if (ISSET(sa.sa_handle->sh_flags, SPIH_ATTACHED))
245 continue; 245 continue;
246 SET(sa.sa_handle->sh_flags, SPIH_ATTACHED); 246 SET(sa.sa_handle->sh_flags, SPIH_ATTACHED);
247 247
248 buf = NULL; 248 buf = NULL;
249 spi_fill_compat(&sa, 249 spi_fill_compat(&sa,
250 prop_data_data_nocopy(cdata), 250 prop_data_value(cdata),
251 prop_data_size(cdata), &buf); 251 prop_data_size(cdata), &buf);
252 (void) config_found_sm_loc(parent, "spi", 252 (void) config_found_sm_loc(parent, "spi",
253 loc, &sa, spi_print, 253 loc, &sa, spi_print,
254 NULL); 254 NULL);
255 255
256 if (sa.sa_compat) 256 if (sa.sa_compat)
257 free(sa.sa_compat, M_TEMP); 257 free(sa.sa_compat, M_TEMP);
258 if (buf) 258 if (buf)
259 free(buf, M_TEMP); 259 free(buf, M_TEMP);
260 } 260 }
261} 261}
262 262
263int 263int

cvs diff -r1.17 -r1.18 src/sys/dev/sysmon/swsensor.c (expand / switch to unified diff)

--- src/sys/dev/sysmon/swsensor.c 2020/06/08 20:18:13 1.17
+++ src/sys/dev/sysmon/swsensor.c 2020/06/11 02:39:31 1.18
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: swsensor.c,v 1.17 2020/06/08 20:18:13 thorpej Exp $ */ 1/* $NetBSD: swsensor.c,v 1.18 2020/06/11 02:39:31 thorpej Exp $ */
2/* 2/*
3 * Copyright (c) 2008 The NetBSD Foundation, Inc. 3 * Copyright (c) 2008 The NetBSD Foundation, Inc.
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 *
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY 19 * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 24 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: swsensor.c,v 1.17 2020/06/08 20:18:13 thorpej Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: swsensor.c,v 1.18 2020/06/11 02:39:31 thorpej Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/kernel.h> 33#include <sys/kernel.h>
34#include <sys/module.h> 34#include <sys/module.h>
35#include <sys/sysctl.h> 35#include <sys/sysctl.h>
36 36
37#include <dev/sysmon/sysmonvar.h> 37#include <dev/sysmon/sysmonvar.h>
38#include <dev/sysmon/sysmon_envsysvar.h> 38#include <dev/sysmon/sysmon_envsysvar.h>
39 39
40#include <prop/proplib.h> 40#include <prop/proplib.h>
41 41
42#ifndef _MODULE 42#ifndef _MODULE
43#include "opt_modular.h" 43#include "opt_modular.h"
@@ -206,41 +206,41 @@ swsensor_init(void *arg) @@ -206,41 +206,41 @@ swsensor_init(void *arg)
206 sw_sensor_limit = 0; 206 sw_sensor_limit = 0;
207 207
208 /* Iterate over the provided dictionary, if any */ 208 /* Iterate over the provided dictionary, if any */
209 if (pd != NULL) { 209 if (pd != NULL) {
210 iter = prop_dictionary_iterator(pd); 210 iter = prop_dictionary_iterator(pd);
211 if (iter == NULL) 211 if (iter == NULL)
212 return ENOMEM; 212 return ENOMEM;
213 213
214 while ((obj = prop_object_iterator_next(iter)) != NULL) { 214 while ((obj = prop_object_iterator_next(iter)) != NULL) {
215 key = prop_dictionary_keysym_value(obj); 215 key = prop_dictionary_keysym_value(obj);
216 po = prop_dictionary_get_keysym(pd, obj); 216 po = prop_dictionary_get_keysym(pd, obj);
217 type = prop_object_type(po); 217 type = prop_object_type(po);
218 if (type == PROP_TYPE_NUMBER) 218 if (type == PROP_TYPE_NUMBER)
219 val = prop_number_integer_value(po); 219 val = prop_number_signed_value(po);
220 220
221 /* Sensor type/units */ 221 /* Sensor type/units */
222 if (strcmp(key, "type") == 0) { 222 if (strcmp(key, "type") == 0) {
223 if (type == PROP_TYPE_NUMBER) { 223 if (type == PROP_TYPE_NUMBER) {
224 descr = sme_find_table_entry( 224 descr = sme_find_table_entry(
225 SME_DESC_UNITS, val); 225 SME_DESC_UNITS, val);
226 if (descr == NULL) 226 if (descr == NULL)
227 return EINVAL; 227 return EINVAL;
228 swsensor_edata.units = descr->type; 228 swsensor_edata.units = descr->type;
229 continue; 229 continue;
230 } 230 }
231 if (type != PROP_TYPE_STRING) 231 if (type != PROP_TYPE_STRING)
232 return EINVAL; 232 return EINVAL;
233 str = prop_string_cstring_nocopy(po); 233 str = prop_string_value(po);
234 descr = sme_find_table_desc(SME_DESC_UNITS, 234 descr = sme_find_table_desc(SME_DESC_UNITS,
235 str); 235 str);
236 if (descr == NULL) 236 if (descr == NULL)
237 return EINVAL; 237 return EINVAL;
238 swsensor_edata.units = descr->type; 238 swsensor_edata.units = descr->type;
239 continue; 239 continue;
240 } 240 }
241 241
242 /* Sensor flags */ 242 /* Sensor flags */
243 if (strcmp(key, "flags") == 0) { 243 if (strcmp(key, "flags") == 0) {
244 if (type != PROP_TYPE_NUMBER) 244 if (type != PROP_TYPE_NUMBER)
245 return EINVAL; 245 return EINVAL;
246 swsensor_edata.flags = val; 246 swsensor_edata.flags = val;

cvs diff -r1.146 -r1.147 src/sys/dev/sysmon/sysmon_envsys.c (expand / switch to unified diff)

--- src/sys/dev/sysmon/sysmon_envsys.c 2020/06/08 20:18:13 1.146
+++ src/sys/dev/sysmon/sysmon_envsys.c 2020/06/11 02:39:31 1.147
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sysmon_envsys.c,v 1.146 2020/06/08 20:18:13 thorpej Exp $ */ 1/* $NetBSD: sysmon_envsys.c,v 1.147 2020/06/11 02:39:31 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007, 2008 Juan Romero Pardines. 4 * Copyright (c) 2007, 2008 Juan Romero Pardines.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -54,27 +54,27 @@ @@ -54,27 +54,27 @@
54 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 54 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
55 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 55 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
56 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 56 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
57 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 57 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
58 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 58 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59 */ 59 */
60 60
61/* 61/*
62 * Environmental sensor framework for sysmon, exported to userland 62 * Environmental sensor framework for sysmon, exported to userland
63 * with proplib(3). 63 * with proplib(3).
64 */ 64 */
65 65
66#include <sys/cdefs.h> 66#include <sys/cdefs.h>
67__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.146 2020/06/08 20:18:13 thorpej Exp $"); 67__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.147 2020/06/11 02:39:31 thorpej Exp $");
68 68
69#include <sys/param.h> 69#include <sys/param.h>
70#include <sys/types.h> 70#include <sys/types.h>
71#include <sys/conf.h> 71#include <sys/conf.h>
72#include <sys/errno.h> 72#include <sys/errno.h>
73#include <sys/fcntl.h> 73#include <sys/fcntl.h>
74#include <sys/kernel.h> 74#include <sys/kernel.h>
75#include <sys/systm.h> 75#include <sys/systm.h>
76#include <sys/proc.h> 76#include <sys/proc.h>
77#include <sys/mutex.h> 77#include <sys/mutex.h>
78#include <sys/kmem.h> 78#include <sys/kmem.h>
79#include <sys/rndsource.h> 79#include <sys/rndsource.h>
80#include <sys/module.h> 80#include <sys/module.h>
@@ -1141,27 +1141,27 @@ sme_sensor_dictionary_get(prop_array_t a @@ -1141,27 +1141,27 @@ sme_sensor_dictionary_get(prop_array_t a
1141{ 1141{
1142 prop_object_iterator_t iter; 1142 prop_object_iterator_t iter;
1143 prop_dictionary_t dict; 1143 prop_dictionary_t dict;
1144 prop_object_t obj; 1144 prop_object_t obj;
1145 1145
1146 KASSERT(array != NULL || index != NULL); 1146 KASSERT(array != NULL || index != NULL);
1147 1147
1148 iter = prop_array_iterator(array); 1148 iter = prop_array_iterator(array);
1149 if (!iter) 1149 if (!iter)
1150 return NULL; 1150 return NULL;
1151 1151
1152 while ((dict = prop_object_iterator_next(iter))) { 1152 while ((dict = prop_object_iterator_next(iter))) {
1153 obj = prop_dictionary_get(dict, "index"); 1153 obj = prop_dictionary_get(dict, "index");
1154 if (prop_string_equals_cstring(obj, index)) 1154 if (prop_string_equals_string(obj, index))
1155 break; 1155 break;
1156 } 1156 }
1157 1157
1158 prop_object_iterator_release(iter); 1158 prop_object_iterator_release(iter);
1159 return dict; 1159 return dict;
1160} 1160}
1161 1161
1162/* 1162/*
1163 * sme_remove_userprops: 1163 * sme_remove_userprops:
1164 * 1164 *
1165 * + Remove all properties from all devices that were set by 1165 * + Remove all properties from all devices that were set by
1166 * the ENVSYS_SETDICTIONARY ioctl. 1166 * the ENVSYS_SETDICTIONARY ioctl.
1167 */ 1167 */
@@ -1382,27 +1382,27 @@ sme_add_property_dictionary(struct sysmo @@ -1382,27 +1382,27 @@ sme_add_property_dictionary(struct sysmo
1382 } 1382 }
1383 1383
1384 if (!prop_dictionary_set_uint64(pdict, "refresh-timeout", 1384 if (!prop_dictionary_set_uint64(pdict, "refresh-timeout",
1385 sme->sme_events_timeout)) { 1385 sme->sme_events_timeout)) {
1386 error = EINVAL; 1386 error = EINVAL;
1387 goto out; 1387 goto out;
1388 } 1388 }
1389 if (sme->sme_class == SME_CLASS_BATTERY) 1389 if (sme->sme_class == SME_CLASS_BATTERY)
1390 class = "battery"; 1390 class = "battery";
1391 else if (sme->sme_class == SME_CLASS_ACADAPTER) 1391 else if (sme->sme_class == SME_CLASS_ACADAPTER)
1392 class = "ac-adapter"; 1392 class = "ac-adapter";
1393 else 1393 else
1394 class = "other"; 1394 class = "other";
1395 if (!prop_dictionary_set_cstring_nocopy(pdict, "device-class", class)) { 1395 if (!prop_dictionary_set_string_nocopy(pdict, "device-class", class)) {
1396 error = EINVAL; 1396 error = EINVAL;
1397 goto out; 1397 goto out;
1398 } 1398 }
1399 1399
1400 if (!prop_dictionary_set(dict, "device-properties", pdict)) { 1400 if (!prop_dictionary_set(dict, "device-properties", pdict)) {
1401 error = EINVAL; 1401 error = EINVAL;
1402 goto out; 1402 goto out;
1403 } 1403 }
1404 1404
1405 /* 1405 /*
1406 * Add the device dictionary into the sysmon envsys array. 1406 * Add the device dictionary into the sysmon envsys array.
1407 */ 1407 */
1408 if (!prop_array_add(array, dict)) 1408 if (!prop_array_add(array, dict))
@@ -1894,27 +1894,27 @@ sme_userset_dictionary(struct sysmon_env @@ -1894,27 +1894,27 @@ sme_userset_dictionary(struct sysmon_env
1894 */ 1894 */
1895 if (!prop_string_equals(obj1, obj)) 1895 if (!prop_string_equals(obj1, obj))
1896 continue; 1896 continue;
1897 1897
1898 props = 0; 1898 props = 0;
1899 1899
1900 /* 1900 /*
1901 * Check if a new description operation was 1901 * Check if a new description operation was
1902 * requested by the user and set new description. 1902 * requested by the user and set new description.
1903 */ 1903 */
1904 obj2 = prop_dictionary_get(udict, "description"); 1904 obj2 = prop_dictionary_get(udict, "description");
1905 if (obj2 && prop_object_type(obj2) == PROP_TYPE_STRING) { 1905 if (obj2 && prop_object_type(obj2) == PROP_TYPE_STRING) {
1906 targetfound = true; 1906 targetfound = true;
1907 blah = prop_string_cstring_nocopy(obj2); 1907 blah = prop_string_value(obj2);
1908 1908
1909 /* 1909 /*
1910 * Check for duplicate description. 1910 * Check for duplicate description.
1911 */ 1911 */
1912 for (i = 0; i < sme->sme_nsensors; i++) { 1912 for (i = 0; i < sme->sme_nsensors; i++) {
1913 if (i == edata->sensor) 1913 if (i == edata->sensor)
1914 continue; 1914 continue;
1915 tdict = prop_array_get(array, i); 1915 tdict = prop_array_get(array, i);
1916 tobj = 1916 tobj =
1917 prop_dictionary_get(tdict, "description"); 1917 prop_dictionary_get(tdict, "description");
1918 if (prop_string_equals(obj2, tobj)) { 1918 if (prop_string_equals(obj2, tobj)) {
1919 error = EEXIST; 1919 error = EEXIST;
1920 goto out; 1920 goto out;
@@ -1937,116 +1937,116 @@ sme_userset_dictionary(struct sysmon_env @@ -1937,116 +1937,116 @@ sme_userset_dictionary(struct sysmon_env
1937 __func__, edata->sensor, blah)); 1937 __func__, edata->sensor, blah));
1938 edata->upropset |= PROP_DESC; 1938 edata->upropset |= PROP_DESC;
1939 mutex_exit(&sme->sme_mtx); 1939 mutex_exit(&sme->sme_mtx);
1940 } 1940 }
1941 1941
1942 /*  1942 /*
1943 * did the user want to change the rfact? 1943 * did the user want to change the rfact?
1944 */ 1944 */
1945 obj2 = prop_dictionary_get(udict, "rfact"); 1945 obj2 = prop_dictionary_get(udict, "rfact");
1946 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) { 1946 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) {
1947 targetfound = true; 1947 targetfound = true;
1948 if (edata->flags & ENVSYS_FCHANGERFACT) { 1948 if (edata->flags & ENVSYS_FCHANGERFACT) {
1949 mutex_enter(&sme->sme_mtx); 1949 mutex_enter(&sme->sme_mtx);
1950 edata->rfact = prop_number_integer_value(obj2); 1950 edata->rfact = prop_number_signed_value(obj2);
1951 edata->upropset |= PROP_RFACT; 1951 edata->upropset |= PROP_RFACT;
1952 mutex_exit(&sme->sme_mtx); 1952 mutex_exit(&sme->sme_mtx);
1953 DPRINTF(("%s: sensor%d changed rfact to %d\n", 1953 DPRINTF(("%s: sensor%d changed rfact to %d\n",
1954 __func__, edata->sensor, edata->rfact)); 1954 __func__, edata->sensor, edata->rfact));
1955 } else { 1955 } else {
1956 error = ENOTSUP; 1956 error = ENOTSUP;
1957 goto out; 1957 goto out;
1958 } 1958 }
1959 } 1959 }
1960 1960
1961 sdt = sme_find_table_entry(SME_DESC_UNITS, edata->units); 1961 sdt = sme_find_table_entry(SME_DESC_UNITS, edata->units);
1962 1962
1963 /*  1963 /*
1964 * did the user want to set a critical capacity event? 1964 * did the user want to set a critical capacity event?
1965 */ 1965 */
1966 obj2 = prop_dictionary_get(udict, "critical-capacity"); 1966 obj2 = prop_dictionary_get(udict, "critical-capacity");
1967 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) { 1967 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) {
1968 targetfound = true; 1968 targetfound = true;
1969 lims.sel_critmin = prop_number_integer_value(obj2); 1969 lims.sel_critmin = prop_number_signed_value(obj2);
1970 props |= PROP_BATTCAP; 1970 props |= PROP_BATTCAP;
1971 } 1971 }
1972 1972
1973 /*  1973 /*
1974 * did the user want to set a warning capacity event? 1974 * did the user want to set a warning capacity event?
1975 */ 1975 */
1976 obj2 = prop_dictionary_get(udict, "warning-capacity"); 1976 obj2 = prop_dictionary_get(udict, "warning-capacity");
1977 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) { 1977 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) {
1978 targetfound = true; 1978 targetfound = true;
1979 lims.sel_warnmin = prop_number_integer_value(obj2); 1979 lims.sel_warnmin = prop_number_signed_value(obj2);
1980 props |= PROP_BATTWARN; 1980 props |= PROP_BATTWARN;
1981 } 1981 }
1982 1982
1983 /*  1983 /*
1984 * did the user want to set a high capacity event? 1984 * did the user want to set a high capacity event?
1985 */ 1985 */
1986 obj2 = prop_dictionary_get(udict, "high-capacity"); 1986 obj2 = prop_dictionary_get(udict, "high-capacity");
1987 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) { 1987 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) {
1988 targetfound = true; 1988 targetfound = true;
1989 lims.sel_warnmin = prop_number_integer_value(obj2); 1989 lims.sel_warnmin = prop_number_signed_value(obj2);
1990 props |= PROP_BATTHIGH; 1990 props |= PROP_BATTHIGH;
1991 } 1991 }
1992 1992
1993 /*  1993 /*
1994 * did the user want to set a maximum capacity event? 1994 * did the user want to set a maximum capacity event?
1995 */ 1995 */
1996 obj2 = prop_dictionary_get(udict, "maximum-capacity"); 1996 obj2 = prop_dictionary_get(udict, "maximum-capacity");
1997 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) { 1997 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) {
1998 targetfound = true; 1998 targetfound = true;
1999 lims.sel_warnmin = prop_number_integer_value(obj2); 1999 lims.sel_warnmin = prop_number_signed_value(obj2);
2000 props |= PROP_BATTMAX; 2000 props |= PROP_BATTMAX;
2001 } 2001 }
2002 2002
2003 /*  2003 /*
2004 * did the user want to set a critical max event? 2004 * did the user want to set a critical max event?
2005 */ 2005 */
2006 obj2 = prop_dictionary_get(udict, "critical-max"); 2006 obj2 = prop_dictionary_get(udict, "critical-max");
2007 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) { 2007 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) {
2008 targetfound = true; 2008 targetfound = true;
2009 lims.sel_critmax = prop_number_integer_value(obj2); 2009 lims.sel_critmax = prop_number_signed_value(obj2);
2010 props |= PROP_CRITMAX; 2010 props |= PROP_CRITMAX;
2011 } 2011 }
2012 2012
2013 /*  2013 /*
2014 * did the user want to set a warning max event? 2014 * did the user want to set a warning max event?
2015 */ 2015 */
2016 obj2 = prop_dictionary_get(udict, "warning-max"); 2016 obj2 = prop_dictionary_get(udict, "warning-max");
2017 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) { 2017 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) {
2018 targetfound = true; 2018 targetfound = true;
2019 lims.sel_warnmax = prop_number_integer_value(obj2); 2019 lims.sel_warnmax = prop_number_signed_value(obj2);
2020 props |= PROP_WARNMAX; 2020 props |= PROP_WARNMAX;
2021 } 2021 }
2022 2022
2023 /*  2023 /*
2024 * did the user want to set a critical min event? 2024 * did the user want to set a critical min event?
2025 */ 2025 */
2026 obj2 = prop_dictionary_get(udict, "critical-min"); 2026 obj2 = prop_dictionary_get(udict, "critical-min");
2027 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) { 2027 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) {
2028 targetfound = true; 2028 targetfound = true;
2029 lims.sel_critmin = prop_number_integer_value(obj2); 2029 lims.sel_critmin = prop_number_signed_value(obj2);
2030 props |= PROP_CRITMIN; 2030 props |= PROP_CRITMIN;
2031 } 2031 }
2032 2032
2033 /*  2033 /*
2034 * did the user want to set a warning min event? 2034 * did the user want to set a warning min event?
2035 */ 2035 */
2036 obj2 = prop_dictionary_get(udict, "warning-min"); 2036 obj2 = prop_dictionary_get(udict, "warning-min");
2037 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) { 2037 if (obj2 && prop_object_type(obj2) == PROP_TYPE_NUMBER) {
2038 targetfound = true; 2038 targetfound = true;
2039 lims.sel_warnmin = prop_number_integer_value(obj2); 2039 lims.sel_warnmin = prop_number_signed_value(obj2);
2040 props |= PROP_WARNMIN; 2040 props |= PROP_WARNMIN;
2041 } 2041 }
2042 2042
2043 if (props && (edata->flags & ENVSYS_FMONNOTSUPP) != 0) { 2043 if (props && (edata->flags & ENVSYS_FMONNOTSUPP) != 0) {
2044 error = ENOTSUP; 2044 error = ENOTSUP;
2045 goto out; 2045 goto out;
2046 } 2046 }
2047 if (props || (edata->flags & ENVSYS_FHAS_ENTROPY) != 0) { 2047 if (props || (edata->flags & ENVSYS_FHAS_ENTROPY) != 0) {
2048 error = sme_event_register(dict, edata, sme, &lims, 2048 error = sme_event_register(dict, edata, sme, &lims,
2049 props, 2049 props,
2050 (edata->flags & ENVSYS_FPERCENT)? 2050 (edata->flags & ENVSYS_FPERCENT)?
2051 PENVSYS_EVENT_CAPACITY: 2051 PENVSYS_EVENT_CAPACITY:
2052 PENVSYS_EVENT_LIMITS, 2052 PENVSYS_EVENT_LIMITS,

cvs diff -r1.6 -r1.7 src/sys/dev/sysmon/sysmon_envsys_util.c (expand / switch to unified diff)

--- src/sys/dev/sysmon/sysmon_envsys_util.c 2020/06/08 20:18:13 1.6
+++ src/sys/dev/sysmon/sysmon_envsys_util.c 2020/06/11 02:39:31 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sysmon_envsys_util.c,v 1.6 2020/06/08 20:18:13 thorpej Exp $ */ 1/* $NetBSD: sysmon_envsys_util.c,v 1.7 2020/06/11 02:39:31 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 Juan Romero Pardines. 4 * Copyright (c) 2007 Juan Romero Pardines.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -16,27 +16,27 @@ @@ -16,27 +16,27 @@
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28#include <sys/cdefs.h> 28#include <sys/cdefs.h>
29__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_util.c,v 1.6 2020/06/08 20:18:13 thorpej Exp $"); 29__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_util.c,v 1.7 2020/06/11 02:39:31 thorpej Exp $");
30 30
31#include <sys/param.h> 31#include <sys/param.h>
32#include <sys/types.h> 32#include <sys/types.h>
33#include <sys/conf.h> 33#include <sys/conf.h>
34#include <sys/kernel.h> 34#include <sys/kernel.h>
35 35
36#include <dev/sysmon/sysmonvar.h> 36#include <dev/sysmon/sysmonvar.h>
37#include <dev/sysmon/sysmon_envsysvar.h> 37#include <dev/sysmon/sysmon_envsysvar.h>
38#include <prop/proplib.h> 38#include <prop/proplib.h>
39 39
40/* 40/*
41 * Functions to create objects in a dictionary if they do not exist, or 41 * Functions to create objects in a dictionary if they do not exist, or
42 * for updating its value if it doesn't match with the value in dictionary. 42 * for updating its value if it doesn't match with the value in dictionary.
@@ -122,30 +122,30 @@ sme_sensor_upuint32(prop_dictionary_t di @@ -122,30 +122,30 @@ sme_sensor_upuint32(prop_dictionary_t di
122 122
123 return 0; 123 return 0;
124} 124}
125 125
126int 126int
127sme_sensor_upstring(prop_dictionary_t dict, const char *key, const char *str) 127sme_sensor_upstring(prop_dictionary_t dict, const char *key, const char *str)
128{ 128{
129 prop_object_t obj; 129 prop_object_t obj;
130 130
131 KASSERT(dict != NULL); 131 KASSERT(dict != NULL);
132 132
133 obj = prop_dictionary_get(dict, key); 133 obj = prop_dictionary_get(dict, key);
134 if (obj == NULL) { 134 if (obj == NULL) {
135 if (!prop_dictionary_set_cstring(dict, key, str)) { 135 if (!prop_dictionary_set_string(dict, key, str)) {
136 DPRINTF(("%s: (up) set_cstring %s:%s\n", 136 DPRINTF(("%s: (up) set_cstring %s:%s\n",
137 __func__, key, str)); 137 __func__, key, str));
138 return EINVAL; 138 return EINVAL;
139 } 139 }
140 } else { 140 } else {
141 if (!prop_string_equals_cstring(obj, str)) { 141 if (!prop_string_equals_string(obj, str)) {
142 if (!prop_dictionary_set_cstring(dict, key, str)) { 142 if (!prop_dictionary_set_string(dict, key, str)) {
143 DPRINTF(("%s: (set) set_cstring %s:%s\n", 143 DPRINTF(("%s: (set) set_cstring %s:%s\n",
144 __func__, key, str)); 144 __func__, key, str));
145 return EINVAL; 145 return EINVAL;
146 } 146 }
147 } 147 }
148 } 148 }
149 149
150 return 0; 150 return 0;
151} 151}

cvs diff -r1.63 -r1.64 src/sys/dev/sysmon/sysmon_power.c (expand / switch to unified diff)

--- src/sys/dev/sysmon/sysmon_power.c 2020/06/08 20:18:13 1.63
+++ src/sys/dev/sysmon/sysmon_power.c 2020/06/11 02:39:31 1.64
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sysmon_power.c,v 1.63 2020/06/08 20:18:13 thorpej Exp $ */ 1/* $NetBSD: sysmon_power.c,v 1.64 2020/06/11 02:39:31 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 Juan Romero Pardines. 4 * Copyright (c) 2007 Juan Romero Pardines.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -59,27 +59,27 @@ @@ -59,27 +59,27 @@
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/* 63/*
64 * Power management framework for sysmon. 64 * Power management framework for sysmon.
65 * 65 *
66 * We defer to a power management daemon running in userspace, since 66 * We defer to a power management daemon running in userspace, since
67 * power management is largely a policy issue. This merely provides 67 * power management is largely a policy issue. This merely provides
68 * for power management event notification to that daemon. 68 * for power management event notification to that daemon.
69 */ 69 */
70 70
71#include <sys/cdefs.h> 71#include <sys/cdefs.h>
72__KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.63 2020/06/08 20:18:13 thorpej Exp $"); 72__KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.64 2020/06/11 02:39:31 thorpej Exp $");
73 73
74#ifdef _KERNEL_OPT 74#ifdef _KERNEL_OPT
75#include "opt_compat_netbsd.h" 75#include "opt_compat_netbsd.h"
76#endif 76#endif
77 77
78#include <sys/param.h> 78#include <sys/param.h>
79#include <sys/reboot.h> 79#include <sys/reboot.h>
80#include <sys/systm.h> 80#include <sys/systm.h>
81#include <sys/poll.h> 81#include <sys/poll.h>
82#include <sys/select.h> 82#include <sys/select.h>
83#include <sys/vnode.h> 83#include <sys/vnode.h>
84#include <sys/condvar.h> 84#include <sys/condvar.h>
85#include <sys/mutex.h> 85#include <sys/mutex.h>
@@ -698,27 +698,27 @@ sysmon_power_make_dictionary(prop_dictio @@ -698,27 +698,27 @@ sysmon_power_make_dictionary(prop_dictio
698 */ 698 */
699 case POWER_EVENT_SWITCH_STATE_CHANGE: 699 case POWER_EVENT_SWITCH_STATE_CHANGE:
700 { 700 {
701 const struct power_event_description *peevent = 701 const struct power_event_description *peevent =
702 pswitch_event_desc; 702 pswitch_event_desc;
703 const struct power_event_description *petype = 703 const struct power_event_description *petype =
704 pswitch_type_desc; 704 pswitch_type_desc;
705 struct sysmon_pswitch *smpsw = 705 struct sysmon_pswitch *smpsw =
706 (struct sysmon_pswitch *)power_data; 706 (struct sysmon_pswitch *)power_data;
707 const char *pwrtype = "pswitch"; 707 const char *pwrtype = "pswitch";
708 708
709#define SETPROP(key, str) \ 709#define SETPROP(key, str) \
710do { \ 710do { \
711 if ((str) != NULL && !prop_dictionary_set_cstring(dict, \ 711 if ((str) != NULL && !prop_dictionary_set_string(dict, \
712 (key), \ 712 (key), \
713 (str))) { \ 713 (str))) { \
714 printf("%s: failed to set %s\n", __func__, (str)); \ 714 printf("%s: failed to set %s\n", __func__, (str)); \
715 return EINVAL; \ 715 return EINVAL; \
716 } \ 716 } \
717} while (/* CONSTCOND */ 0) 717} while (/* CONSTCOND */ 0)
718 718
719 719
720 SETPROP("driver-name", smpsw->smpsw_name); 720 SETPROP("driver-name", smpsw->smpsw_name);
721 721
722 for (i = 0; peevent[i].type != -1; i++) 722 for (i = 0; peevent[i].type != -1; i++)
723 if (peevent[i].type == event) 723 if (peevent[i].type == event)
724 break; 724 break;

cvs diff -r1.247 -r1.248 src/sys/dev/usb/usb_subr.c (expand / switch to unified diff)

--- src/sys/dev/usb/usb_subr.c 2020/05/31 18:33:08 1.247
+++ src/sys/dev/usb/usb_subr.c 2020/06/11 02:39:30 1.248
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: usb_subr.c,v 1.247 2020/05/31 18:33:08 maxv Exp $ */ 1/* $NetBSD: usb_subr.c,v 1.248 2020/06/11 02:39:30 thorpej Exp $ */
2/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ 2/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. 5 * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Lennart Augustsson (lennart@augustsson.net) at 9 * by Lennart Augustsson (lennart@augustsson.net) at
10 * Carlstedt Research & Technology. 10 * Carlstedt Research & Technology.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 * ``AS IS'' AND 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 THE FOUNDATION OR CONTRIBUTORS 24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * INTERRUPTION) HOWEVER CAUSED AND 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: usb_subr.c,v 1.247 2020/05/31 18:33:08 maxv Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.248 2020/06/11 02:39:30 thorpej Exp $");
36 36
37#ifdef _KERNEL_OPT 37#ifdef _KERNEL_OPT
38#include "opt_compat_netbsd.h" 38#include "opt_compat_netbsd.h"
39#include "opt_usb.h" 39#include "opt_usb.h"
40#include "opt_usbverbose.h" 40#include "opt_usbverbose.h"
41#endif 41#endif
42 42
43#include <sys/param.h> 43#include <sys/param.h>
44#include <sys/systm.h> 44#include <sys/systm.h>
45#include <sys/kernel.h> 45#include <sys/kernel.h>
46#include <sys/kmem.h> 46#include <sys/kmem.h>
47#include <sys/device.h> 47#include <sys/device.h>
48#include <sys/select.h> 48#include <sys/select.h>
@@ -855,27 +855,27 @@ usbd_attach_roothub(device_t parent, str @@ -855,27 +855,27 @@ usbd_attach_roothub(device_t parent, str
855 KERNEL_UNLOCK_ONE(curlwp); 855 KERNEL_UNLOCK_ONE(curlwp);
856 if (dv) { 856 if (dv) {
857 dev->ud_subdevs = kmem_alloc(sizeof(dv), KM_SLEEP); 857 dev->ud_subdevs = kmem_alloc(sizeof(dv), KM_SLEEP);
858 dev->ud_subdevs[0] = dv; 858 dev->ud_subdevs[0] = dv;
859 dev->ud_subdevlen = 1; 859 dev->ud_subdevlen = 1;
860 } 860 }
861 return USBD_NORMAL_COMPLETION; 861 return USBD_NORMAL_COMPLETION;
862} 862}
863 863
864static void 864static void
865usbd_serialnumber(device_t dv, struct usbd_device *dev) 865usbd_serialnumber(device_t dv, struct usbd_device *dev)
866{ 866{
867 if (dev->ud_serial) { 867 if (dev->ud_serial) {
868 prop_dictionary_set_cstring(device_properties(dv), 868 prop_dictionary_set_string(device_properties(dv),
869 "serialnumber", dev->ud_serial); 869 "serialnumber", dev->ud_serial);
870 } 870 }
871} 871}
872 872
873static usbd_status 873static usbd_status
874usbd_attachwholedevice(device_t parent, struct usbd_device *dev, int port, 874usbd_attachwholedevice(device_t parent, struct usbd_device *dev, int port,
875 int usegeneric) 875 int usegeneric)
876{ 876{
877 struct usb_attach_arg uaa; 877 struct usb_attach_arg uaa;
878 usb_device_descriptor_t *dd = &dev->ud_ddesc; 878 usb_device_descriptor_t *dd = &dev->ud_ddesc;
879 device_t dv; 879 device_t dv;
880 int dlocs[USBDEVIFCF_NLOCS]; 880 int dlocs[USBDEVIFCF_NLOCS];
881 881

cvs diff -r1.2 -r1.3 src/sys/dev/wscons/wsdisplay_util.c (expand / switch to unified diff)

--- src/sys/dev/wscons/wsdisplay_util.c 2013/01/31 10:57:31 1.2
+++ src/sys/dev/wscons/wsdisplay_util.c 2020/06/11 02:39:31 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: wsdisplay_util.c,v 1.2 2013/01/31 10:57:31 macallan Exp $ */ 1/* $NetBSD: wsdisplay_util.c,v 1.3 2020/06/11 02:39:31 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2011 Michael Lorenz 4 * Copyright (c) 2011 Michael Lorenz
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -44,27 +44,27 @@ wsdisplayio_get_edid(device_t dev, struc @@ -44,27 +44,27 @@ wsdisplayio_get_edid(device_t dev, struc
44{ 44{
45 prop_data_t edid_data; 45 prop_data_t edid_data;
46 int edid_size; 46 int edid_size;
47 47
48 edid_data = prop_dictionary_get(device_properties(dev), "EDID"); 48 edid_data = prop_dictionary_get(device_properties(dev), "EDID");
49 if (edid_data != NULL) { 49 if (edid_data != NULL) {
50 edid_size = prop_data_size(edid_data); 50 edid_size = prop_data_size(edid_data);
51 /* less than 128 bytes is bogus */ 51 /* less than 128 bytes is bogus */
52 if (edid_size < 128) 52 if (edid_size < 128)
53 return ENODEV; 53 return ENODEV;
54 d->data_size = edid_size; 54 d->data_size = edid_size;
55 if (d->buffer_size < edid_size) 55 if (d->buffer_size < edid_size)
56 return EAGAIN; 56 return EAGAIN;
57 return copyout(prop_data_data_nocopy(edid_data), 57 return copyout(prop_data_value(edid_data),
58 d->edid_data, edid_size); 58 d->edid_data, edid_size);
59 } 59 }
60 return ENODEV; 60 return ENODEV;
61} 61}
62 62
63/* convenience function to fill in stuff from rasops_info */ 63/* convenience function to fill in stuff from rasops_info */
64int 64int
65wsdisplayio_get_fbinfo(struct rasops_info *ri, struct wsdisplayio_fbinfo *fbi) 65wsdisplayio_get_fbinfo(struct rasops_info *ri, struct wsdisplayio_fbinfo *fbi)
66{ 66{
67 fbi->fbi_width = ri->ri_width; 67 fbi->fbi_width = ri->ri_width;
68 fbi->fbi_height = ri->ri_height; 68 fbi->fbi_height = ri->ri_height;
69 fbi->fbi_stride = ri->ri_stride; 69 fbi->fbi_stride = ri->ri_stride;
70 fbi->fbi_bitsperpixel = ri->ri_depth; 70 fbi->fbi_bitsperpixel = ri->ri_depth;

cvs diff -r1.73 -r1.74 src/sys/dev/wsfb/genfb.c (expand / switch to unified diff)

--- src/sys/dev/wsfb/genfb.c 2020/05/30 14:15:43 1.73
+++ src/sys/dev/wsfb/genfb.c 2020/06/11 02:39:31 1.74
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: genfb.c,v 1.73 2020/05/30 14:15:43 jdolecek Exp $ */ 1/* $NetBSD: genfb.c,v 1.74 2020/06/11 02:39:31 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 Michael Lorenz 4 * Copyright (c) 2007 Michael Lorenz
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.73 2020/05/30 14:15:43 jdolecek Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.74 2020/06/11 02:39:31 thorpej Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/systm.h> 33#include <sys/systm.h>
34#include <sys/kernel.h> 34#include <sys/kernel.h>
35#include <sys/device.h> 35#include <sys/device.h>
36#include <sys/proc.h> 36#include <sys/proc.h>
37#include <sys/mutex.h> 37#include <sys/mutex.h>
38#include <sys/ioctl.h> 38#include <sys/ioctl.h>
39#include <sys/kernel.h> 39#include <sys/kernel.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/kmem.h> 41#include <sys/kmem.h>
42#include <sys/reboot.h> 42#include <sys/reboot.h>
43 43
@@ -632,27 +632,27 @@ genfb_calc_hsize(struct genfb_softc *sc) @@ -632,27 +632,27 @@ genfb_calc_hsize(struct genfb_softc *sc)
632 device_t dev = sc->sc_dev; 632 device_t dev = sc->sc_dev;
633 prop_dictionary_t dict = device_properties(dev); 633 prop_dictionary_t dict = device_properties(dev);
634 prop_data_t edid_data; 634 prop_data_t edid_data;
635 struct edid_info *edid; 635 struct edid_info *edid;
636 const char *edid_ptr; 636 const char *edid_ptr;
637 int hsize; 637 int hsize;
638 638
639 edid_data = prop_dictionary_get(dict, "EDID"); 639 edid_data = prop_dictionary_get(dict, "EDID");
640 if (edid_data == NULL || prop_data_size(edid_data) < 128) 640 if (edid_data == NULL || prop_data_size(edid_data) < 128)
641 return 0; 641 return 0;
642 642
643 edid = kmem_alloc(sizeof(*edid), KM_SLEEP); 643 edid = kmem_alloc(sizeof(*edid), KM_SLEEP);
644 644
645 edid_ptr = prop_data_data_nocopy(edid_data); 645 edid_ptr = prop_data_value(edid_data);
646 if (edid_parse(__UNCONST(edid_ptr), edid) == 0) 646 if (edid_parse(__UNCONST(edid_ptr), edid) == 0)
647 hsize = (int)edid->edid_max_hsize * 10; 647 hsize = (int)edid->edid_max_hsize * 10;
648 else 648 else
649 hsize = 0; 649 hsize = 0;
650 650
651 kmem_free(edid, sizeof(*edid)); 651 kmem_free(edid, sizeof(*edid));
652 652
653 return hsize; 653 return hsize;
654} 654}
655 655
656/* Return the minimum number of character columns based on DPI */ 656/* Return the minimum number of character columns based on DPI */
657static int 657static int
658genfb_calc_cols(struct genfb_softc *sc) 658genfb_calc_cols(struct genfb_softc *sc)