From patchwork Wed Nov 25 18:49:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark McLoughlin X-Patchwork-Id: 39422 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A1371B6EF4 for ; Thu, 26 Nov 2009 06:07:02 +1100 (EST) Received: from localhost ([127.0.0.1]:54093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDNCd-0003kO-Ra for incoming@patchwork.ozlabs.org; Wed, 25 Nov 2009 14:06:59 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDMyg-0007NR-H7 for qemu-devel@nongnu.org; Wed, 25 Nov 2009 13:52:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDMyY-0007HG-R6 for qemu-devel@nongnu.org; Wed, 25 Nov 2009 13:52:32 -0500 Received: from [199.232.76.173] (port=48993 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDMyX-0007Gn-JN for qemu-devel@nongnu.org; Wed, 25 Nov 2009 13:52:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47928) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NDMyW-0000E1-RT for qemu-devel@nongnu.org; Wed, 25 Nov 2009 13:52:25 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAPIqNZS024056 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 25 Nov 2009 13:52:23 -0500 Received: from blaa.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nAPIqMKF031165; Wed, 25 Nov 2009 13:52:23 -0500 Received: by blaa.localdomain (Postfix, from userid 500) id 8FB9AB0B4; Wed, 25 Nov 2009 18:49:40 +0000 (GMT) From: Mark McLoughlin To: qemu-devel@nongnu.org Date: Wed, 25 Nov 2009 18:49:03 +0000 Message-Id: <1259174977-26212-11-git-send-email-markmc@redhat.com> In-Reply-To: <1259174977-26212-1-git-send-email-markmc@redhat.com> References: <1259174977-26212-1-git-send-email-markmc@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Mark McLoughlin Subject: [Qemu-devel] [PATCH 10/44] qdev: move DO_UPCAST() into osdep.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Nothing qdev specific about this, make it available throughtout. Signed-off-by: Mark McLoughlin --- hw/qdev.h | 10 ---------- osdep.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) 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)