Use __containerof() instead of home-rolled versions.
Reviewed by: imp, hselasky Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27582
This commit is contained in:
parent
f3fec471a3
commit
52ab576d74
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=368741
@ -90,8 +90,7 @@
|
||||
#include <dev/usb/controller/ehcireg.h>
|
||||
|
||||
#define EHCI_BUS2SC(bus) \
|
||||
((ehci_softc_t *)(((uint8_t *)(bus)) - \
|
||||
((uint8_t *)&(((ehci_softc_t *)0)->sc_bus))))
|
||||
__containerof(bus, ehci_softc_t, sc_bus)
|
||||
|
||||
#ifdef USB_DEBUG
|
||||
static int ehcidebug = 0;
|
||||
|
@ -79,8 +79,7 @@
|
||||
#include <dev/usb/controller/ohcireg.h>
|
||||
|
||||
#define OHCI_BUS2SC(bus) \
|
||||
((ohci_softc_t *)(((uint8_t *)(bus)) - \
|
||||
((uint8_t *)&(((ohci_softc_t *)0)->sc_bus))))
|
||||
__containerof(bus, ohci_softc_t, sc_bus)
|
||||
|
||||
#ifdef USB_DEBUG
|
||||
static int ohcidebug = 0;
|
||||
|
@ -83,8 +83,7 @@
|
||||
|
||||
#define alt_next next
|
||||
#define UHCI_BUS2SC(bus) \
|
||||
((uhci_softc_t *)(((uint8_t *)(bus)) - \
|
||||
((uint8_t *)&(((uhci_softc_t *)0)->sc_bus))))
|
||||
__containerof(bus, uhci_softc_t, sc_bus)
|
||||
|
||||
#ifdef USB_DEBUG
|
||||
static int uhcidebug = 0;
|
||||
|
@ -86,8 +86,7 @@
|
||||
#include <dev/usb/controller/xhcireg.h>
|
||||
|
||||
#define XHCI_BUS2SC(bus) \
|
||||
((struct xhci_softc *)(((uint8_t *)(bus)) - \
|
||||
((uint8_t *)&(((struct xhci_softc *)0)->sc_bus))))
|
||||
__containerof(bus, struct xhci_softc, sc_bus)
|
||||
|
||||
static SYSCTL_NODE(_hw_usb, OID_AUTO, xhci, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
|
||||
"USB XHCI");
|
||||
|
@ -153,9 +153,7 @@ struct usb_done_msg {
|
||||
};
|
||||
|
||||
#define USB_DMATAG_TO_XROOT(dpt) \
|
||||
((struct usb_xfer_root *)( \
|
||||
((uint8_t *)(dpt)) - \
|
||||
((uint8_t *)&((struct usb_xfer_root *)0)->dma_parent_tag)))
|
||||
__containerof(dpt, struct usb_xfer_root, dma_parent_tag)
|
||||
|
||||
/*
|
||||
* The following structure is used to keep information about memory
|
||||
|
Loading…
Reference in New Issue
Block a user