diff options
| author | riastradh <riastradh@NetBSD.org> | 2022-02-12 03:24:34 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2022-02-12 03:24:34 +0000 |
| commit | e8b15cb7d5710c8b2b2da941d8a038f6fd5c4d45 (patch) | |
| tree | 01ec573f838c0bce5b4bc8790bb469529d164de3 /sys/dev/i2c | |
| parent | 50cc4c85087facfd6c5ac7978a7156437eff8880 (diff) | |
sys: Fix various abuse of struct device internals.
Will help to make struct device opaque later.
Diffstat (limited to 'sys/dev/i2c')
| -rw-r--r-- | sys/dev/i2c/ihidev.c | 41 | ||||
| -rw-r--r-- | sys/dev/i2c/pcagpio.c | 18 | ||||
| -rw-r--r-- | sys/dev/i2c/tsllux.c | 7 |
3 files changed, 33 insertions, 33 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) { |
