summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2014-10-30 18:29:59 +0000
committermpi <mpi@openbsd.org>2014-10-30 18:29:59 +0000
commitd91b5831f2c09c2e347dd91f3d932c1e7388c943 (patch)
treeb0fcecb62ab21d2d57ec4e39962832dda549e57c
parentDo not enable interrupts before attaching usb(4), fix a panic when an (diff)
downloadwireguard-openbsd-d91b5831f2c09c2e347dd91f3d932c1e7388c943.tar.xz
wireguard-openbsd-d91b5831f2c09c2e347dd91f3d932c1e7388c943.zip
Do not use void * for pointer artithmetics, it's a GNU extension, from
Patrick Wildt.
-rw-r--r--sys/dev/usb/xhci.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c
index 07a902832b0..aae4d23b633 100644
--- a/sys/dev/usb/xhci.c
+++ b/sys/dev/usb/xhci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xhci.c,v 1.30 2014/10/30 18:25:08 mpi Exp $ */
+/* $OpenBSD: xhci.c,v 1.31 2014/10/30 18:29:59 mpi Exp $ */
/*
* Copyright (c) 2014 Martin Pieuchot
@@ -51,7 +51,7 @@ int xhcidebug = 3;
#define DEVNAME(sc) ((sc)->sc_bus.bdev.dv_xname)
-#define TRBOFF(ring, trb) ((void *)(trb) - (void *)((ring).trbs))
+#define TRBOFF(ring, trb) ((char *)(trb) - (char *)((ring).trbs))
struct pool *xhcixfer;
@@ -2295,7 +2295,7 @@ xhci_device_generic_start(struct usbd_xfer *xfer)
XHCI_TRB_TYPE_NORMAL | XHCI_TRB_ISP | XHCI_TRB_IOC | toggle
);
- usb_syncmem(&xp->ring.dma, ((void *)trb - (void *)xp->ring.trbs),
+ usb_syncmem(&xp->ring.dma, TRBOFF(xp->ring, trb),
sizeof(struct xhci_trb), BUS_DMASYNC_PREWRITE);
XDWRITE4(sc, XHCI_DOORBELL(xp->slot), xp->dci);