summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2017-05-30 17:47:12 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2017-05-30 17:47:12 +0000
commit0ebee4904a786b2ac3c6c011dee11549222502ff (patch)
treec5e169a43ac6157593bfbcd6171f0a3186b5ffab /sys/dev
parentf0e833035b5666bc5c0261f31890d8fc7826c571 (diff)
Replace nifty DBGPRINT() with a more familiar DPRINTF() and adjust
the formats to add in the __func__ and "\n" being magically added by DBGPRINT(). Fixes a few botches by certain devs who assumed DBGPRINT() must be just like DPRINTF. ok sf@ reyk@ on earlier version
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pv/if_vio.c11
-rw-r--r--sys/dev/pv/vioblk.c21
-rw-r--r--sys/dev/pv/viocon.c16
3 files changed, 25 insertions, 23 deletions
diff --git a/sys/dev/pv/if_vio.c b/sys/dev/pv/if_vio.c
index 1762e4325bb..842ceee5d1e 100644
--- a/sys/dev/pv/if_vio.c
+++ b/sys/dev/pv/if_vio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vio.c,v 1.2 2017/01/22 10:17:39 dlg Exp $ */
+/* $OpenBSD: if_vio.c,v 1.3 2017/05/30 17:47:11 krw Exp $ */
/*
* Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg.
@@ -55,9 +55,9 @@
#endif
#if VIRTIO_DEBUG
-#define DBGPRINT(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
+#define DPRINTF(x...) printf(x)
#else
-#define DBGPRINT(fmt, args...)
+#define DPRINTF(x...)
#endif
/*
@@ -1035,7 +1035,8 @@ vio_rxeof(struct vio_softc *sc)
}
}
if (m0 != NULL) {
- DBGPRINT("expected %d buffers, got %d", (int)hdr->num_buffers,
+ DPRINTF("%s: expected %d buffers, got %d\n", __func__,
+ (int)hdr->num_buffers,
(int)hdr->num_buffers - bufs_left);
ifp->if_ierrors++;
m_freem(m0);
@@ -1263,7 +1264,7 @@ vio_ctrl_rx(struct vio_softc *sc, int cmd, int onoff)
r = EIO;
}
- DBGPRINT("cmd %d %d: %d", cmd, (int)onoff, r);
+ DPRINTF("%s: cmd %d %d: %d\n", __func__, cmd, (int)onoff, r);
out:
vio_ctrl_wakeup(sc, FREE);
return r;
diff --git a/sys/dev/pv/vioblk.c b/sys/dev/pv/vioblk.c
index da64f8f5924..82f63ce03f0 100644
--- a/sys/dev/pv/vioblk.c
+++ b/sys/dev/pv/vioblk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vioblk.c,v 1.5 2017/05/30 12:47:47 krw Exp $ */
+/* $OpenBSD: vioblk.c,v 1.6 2017/05/30 17:47:11 krw Exp $ */
/*
* Copyright (c) 2012 Stefan Fritsch.
@@ -156,9 +156,9 @@ int vioblk_match(struct device *parent, void *match, void *aux)
}
#if VIRTIO_DEBUG > 0
-#define DBGPRINT(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
+#define DPRINTF(x...) printf(x)
#else
-#define DBGPRINT(fmt, args...) do {} while (0)
+#define DPRINTF(x...) do {} while (0)
#endif
void
@@ -247,7 +247,7 @@ vioblk_attach(struct device *parent, struct device *self, void *aux)
sc->sc_link.adapter_buswidth = 2;
sc->sc_link.luns = 1;
sc->sc_link.adapter_target = 2;
- DBGPRINT("; qsize: %d", qsize);
+ DPRINTF("%s: qsize: %d\n", __func__, qsize);
if (features & VIRTIO_BLK_F_RO)
sc->sc_link.flags |= SDEV_READONLY;
@@ -285,7 +285,7 @@ vioblk_req_get(void *cookie)
SLIST_REMOVE_HEAD(&sc->sc_freelist, vr_list);
mtx_leave(&sc->sc_vr_mtx);
- DBGPRINT("vioblk_req_get: %p\n", vr);
+ DPRINTF("%s: %p\n", __func__, vr);
return vr;
}
@@ -296,7 +296,7 @@ vioblk_req_put(void *cookie, void *io)
struct vioblk_softc *sc = cookie;
struct virtio_blk_req *vr = io;
- DBGPRINT("vioblk_req_put: %p\n", vr);
+ DPRINTF("%s: %p\n", __func__, vr);
mtx_enter(&sc->sc_vr_mtx);
/*
@@ -356,7 +356,7 @@ vioblk_vq_done1(struct vioblk_softc *sc, struct virtio_softc *vsc,
if (vr->vr_status != VIRTIO_BLK_S_OK) {
- DBGPRINT("EIO");
+ DPRINTF("%s: EIO\n", __func__);
xs->error = XS_DRIVER_STUFFUP;
xs->resid = xs->datalen;
} else {
@@ -695,14 +695,15 @@ vioblk_alloc_reqs(struct vioblk_softc *sc, int qsize)
*/
vd = &vq->vq_desc[slot];
for (r = 0; r < ALLOC_SEGS - 1; r++) {
- DBGPRINT("vd[%d].next = %d should be %d\n",
- r, vd[r].next, (slot + r + 1));
+ DPRINTF("%s: vd[%d].next = %d should be %d\n",
+ __func__, r, vd[r].next, (slot + r + 1));
if (vd[r].next != (slot + r + 1))
return i;
}
if (r == (ALLOC_SEGS -1) && vd[r].next != 0)
return i;
- DBGPRINT("Reserved slots are contiguous as required!\n");
+ DPRINTF("%s: reserved slots are contiguous (good!)\n",
+ __func__);
}
vr->vr_qe_index = slot;
diff --git a/sys/dev/pv/viocon.c b/sys/dev/pv/viocon.c
index d573ae2736a..bc1eb93c0b7 100644
--- a/sys/dev/pv/viocon.c
+++ b/sys/dev/pv/viocon.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: viocon.c,v 1.1 2017/01/21 11:22:38 reyk Exp $ */
+/* $OpenBSD: viocon.c,v 1.2 2017/05/30 17:47:11 krw Exp $ */
/*
* Copyright (c) 2013-2015 Stefan Fritsch <sf@sfritsch.de>
@@ -43,9 +43,9 @@
#define VIOCON_DEBUG 0
#if VIOCON_DEBUG
-#define DBGPRINT(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
+#define DPRINTF(x...) printf(x)
#else
-#define DBGPRINT(fmt, args...)
+#define DPRINTF(x...)
#endif
struct virtio_feature_name viocon_feature_names[] = {
@@ -196,7 +196,7 @@ viocon_attach(struct device *parent, struct device *self, void *aux)
viocon_feature_names);
printf("\n");
- DBGPRINT("softc: %p\n", sc);
+ DPRINTF("%s: softc: %p\n", __func__, sc);
if (viocon_port_create(sc, 0) != 0) {
printf("\n%s: viocon_port_create failed\n", __func__);
goto err;
@@ -225,7 +225,7 @@ viocon_port_create(struct viocon_softc *sc, int portidx)
return ENOMEM;
sc->sc_ports[portidx] = vp;
vp->vp_sc = sc;
- DBGPRINT("vp: %p\n", vp);
+ DPRINTF("%s: vp: %p\n", __func__, vp);
if (portidx == 0)
rxidx = 0;
@@ -242,7 +242,7 @@ viocon_port_create(struct viocon_softc *sc, int portidx)
vp->vp_rx = &vsc->sc_vqs[rxidx];
vp->vp_rx->vq_done = viocon_rx_intr;
vp->vp_si = softintr_establish(IPL_TTY, viocon_rx_soft, vp);
- DBGPRINT("rx: %p\n", vp->vp_rx);
+ DPRINTF("%s: rx: %p\n", __func__, vp->vp_rx);
snprintf(name, sizeof(name), "p%dtx", portidx);
if (virtio_alloc_vq(vsc, &vsc->sc_vqs[txidx], txidx, BUFSIZE, 1,
@@ -252,7 +252,7 @@ viocon_port_create(struct viocon_softc *sc, int portidx)
}
vp->vp_tx = &vsc->sc_vqs[txidx];
vp->vp_tx->vq_done = viocon_tx_intr;
- DBGPRINT("tx: %p\n", vp->vp_tx);
+ DPRINTF("%s: tx: %p\n", __func__, vp->vp_tx);
vsc->sc_nvqs += 2;
@@ -289,7 +289,7 @@ viocon_port_create(struct viocon_softc *sc, int portidx)
tp->t_hwiflow = vioconhwiflow;
tp->t_dev = (sc->sc_dev.dv_unit << 4) | portidx;
vp->vp_tty = tp;
- DBGPRINT("tty: %p\n", tp);
+ DPRINTF("%s: tty: %p\n", __func__, tp);
virtio_start_vq_intr(vsc, vp->vp_rx);
virtio_start_vq_intr(vsc, vp->vp_tx);