diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-04-27 07:37:20 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-04-27 07:37:20 +0000 |
commit | df9917aa707f4ed57d16c975ec93f8311cc90003 (patch) | |
tree | ab40befc2964b90a83cf9f11084400925fd250ee /sys/dev | |
parent | e4cb456b7970ad88d1c11b385e9f69c0327f0c9e (diff) |
Make use of DEVNAME(), from David Higgs.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/upd.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/usb/upd.c b/sys/dev/usb/upd.c index 70c3e5f4e8c..170ed1a6691 100644 --- a/sys/dev/usb/upd.c +++ b/sys/dev/usb/upd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: upd.c,v 1.14 2015/04/01 11:44:44 mpi Exp $ */ +/* $OpenBSD: upd.c,v 1.15 2015/04/27 07:37:19 mpi Exp $ */ /* * Copyright (c) 2014 Andre de Oliveira <andre@openbsd.org> @@ -39,6 +39,8 @@ #define DPRINTF(x) #endif +#define DEVNAME(sc) ((sc)->sc_hdev.sc_dev.dv_xname) + struct upd_usage_entry { uint8_t usage_pg; uint8_t usage_id; @@ -164,12 +166,12 @@ upd_attach(struct device *parent, struct device *self, void *aux) sc->sc_sensors = NULL; sc->sc_max_sensors = nitems(upd_usage_table); - strlcpy(sc->sc_sensordev.xname, sc->sc_hdev.sc_dev.dv_xname, + strlcpy(sc->sc_sensordev.xname, DEVNAME(sc), sizeof(sc->sc_sensordev.xname)); sc->sc_max_repid = uha->parent->sc_nrepid; DPRINTF(("\nupd: devname=%s sc_max_repid=%d\n", - sc->sc_hdev.sc_dev.dv_xname, sc->sc_max_repid)); + DEVNAME(sc), sc->sc_max_repid)); sc->sc_reports = mallocarray(sc->sc_max_repid, sizeof(struct upd_report), M_USBDEV, M_WAITOK | M_ZERO); @@ -363,8 +365,7 @@ upd_update_sensors(struct upd_softc *sc, uint8_t *buf, unsigned int len, sensor->ksensor.value = hdata * adjust; sensor->ksensor.status = SENSOR_S_OK; sensor->ksensor.flags &= ~SENSOR_FINVALID; - DPRINTF(("%s: hidget data: %lu\n", - sc->sc_sensordev.xname, hdata)); + DPRINTF(("%s: hidget data: %lu\n", DEVNAME(sc), hdata)); } } |