From patchwork Mon Jul 1 10:18:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hu Tao X-Patchwork-Id: 256060 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D18C22C00A7 for ; Mon, 1 Jul 2013 20:20:26 +1000 (EST) Received: from localhost ([::1]:59630 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtbDc-00008j-SW for incoming@patchwork.ozlabs.org; Mon, 01 Jul 2013 06:20:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtbCz-0008SB-A5 for qemu-devel@nongnu.org; Mon, 01 Jul 2013 06:19:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtbCw-0001Gz-RU for qemu-devel@nongnu.org; Mon, 01 Jul 2013 06:19:45 -0400 Received: from [222.73.24.84] (port=7000 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtbCw-0001Fm-FY for qemu-devel@nongnu.org; Mon, 01 Jul 2013 06:19:42 -0400 X-IronPort-AV: E=Sophos;i="4.87,973,1363104000"; d="scan'208";a="7747756" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 01 Jul 2013 18:16:42 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r61AJcUq015555 for ; Mon, 1 Jul 2013 18:19:38 +0800 Received: from G08FNSTD100614.fnst.cn.fujitsu.com ([10.167.233.156]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013070118181371-2618435 ; Mon, 1 Jul 2013 18:18:13 +0800 From: Hu Tao To: qemu-devel Date: Mon, 1 Jul 2013 18:18:21 +0800 Message-Id: <4bd0ea89802621c5782e4a6c6908a07500efa98c.1372673778.git.hutao@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/07/01 18:18:13, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/07/01 18:18:14, Serialize complete at 2013/07/01 18:18:14 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 222.73.24.84 Subject: [Qemu-devel] [PATCH v2 05/26] i440fx: use type-safe cast instead of directly access of parent dev X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Hu Tao --- hw/pci-host/piix.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index 801341a..e2437df 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -121,22 +121,24 @@ static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx) static void i440fx_update_memory_mappings(PCII440FXState *d) { int i; + PCIDevice *pd = PCI_DEVICE(d); memory_region_transaction_begin(); for (i = 0; i < 13; i++) { pam_update(&d->pam_regions[i], i, - d->dev.config[I440FX_PAM + ((i + 1) / 2)]); + pd->config[I440FX_PAM + ((i + 1) / 2)]); } - smram_update(&d->smram_region, d->dev.config[I440FX_SMRAM], d->smm_enabled); + smram_update(&d->smram_region, pd->config[I440FX_SMRAM], d->smm_enabled); memory_region_transaction_commit(); } static void i440fx_set_smm(int val, void *arg) { PCII440FXState *d = arg; + PCIDevice *pd = PCI_DEVICE(d); memory_region_transaction_begin(); - smram_set_smm(&d->smm_enabled, val, d->dev.config[I440FX_SMRAM], + smram_set_smm(&d->smm_enabled, val, pd->config[I440FX_SMRAM], &d->smram_region); memory_region_transaction_commit(); } @@ -158,9 +160,10 @@ static void i440fx_write_config(PCIDevice *dev, static int i440fx_load_old(QEMUFile* f, void *opaque, int version_id) { PCII440FXState *d = opaque; + PCIDevice *pd = PCI_DEVICE(d); int ret, i; - ret = pci_device_load(&d->dev, f); + ret = pci_device_load(pd, f); if (ret < 0) return ret; i440fx_update_memory_mappings(d);