From patchwork Fri Sep 4 22:13:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 33129 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 22F48B7067 for ; Tue, 8 Sep 2009 23:18:07 +1000 (EST) Received: from localhost ([127.0.0.1]:38782 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ml0aA-0000rg-BH for incoming@patchwork.ozlabs.org; Tue, 08 Sep 2009 09:18:02 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ml0ZY-0000oF-E9 for qemu-devel@nongnu.org; Tue, 08 Sep 2009 09:17:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ml0ZU-0000mA-3G for qemu-devel@nongnu.org; Tue, 08 Sep 2009 09:17:24 -0400 Received: from [199.232.76.173] (port=40958 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ml0ZT-0000m4-NY for qemu-devel@nongnu.org; Tue, 08 Sep 2009 09:17:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39904) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ml0ZT-0000BW-3k for qemu-devel@nongnu.org; Tue, 08 Sep 2009 09:17:19 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n88DHHkA000524 for ; Tue, 8 Sep 2009 09:17:17 -0400 Received: from pike.pond.sub.org (vpn-10-108.str.redhat.com [10.32.10.108]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n88DHGRg018033 for ; Tue, 8 Sep 2009 09:17:17 -0400 Received: by pike.pond.sub.org (Postfix, from userid 1000) id 183D510097; Sat, 5 Sep 2009 00:13:04 +0200 (CEST) To: qemu-devel@nongnu.org From: Markus Armbruster Date: Sat, 05 Sep 2009 00:13:04 +0200 Message-ID: <87ab1a5pfz.fsf@pike.pond.sub.org> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH] qdev: Fix i6300 upcast 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 Use DO_UPCAST() instead of container_of() to go from PCIDevice to I6300State. This ensures that PCIDevice is the first member of struct I6300State. Signed-off-by: Markus Armbruster --- hw/wdt_i6300esb.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/wdt_i6300esb.c b/hw/wdt_i6300esb.c index 6927d43..fc038c8 100644 --- a/hw/wdt_i6300esb.c +++ b/hw/wdt_i6300esb.c @@ -198,7 +198,7 @@ static void i6300esb_timer_expired(void *vp) static void i6300esb_config_write(PCIDevice *dev, uint32_t addr, uint32_t data, int len) { - I6300State *d = container_of(dev, I6300State, dev); + I6300State *d = DO_UPCAST(I6300State, dev, dev); int old; i6300esb_debug("addr = %x, data = %x, len = %d\n", addr, data, len); @@ -226,7 +226,7 @@ static void i6300esb_config_write(PCIDevice *dev, uint32_t addr, static uint32_t i6300esb_config_read(PCIDevice *dev, uint32_t addr, int len) { - I6300State *d = container_of(dev, I6300State, dev); + I6300State *d = DO_UPCAST(I6300State, dev, dev); uint32_t data; i6300esb_debug ("addr = %x, len = %d\n", addr, len); @@ -360,7 +360,7 @@ static void i6300esb_map(PCIDevice *dev, int region_num, i6300esb_mem_writew, i6300esb_mem_writel, }; - I6300State *d = container_of(dev, I6300State, dev); + I6300State *d = DO_UPCAST(I6300State, dev, dev); int io_mem; i6300esb_debug("addr = %x, size = %x, type = %d\n", addr, size, type); @@ -415,7 +415,7 @@ static int i6300esb_load(QEMUFile *f, void *vp, int version) static int i6300esb_init(PCIDevice *dev) { - I6300State *d = container_of(dev, I6300State, dev); + I6300State *d = DO_UPCAST(I6300State, dev, dev); uint8_t *pci_conf; d->reboot_enabled = 1;