summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-02-12 03:24:34 +0000
committerriastradh <riastradh@NetBSD.org>2022-02-12 03:24:34 +0000
commite8b15cb7d5710c8b2b2da941d8a038f6fd5c4d45 (patch)
tree01ec573f838c0bce5b4bc8790bb469529d164de3 /sys/dev
parent50cc4c85087facfd6c5ac7978a7156437eff8880 (diff)
sys: Fix various abuse of struct device internals.
Will help to make struct device opaque later.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/i2c/ihidev.c41
-rw-r--r--sys/dev/i2c/pcagpio.c18
-rw-r--r--sys/dev/i2c/tsllux.c7
-rw-r--r--sys/dev/isa/wss_isa.c20
-rw-r--r--sys/dev/marvell/if_mvxpe.c7
-rw-r--r--sys/dev/marvell/mvxpsec.c4
-rw-r--r--sys/dev/pci/xmm7360.c25
-rw-r--r--sys/dev/spkr.c10
-rw-r--r--sys/dev/usb/vhci.c6
9 files changed, 69 insertions, 69 deletions
diff --git a/sys/dev/i2c/ihidev.c b/sys/dev/i2c/ihidev.c
index 7d0bbc19c9f..46400cf2bd2 100644
--- a/sys/dev/i2c/ihidev.c
+++ b/sys/dev/i2c/ihidev.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ihidev.c,v 1.27 2022/01/15 06:22:30 skrll Exp $ */
+/* $NetBSD: ihidev.c,v 1.28 2022/02/12 03:24:35 riastradh Exp $ */
/* $OpenBSD ihidev.c,v 1.13 2017/04/08 02:57:23 deraadt Exp $ */
/*-
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.27 2022/01/15 06:22:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.28 2022/02/12 03:24:35 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -204,8 +204,8 @@ ihidev_attach(device_t parent, device_t self, void *aux)
if (isize > sc->sc_isize)
sc->sc_isize = isize;
- DPRINTF(("%s: repid %d size %d\n", sc->sc_dev.dv_xname, repid,
- repsz));
+ DPRINTF(("%s: repid %d size %d\n",
+ device_xname(sc->sc_dev), repid, repsz));
}
sc->sc_ibuf = kmem_zalloc(sc->sc_isize, KM_SLEEP);
if (!ihidev_intr_init(sc)) {
@@ -334,14 +334,14 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg, bool poll)
};
DPRINTF(("%s: HID command I2C_HID_CMD_DESCR at 0x%x\n",
- sc->sc_dev.dv_xname, htole16(sc->sc_hid_desc_addr)));
+ device_xname(sc->sc_dev), htole16(sc->sc_hid_desc_addr)));
/* 20 00 */
res = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr,
&cmd, sizeof(cmd), &sc->hid_desc_buf,
sizeof(struct i2c_hid_desc), flags);
- DPRINTF(("%s: HID descriptor:", sc->sc_dev.dv_xname));
+ DPRINTF(("%s: HID descriptor:", device_xname(sc->sc_dev)));
for (i = 0; i < sizeof(struct i2c_hid_desc); i++)
DPRINTF((" %.2x", sc->hid_desc_buf[i]));
DPRINTF(("\n"));
@@ -357,7 +357,7 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg, bool poll)
};
DPRINTF(("%s: HID command I2C_HID_CMD_RESET\n",
- sc->sc_dev.dv_xname));
+ device_xname(sc->sc_dev)));
/* 22 00 00 01 */
res = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr,
@@ -385,7 +385,7 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg, bool poll)
uint8_t *tmprep;
DPRINTF(("%s: HID command I2C_HID_CMD_GET_REPORT %d "
- "(type %d, len %d)\n", sc->sc_dev.dv_xname, report_id,
+ "(type %d, len %d)\n", device_xname(sc->sc_dev), report_id,
rreq->type, rreq->len));
/*
@@ -431,7 +431,7 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg, bool poll)
d = tmprep[0] | tmprep[1] << 8;
if (d != report_len) {
DPRINTF(("%s: response size %d != expected length %d\n",
- sc->sc_dev.dv_xname, d, report_len));
+ device_xname(sc->sc_dev), d, report_len));
}
if (report_id_len == 2)
@@ -441,13 +441,13 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg, bool poll)
if (d != rreq->id) {
DPRINTF(("%s: response report id %d != %d\n",
- sc->sc_dev.dv_xname, d, rreq->id));
+ device_xname(sc->sc_dev), d, rreq->id));
iic_release_bus(sc->sc_tag, 0);
kmem_free(tmprep, report_len);
return (1);
}
- DPRINTF(("%s: response:", sc->sc_dev.dv_xname));
+ DPRINTF(("%s: response:", device_xname(sc->sc_dev)));
for (i = 0; i < report_len; i++)
DPRINTF((" %.2x", tmprep[i]));
DPRINTF(("\n"));
@@ -475,7 +475,7 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg, bool poll)
uint8_t *finalcmd;
DPRINTF(("%s: HID command I2C_HID_CMD_SET_REPORT %d "
- "(type %d, len %d):", sc->sc_dev.dv_xname, report_id,
+ "(type %d, len %d):", device_xname(sc->sc_dev), report_id,
rreq->type, rreq->len));
for (i = 0; i < rreq->len; i++)
DPRINTF((" %.2x", ((uint8_t *)rreq->data)[i]));
@@ -540,7 +540,7 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg, bool poll)
};
DPRINTF(("%s: HID command I2C_HID_CMD_SET_POWER(%d)\n",
- sc->sc_dev.dv_xname, power));
+ device_xname(sc->sc_dev), power));
/* 22 00 00 08 */
res = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr,
@@ -555,14 +555,15 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg, bool poll)
};
DPRINTF(("%s: HID command I2C_HID_REPORT_DESCR at 0x%x with "
- "size %d\n", sc->sc_dev.dv_xname, cmd[0],
+ "size %d\n", device_xname(sc->sc_dev), cmd[0],
sc->sc_reportlen));
/* 20 00 */
res = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr,
&cmd, sizeof(cmd), sc->sc_report, sc->sc_reportlen, flags);
- DPRINTF(("%s: HID report descriptor:", sc->sc_dev.dv_xname));
+ DPRINTF(("%s: HID report descriptor:",
+ device_xname(sc->sc_dev)));
for (i = 0; i < sc->sc_reportlen; i++)
DPRINTF((" %.2x", sc->sc_report[i]));
DPRINTF(("\n"));
@@ -582,7 +583,7 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg, bool poll)
static int
ihidev_reset(struct ihidev_softc *sc, bool poll)
{
- DPRINTF(("%s: resetting\n", sc->sc_dev.dv_xname));
+ DPRINTF(("%s: resetting\n", device_xname(sc->sc_dev)));
if (ihidev_hid_command(sc, I2C_HID_CMD_SET_POWER,
&I2C_HID_POWER_ON, poll)) {
@@ -795,7 +796,7 @@ ihidev_work(struct work *wk, void *arg)
psize = sc->sc_ibuf[0] | sc->sc_ibuf[1] << 8;
if (!psize || psize > sc->sc_isize) {
DPRINTF(("%s: %s: invalid packet size (%d vs. %d)\n",
- sc->sc_dev.dv_xname, __func__, psize, sc->sc_isize));
+ device_xname(sc->sc_dev), __func__, psize, sc->sc_isize));
goto out;
}
@@ -811,7 +812,7 @@ ihidev_work(struct work *wk, void *arg)
goto out;
}
- DPRINTF(("%s: %s: hid input (rep %d):", sc->sc_dev.dv_xname,
+ DPRINTF(("%s: %s: hid input (rep %d):", device_xname(sc->sc_dev),
__func__, rep));
for (i = 0; i < sc->sc_isize; i++)
DPRINTF((" %.2x", sc->sc_ibuf[i]));
@@ -884,7 +885,7 @@ ihidev_open(struct ihidev *scd)
struct ihidev_softc *sc = scd->sc_parent;
int error;
- DPRINTF(("%s: %s: state=%d refcnt=%d\n", sc->sc_dev.dv_xname,
+ DPRINTF(("%s: %s: state=%d refcnt=%d\n", device_xname(sc->sc_dev),
__func__, scd->sc_state, sc->sc_refcnt));
mutex_enter(&sc->sc_lock);
@@ -914,7 +915,7 @@ ihidev_close(struct ihidev *scd)
{
struct ihidev_softc *sc = scd->sc_parent;
- DPRINTF(("%s: %s: state=%d refcnt=%d\n", sc->sc_dev.dv_xname,
+ DPRINTF(("%s: %s: state=%d refcnt=%d\n", device_xname(sc->sc_dev),
__func__, scd->sc_state, sc->sc_refcnt));
mutex_enter(&sc->sc_lock);
diff --git a/sys/dev/i2c/pcagpio.c b/sys/dev/i2c/pcagpio.c
index 4cf26c05a4d..1ffd697ea6e 100644
--- a/sys/dev/i2c/pcagpio.c
+++ b/sys/dev/i2c/pcagpio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pcagpio.c,v 1.11 2021/06/21 03:12:54 christos Exp $ */
+/* $NetBSD: pcagpio.c,v 1.12 2022/02/12 03:24:35 riastradh Exp $ */
/*-
* Copyright (c) 2020 Michael Lorenz
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pcagpio.c,v 1.11 2021/06/21 03:12:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcagpio.c,v 1.12 2022/02/12 03:24:35 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -172,9 +172,9 @@ pcagpio_attach(device_t parent, device_t self, void *aux)
out &= ~sc->sc_dir;
in &= sc->sc_dir;
-
- printdir(sc->sc_dev->dv_xname, in, sc->sc_dir, 'I');
- printdir(sc->sc_dev->dv_xname, out, ~sc->sc_dir, 'O');
+
+ printdir(device_xname(sc->sc_dev), in, sc->sc_dir, 'I');
+ printdir(device_xname(sc->sc_dev), out, ~sc->sc_dir, 'O');
callout_init(&sc->sc_timer, CALLOUT_MPSAFE);
callout_reset(&sc->sc_timer, hz*20, pcagpio_timeout, sc);
@@ -246,15 +246,15 @@ pcagpio_timeout(void *v)
o_in = sc->sc_in;
o_out &= ~sc->sc_dir;
o_in &= sc->sc_dir;
- printdir(sc->sc_dev->dv_xname, o_in, sc->sc_dir, 'I');
- printdir(sc->sc_dev->dv_xname, o_out, ~sc->sc_dir, 'O');
+ printdir(device_xname(sc->sc_dev), o_in, sc->sc_dir, 'I');
+ printdir(device_xname(sc->sc_dev), o_out, ~sc->sc_dir, 'O');
sc->sc_state = out;
sc->sc_dir = dir;
sc->sc_in = in;
out &= ~sc->sc_dir;
in &= sc->sc_dir;
- printdir(sc->sc_dev->dv_xname, in, sc->sc_dir, 'I');
- printdir(sc->sc_dev->dv_xname, out, ~sc->sc_dir, 'O');
+ printdir(device_xname(sc->sc_dev), in, sc->sc_dir, 'I');
+ printdir(device_xname(sc->sc_dev), out, ~sc->sc_dir, 'O');
}
callout_reset(&sc->sc_timer, hz*60, pcagpio_timeout, sc);
}
diff --git a/sys/dev/i2c/tsllux.c b/sys/dev/i2c/tsllux.c
index e0e453428d7..e3ddfe589f1 100644
--- a/sys/dev/i2c/tsllux.c
+++ b/sys/dev/i2c/tsllux.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tsllux.c,v 1.3 2021/01/27 02:29:48 thorpej Exp $ */
+/* $NetBSD: tsllux.c,v 1.4 2022/02/12 03:24:35 riastradh Exp $ */
/*-
* Copyright (c) 2018 Jason R. Thorpe
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tsllux.c,v 1.3 2021/01/27 02:29:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsllux.c,v 1.4 2022/02/12 03:24:35 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -154,8 +154,7 @@ tsllux_attach(device_t parent, device_t self, void *aux)
sc->sc_i2c = ia->ia_tag;
sc->sc_addr = ia->ia_addr;
- if (self->dv_cfdata != NULL &&
- self->dv_cfdata->cf_flags & TSLLUX_F_CS_PACKAGE)
+ if (device_cfdata(self)->cf_flags & TSLLUX_F_CS_PACKAGE)
sc->sc_cs_package = true;
if (iic_acquire_bus(ia->ia_tag, 0) != 0) {
diff --git a/sys/dev/isa/wss_isa.c b/sys/dev/isa/wss_isa.c
index f168e15908b..97929a5a112 100644
--- a/sys/dev/isa/wss_isa.c
+++ b/sys/dev/isa/wss_isa.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wss_isa.c,v 1.30 2019/05/08 13:40:18 isaki Exp $ */
+/* $NetBSD: wss_isa.c,v 1.31 2022/02/12 03:24:35 riastradh Exp $ */
/*
* Copyright (c) 1994 John Brezak
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wss_isa.c,v 1.30 2019/05/08 13:40:18 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wss_isa.c,v 1.31 2022/02/12 03:24:35 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -71,7 +71,7 @@ extern int wssdebug;
#define DPRINTF(x)
#endif
-static int wssfind(device_t, struct wss_softc *, int,
+static int wssfind(device_t, cfdata_t, struct wss_softc *, int,
struct isa_attach_args *);
static void madprobe(struct wss_softc *, int);
@@ -91,9 +91,7 @@ int
wss_isa_probe(device_t parent, cfdata_t match, void *aux)
{
struct isa_attach_args *ia;
- struct device probedev;
struct wss_softc probesc, *sc;
- struct ad1848_softc *ac;
ia = aux;
if (ia->ia_nio < 1)
@@ -106,13 +104,9 @@ wss_isa_probe(device_t parent, cfdata_t match, void *aux)
if (ISA_DIRECT_CONFIG(ia))
return 0;
- memset(&probedev, 0, sizeof probedev);
memset(&probesc, 0, sizeof probesc);
sc = &probesc;
- ac = &sc->sc_ad1848.sc_ad1848;
- ac->sc_dev = &probedev;
- ac->sc_dev->dv_cfdata = match;
- if (wssfind(parent, sc, 1, aux)) {
+ if (wssfind(parent, match, sc, 1, aux)) {
bus_space_unmap(sc->sc_iot, sc->sc_ioh, WSS_CODEC);
ad1848_isa_unmap(&sc->sc_ad1848);
madunmap(sc);
@@ -123,7 +117,7 @@ wss_isa_probe(device_t parent, cfdata_t match, void *aux)
}
static int
-wssfind(device_t parent, struct wss_softc *sc, int probing,
+wssfind(device_t parent, cfdata_t match, struct wss_softc *sc, int probing,
struct isa_attach_args *ia)
{
static u_char interrupt_bits[12] = {
@@ -135,7 +129,7 @@ wssfind(device_t parent, struct wss_softc *sc, int probing,
ac = &sc->sc_ad1848.sc_ad1848;
sc->sc_iot = ia->ia_iot;
- if (device_cfdata(ac->sc_dev)->cf_flags & 1)
+ if (match->cf_flags & 1)
madprobe(sc, ia->ia_io[0].ir_addr);
else
sc->mad_chip_type = MAD_NONE;
@@ -245,7 +239,7 @@ wss_isa_attach(device_t parent, device_t self, void *aux)
ac = &sc->sc_ad1848.sc_ad1848;
ac->sc_dev = self;
ia = aux;
- if (!wssfind(parent, sc, 0, ia)) {
+ if (!wssfind(parent, device_cfdata(self), sc, 0, ia)) {
aprint_error_dev(self, "wssfind failed\n");
return;
}
diff --git a/sys/dev/marvell/if_mvxpe.c b/sys/dev/marvell/if_mvxpe.c
index 1adbac52b5c..914fd7b6389 100644
--- a/sys/dev/marvell/if_mvxpe.c
+++ b/sys/dev/marvell/if_mvxpe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mvxpe.c,v 1.37 2021/12/05 07:57:38 msaitoh Exp $ */
+/* $NetBSD: if_mvxpe.c,v 1.38 2022/02/12 03:24:35 riastradh Exp $ */
/*
* Copyright (c) 2015 Internet Initiative Japan Inc.
* All rights reserved.
@@ -25,7 +25,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.37 2021/12/05 07:57:38 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.38 2022/02/12 03:24:35 riastradh Exp $");
#include "opt_multiprocessor.h"
@@ -482,7 +482,8 @@ mvxpe_attach(device_t parent, device_t self, void *aux)
* we assume phyaddress == MAC unit number here,
* but some boards may not.
*/
- mii_attach(self, mii, 0xffffffff, MII_PHY_ANY, sc->sc_dev->dv_unit, 0);
+ mii_attach(self, mii, 0xffffffff, MII_PHY_ANY, device_unit(sc->sc_dev),
+ 0);
child = LIST_FIRST(&mii->mii_phys);
if (child == NULL) {
aprint_error_dev(self, "no PHY found!\n");
diff --git a/sys/dev/marvell/mvxpsec.c b/sys/dev/marvell/mvxpsec.c
index c2c4e6372a6..3406e1d83be 100644
--- a/sys/dev/marvell/mvxpsec.c
+++ b/sys/dev/marvell/mvxpsec.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mvxpsec.c,v 1.9 2021/12/10 20:36:04 andvar Exp $ */
+/* $NetBSD: mvxpsec.c,v 1.10 2022/02/12 03:24:36 riastradh Exp $ */
/*
* Copyright (c) 2015 Internet Initiative Japan Inc.
* All rights reserved.
@@ -1036,7 +1036,7 @@ mvxpsec_init_sram(struct mvxpsec_softc *sc)
vaddr_t va;
int window;
- switch (sc->sc_dev->dv_unit) {
+ switch (device_unit(sc->sc_dev)) {
case 0:
tag = ARMADAXP_TAG_CRYPT0;
break;
diff --git a/sys/dev/pci/xmm7360.c b/sys/dev/pci/xmm7360.c
index 04bf01188fe..f30cc77a70b 100644
--- a/sys/dev/pci/xmm7360.c
+++ b/sys/dev/pci/xmm7360.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xmm7360.c,v 1.13 2021/10/18 08:15:00 hannken Exp $ */
+/* $NetBSD: xmm7360.c,v 1.14 2022/02/12 03:24:36 riastradh Exp $ */
/*
* Device driver for Intel XMM7360 LTE modems, eg. Fibocom L850-GL.
@@ -75,7 +75,7 @@ MODULE_DEVICE_TABLE(pci, xmm7360_ids);
#include "opt_gateway.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xmm7360.c,v 1.13 2021/10/18 08:15:00 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xmm7360.c,v 1.14 2022/02/12 03:24:36 riastradh Exp $");
#endif
#include <sys/param.h>
@@ -143,9 +143,9 @@ typedef void * wait_queue_head_t; /* just address for tsleep() */
#ifdef __OpenBSD__
typedef struct mutex spinlock_t;
#define dev_err(devp, fmt, ...) \
- printf("%s: " fmt, (devp)->dv_xname, ##__VA_ARGS__)
+ printf("%s: " fmt, device_xname(devp), ##__VA_ARGS__)
#define dev_info(devp, fmt, ...) \
- printf("%s: " fmt, (devp)->dv_xname, ##__VA_ARGS__)
+ printf("%s: " fmt, device_xname(devp), ##__VA_ARGS__)
#define kzalloc(size, flags) malloc(size, M_DEVBUF, M_WAITOK | M_ZERO)
#define kfree(addr) free(addr, M_DEVBUF, 0)
#define mutex_init(lock) mtx_init(lock, IPL_TTY)
@@ -481,7 +481,9 @@ struct queue_pair {
u16 page_size;
int tty_index;
int tty_needs_wake;
+#ifdef __linux__
struct device dev;
+#endif
int num;
int open;
struct mutex lock;
@@ -2220,9 +2222,9 @@ wwanc_attach(struct device *parent, struct device *self, void *aux)
/* Device initialized, can establish the interrupt now */
sc->sc_ih = pci_intr_establish(sc->sc_pc, sc->sc_pih, IPL_NET,
- wwanc_intr, sc, sc->sc_dev->dv_xname);
+ wwanc_intr, sc, device_xname(sc->sc_dev));
if (sc->sc_ih == NULL) {
- printf("%s: can't establish interrupt\n", self->dv_xname);
+ device_printf(self, "can't establish interrupt\n");
return;
}
@@ -2353,8 +2355,8 @@ wwanc_activate(struct device *self, int act)
case DVACT_SUSPEND:
if (sc->sc_resume) {
/* Refuse to suspend if resume still ongoing */
- printf("%s: not suspending, resume still ongoing\n",
- self->dv_xname);
+ device_printf(self,
+ "not suspending, resume still ongoing\n");
return EBUSY;
}
@@ -2860,7 +2862,7 @@ dma_alloc_coherent(struct device *self, size_t sz, dma_addr_t *physp, int flags)
BUS_DMA_WAITOK);
if (error) {
panic("%s: bus_dmamem_alloc(%lu) failed %d\n",
- self->dv_xname, (unsigned long)sz, error);
+ device_xname(self), (unsigned long)sz, error);
/* NOTREACHED */
}
@@ -2871,7 +2873,7 @@ dma_alloc_coherent(struct device *self, size_t sz, dma_addr_t *physp, int flags)
BUS_DMA_WAITOK | BUS_DMA_COHERENT);
if (error) {
panic("%s: bus_dmamem_alloc(%lu) failed %d\n",
- self->dv_xname, (unsigned long)sz, error);
+ device_xname(self), (unsigned long)sz, error);
/* NOTREACHED */
}
@@ -3236,7 +3238,8 @@ wwan_attach(struct device *parent, struct device *self, void *aux)
ifp->if_type = IFT_OTHER;
IFQ_SET_MAXLEN(&ifp->if_snd, xn->qp->depth);
IFQ_SET_READY(&ifp->if_snd);
- bcopy(sc_if->sc_dev->dv_xname, ifp->if_xname, IFNAMSIZ);
+ CTASSERT(DEVICE_XNAME_SIZE == IFNAMSIZ);
+ bcopy(device_xname(sc_if->sc_dev), ifp->if_xname, IFNAMSIZ);
/* Call MI attach routines. */
if_attach(ifp);
diff --git a/sys/dev/spkr.c b/sys/dev/spkr.c
index 13f6cdcb07e..afd88d31b73 100644
--- a/sys/dev/spkr.c
+++ b/sys/dev/spkr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: spkr.c,v 1.21 2021/08/07 16:19:08 thorpej Exp $ */
+/* $NetBSD: spkr.c,v 1.22 2022/02/12 03:24:36 riastradh Exp $ */
/*
* Copyright (c) 1990 Eric S. Raymond (esr@snark.thyrsus.com)
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.21 2021/08/07 16:19:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.22 2022/02/12 03:24:36 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "wsmux.h"
@@ -416,7 +416,8 @@ spkr_attach(device_t self, void (*tone)(device_t, u_int, u_int))
struct spkr_softc *sc = device_private(self);
#ifdef SPKRDEBUG
- aprint_debug("%s: entering for unit %d\n", __func__, self->dv_unit);
+ aprint_debug("%s: entering for unit %d\n", __func__,
+ device_unit(self));
#endif /* SPKRDEBUG */
sc->sc_dev = self;
sc->sc_tone = tone;
@@ -433,7 +434,8 @@ spkr_detach(device_t self, int flags)
int rc;
#ifdef SPKRDEBUG
- aprint_debug("%s: entering for unit %d\n", __func__, self->dv_unit);
+ aprint_debug("%s: entering for unit %d\n", __func__,
+ device_unit(self));
#endif /* SPKRDEBUG */
if (sc == NULL)
return ENXIO;
diff --git a/sys/dev/usb/vhci.c b/sys/dev/usb/vhci.c
index f5c46b9a774..fee8487f14b 100644
--- a/sys/dev/usb/vhci.c
+++ b/sys/dev/usb/vhci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vhci.c,v 1.22 2021/08/07 16:19:17 thorpej Exp $ */
+/* $NetBSD: vhci.c,v 1.23 2022/02/12 03:24:36 riastradh Exp $ */
/*
* Copyright (c) 2019-2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.22 2021/08/07 16:19:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.23 2022/02/12 03:24:36 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1299,7 +1299,7 @@ vhci_attach(device_t parent, device_t self, void *aux)
sc->sc_dev = self;
sc->sc_bus.ub_revision = USBREV_2_0;
sc->sc_bus.ub_hctype = USBHCTYPE_VHCI;
- sc->sc_bus.ub_busnum = self->dv_unit;
+ sc->sc_bus.ub_busnum = device_unit(self);
sc->sc_bus.ub_usedma = false;
sc->sc_bus.ub_methods = &vhci_bus_methods;
sc->sc_bus.ub_pipesize = sizeof(vhci_pipe_t);