Patchwork [10/44] qdev: move DO_UPCAST() into osdep.h

login
register
mail settings
Submitter Mark McLoughlin
Date Nov. 25, 2009, 6:49 p.m.
Message ID <1259174977-26212-11-git-send-email-markmc@redhat.com>
Download mbox | patch
Permalink /patch/39422/
State New
Headers show

Comments

Mark McLoughlin - Nov. 25, 2009, 6:49 p.m.
Nothing qdev specific about this, make it available throughtout.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
 hw/qdev.h |   10 ----------
 osdep.h   |   10 ++++++++++
 2 files changed, 10 insertions(+), 10 deletions(-)

Patch

diff --git a/hw/qdev.h b/hw/qdev.h
index 41642ee..8d53754 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -154,16 +154,6 @@  CharDriverState *qdev_init_chardev(DeviceState *dev);
 
 BusState *qdev_get_parent_bus(DeviceState *dev);
 
-/* Convert from a base type to a parent type, with compile time checking.  */
-#ifdef __GNUC__
-#define DO_UPCAST(type, field, dev) ( __extension__ ( { \
-    char __attribute__((unused)) offset_must_be_zero[ \
-        -offsetof(type, field)]; \
-    container_of(dev, type, field);}))
-#else
-#define DO_UPCAST(type, field, dev) container_of(dev, type, field)
-#endif
-
 /*** BUS API. ***/
 
 void qbus_create_inplace(BusState *bus, BusInfo *info,
diff --git a/osdep.h b/osdep.h
index 4b4aad4..75b5816 100644
--- a/osdep.h
+++ b/osdep.h
@@ -37,6 +37,16 @@ 
         (type *) ((char *) __mptr - offsetof(type, member));})
 #endif
 
+/* Convert from a base type to a parent type, with compile time checking.  */
+#ifdef __GNUC__
+#define DO_UPCAST(type, field, dev) ( __extension__ ( { \
+    char __attribute__((unused)) offset_must_be_zero[ \
+        -offsetof(type, field)]; \
+    container_of(dev, type, field);}))
+#else
+#define DO_UPCAST(type, field, dev) container_of(dev, type, field)
+#endif
+
 #define typeof_field(type, field) typeof(((type *)0)->field)
 #define type_check(t1,t2) ((t1*)0 - (t2*)0)