svn commit: r213502 - user/weongyo/usb/sys/dev/usb/controller
Weongyo Jeong
weongyo at FreeBSD.org
Wed Oct 6 23:47:52 UTC 2010
Author: weongyo
Date: Wed Oct 6 23:47:52 2010
New Revision: 213502
URL: http://svn.freebsd.org/changeset/base/213502
Log:
Cleans up ..._BUS2SC() macros that don't need to use container_of()-like
macros because the usb_bus already knows how to get the softc pointer.
Modified:
user/weongyo/usb/sys/dev/usb/controller/at91dci.c
user/weongyo/usb/sys/dev/usb/controller/atmegadci.c
user/weongyo/usb/sys/dev/usb/controller/avr32dci.c
user/weongyo/usb/sys/dev/usb/controller/ehci.c
user/weongyo/usb/sys/dev/usb/controller/musb_otg.c
user/weongyo/usb/sys/dev/usb/controller/ohci.c
user/weongyo/usb/sys/dev/usb/controller/uhci.c
user/weongyo/usb/sys/dev/usb/controller/uss820dci.c
Modified: user/weongyo/usb/sys/dev/usb/controller/at91dci.c
==============================================================================
--- user/weongyo/usb/sys/dev/usb/controller/at91dci.c Wed Oct 6 23:13:30 2010 (r213501)
+++ user/weongyo/usb/sys/dev/usb/controller/at91dci.c Wed Oct 6 23:47:52 2010 (r213502)
@@ -81,9 +81,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_bus.h>
#include <dev/usb/controller/at91dci.h>
-#define AT9100_DCI_BUS2SC(bus) \
- ((struct at91dci_softc *)(((uint8_t *)(bus)) - \
- ((uint8_t *)&(((struct at91dci_softc *)0)->sc_bus))))
+#define AT9100_DCI_BUS2SC(bus) (device_get_softc((bus)->parent))
#define AT9100_DCI_PC2SC(pc) \
AT9100_DCI_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus)
Modified: user/weongyo/usb/sys/dev/usb/controller/atmegadci.c
==============================================================================
--- user/weongyo/usb/sys/dev/usb/controller/atmegadci.c Wed Oct 6 23:13:30 2010 (r213501)
+++ user/weongyo/usb/sys/dev/usb/controller/atmegadci.c Wed Oct 6 23:47:52 2010 (r213502)
@@ -73,9 +73,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_bus.h>
#include <dev/usb/controller/atmegadci.h>
-#define ATMEGA_BUS2SC(bus) \
- ((struct atmegadci_softc *)(((uint8_t *)(bus)) - \
- ((uint8_t *)&(((struct atmegadci_softc *)0)->sc_bus))))
+#define ATMEGA_BUS2SC(bus) (device_get_softc((bus)->parent))
#define ATMEGA_PC2SC(pc) \
ATMEGA_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus)
Modified: user/weongyo/usb/sys/dev/usb/controller/avr32dci.c
==============================================================================
--- user/weongyo/usb/sys/dev/usb/controller/avr32dci.c Wed Oct 6 23:13:30 2010 (r213501)
+++ user/weongyo/usb/sys/dev/usb/controller/avr32dci.c Wed Oct 6 23:47:52 2010 (r213502)
@@ -73,9 +73,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_bus.h>
#include <dev/usb/controller/avr32dci.h>
-#define AVR32_BUS2SC(bus) \
- ((struct avr32dci_softc *)(((uint8_t *)(bus)) - \
- ((uint8_t *)&(((struct avr32dci_softc *)0)->sc_bus))))
+#define AVR32_BUS2SC(bus) (device_get_softc((bus)->parent))
#define AVR32_PC2SC(pc) \
AVR32_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus)
Modified: user/weongyo/usb/sys/dev/usb/controller/ehci.c
==============================================================================
--- user/weongyo/usb/sys/dev/usb/controller/ehci.c Wed Oct 6 23:13:30 2010 (r213501)
+++ user/weongyo/usb/sys/dev/usb/controller/ehci.c Wed Oct 6 23:47:52 2010 (r213502)
@@ -84,9 +84,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/controller/ehci.h>
#include <dev/usb/controller/ehcireg.h>
-#define EHCI_BUS2SC(bus) \
- ((ehci_softc_t *)(((uint8_t *)(bus)) - \
- ((uint8_t *)&(((ehci_softc_t *)0)->sc_bus))))
+#define EHCI_BUS2SC(bus) (device_get_softc((bus)->parent))
#ifdef USB_DEBUG
static int ehcidebug = 0;
Modified: user/weongyo/usb/sys/dev/usb/controller/musb_otg.c
==============================================================================
--- user/weongyo/usb/sys/dev/usb/controller/musb_otg.c Wed Oct 6 23:13:30 2010 (r213501)
+++ user/weongyo/usb/sys/dev/usb/controller/musb_otg.c Wed Oct 6 23:47:52 2010 (r213502)
@@ -75,9 +75,7 @@
#define MUSBOTG_INTR_ENDPT 1
-#define MUSBOTG_BUS2SC(bus) \
- ((struct musbotg_softc *)(((uint8_t *)(bus)) - \
- USB_P2U(&(((struct musbotg_softc *)0)->sc_bus))))
+#define MUSBOTG_BUS2SC(bus) (device_get_softc((bus)->parent))
#define MUSBOTG_PC2SC(pc) \
MUSBOTG_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus)
Modified: user/weongyo/usb/sys/dev/usb/controller/ohci.c
==============================================================================
--- user/weongyo/usb/sys/dev/usb/controller/ohci.c Wed Oct 6 23:13:30 2010 (r213501)
+++ user/weongyo/usb/sys/dev/usb/controller/ohci.c Wed Oct 6 23:47:52 2010 (r213502)
@@ -73,9 +73,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/controller/ohci.h>
#include <dev/usb/controller/ohcireg.h>
-#define OHCI_BUS2SC(bus) \
- ((ohci_softc_t *)(((uint8_t *)(bus)) - \
- ((uint8_t *)&(((ohci_softc_t *)0)->sc_bus))))
+#define OHCI_BUS2SC(bus) (device_get_softc((bus)->parent))
#ifdef USB_DEBUG
static int ohcidebug = 0;
Modified: user/weongyo/usb/sys/dev/usb/controller/uhci.c
==============================================================================
--- user/weongyo/usb/sys/dev/usb/controller/uhci.c Wed Oct 6 23:13:30 2010 (r213501)
+++ user/weongyo/usb/sys/dev/usb/controller/uhci.c Wed Oct 6 23:47:52 2010 (r213502)
@@ -77,9 +77,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/controller/uhcireg.h>
#define alt_next next
-#define UHCI_BUS2SC(bus) \
- ((uhci_softc_t *)(((uint8_t *)(bus)) - \
- ((uint8_t *)&(((uhci_softc_t *)0)->sc_bus))))
+#define UHCI_BUS2SC(bus) (device_get_softc((bus)->parent))
#ifdef USB_DEBUG
static int uhcidebug = 0;
Modified: user/weongyo/usb/sys/dev/usb/controller/uss820dci.c
==============================================================================
--- user/weongyo/usb/sys/dev/usb/controller/uss820dci.c Wed Oct 6 23:13:30 2010 (r213501)
+++ user/weongyo/usb/sys/dev/usb/controller/uss820dci.c Wed Oct 6 23:47:52 2010 (r213502)
@@ -69,9 +69,7 @@
#include <dev/usb/usb_bus.h>
#include <dev/usb/controller/uss820dci.h>
-#define USS820_DCI_BUS2SC(bus) \
- ((struct uss820dci_softc *)(((uint8_t *)(bus)) - \
- ((uint8_t *)&(((struct uss820dci_softc *)0)->sc_bus))))
+#define USS820_DCI_BUS2SC(bus) (device_get_softc((bus)->parent))
#define USS820_DCI_PC2SC(pc) \
USS820_DCI_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus)
More information about the svn-src-user
mailing list