]> git.proxmox.com Git - qemu.git/commitdiff
qdev: move DO_UPCAST() into osdep.h
authorMark McLoughlin <markmc@redhat.com>
Wed, 25 Nov 2009 18:49:03 +0000 (18:49 +0000)
committerAnthony Liguori <aliguori@us.ibm.com>
Thu, 3 Dec 2009 15:41:29 +0000 (09:41 -0600)
Nothing qdev specific about this, make it available throughtout.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/qdev.h
osdep.h

index 41642ee8a97a030d7eaae1071aadd4b5d1eed78f..8d53754d48c9e203bcf21ee81c94d081a2b93a91 100644 (file)
--- 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 4b4aad4d491a39f3fecbd8869819eddacda548c5..75b581630f2a26e7c374884f7b8b700232d5eca3 100644 (file)
--- a/osdep.h
+++ b/osdep.h
         (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)