From patchwork Wed Oct 14 11:37:48 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 35951 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 C4D0DB7B74 for ; Wed, 14 Oct 2009 22:53:29 +1100 (EST) Received: from localhost ([127.0.0.1]:35377 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1My2Q3-0002lD-09 for incoming@patchwork.ozlabs.org; Wed, 14 Oct 2009 07:53:27 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1My2Bg-0002MV-Ey for qemu-devel@nongnu.org; Wed, 14 Oct 2009 07:38:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1My2Bb-0002GK-Gc for qemu-devel@nongnu.org; Wed, 14 Oct 2009 07:38:35 -0400 Received: from [199.232.76.173] (port=41242 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1My2Ba-0002GA-GD for qemu-devel@nongnu.org; Wed, 14 Oct 2009 07:38:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61799) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1My2BZ-0006DI-W0 for qemu-devel@nongnu.org; Wed, 14 Oct 2009 07:38:30 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9EBcTXU007618 for ; Wed, 14 Oct 2009 07:38:29 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9EBcIEx006321; Wed, 14 Oct 2009 07:38:28 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 14 Oct 2009 13:37:48 +0200 Message-Id: <8224ed67b2605f915bc41854ea7121c292c33362.1255520033.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 08/13] ide: include bus in MMIOState 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 Change pointer to struct by embedded struct. Adjust all callers Signed-off-by: Juan Quintela --- hw/ide/mmio.c | 34 ++++++++++++++-------------------- 1 files changed, 14 insertions(+), 20 deletions(-) diff --git a/hw/ide/mmio.c b/hw/ide/mmio.c index 7a6bf32..8c1ee04 100644 --- a/hw/ide/mmio.c +++ b/hw/ide/mmio.c @@ -37,31 +37,29 @@ */ typedef struct { - IDEBus *bus; + IDEBus bus; int shift; } MMIOState; static uint32_t mmio_ide_read (void *opaque, target_phys_addr_t addr) { MMIOState *s = opaque; - IDEBus *bus = s->bus; addr >>= s->shift; if (addr & 7) - return ide_ioport_read(bus, addr); + return ide_ioport_read(&s->bus, addr); else - return ide_data_readw(bus, 0); + return ide_data_readw(&s->bus, 0); } static void mmio_ide_write (void *opaque, target_phys_addr_t addr, uint32_t val) { MMIOState *s = opaque; - IDEBus *bus = s->bus; addr >>= s->shift; if (addr & 7) - ide_ioport_write(bus, addr, val); + ide_ioport_write(&s->bus, addr, val); else - ide_data_writew(bus, 0, val); + ide_data_writew(&s->bus, 0, val); } static CPUReadMemoryFunc * const mmio_ide_reads[] = { @@ -79,16 +77,14 @@ static CPUWriteMemoryFunc * const mmio_ide_writes[] = { static uint32_t mmio_ide_status_read (void *opaque, target_phys_addr_t addr) { MMIOState *s= opaque; - IDEBus *bus = s->bus; - return ide_status_read(bus, 0); + return ide_status_read(&s->bus, 0); } static void mmio_ide_cmd_write (void *opaque, target_phys_addr_t addr, uint32_t val) { MMIOState *s = opaque; - IDEBus *bus = s->bus; - ide_cmd_write(bus, 0, val); + ide_cmd_write(&s->bus, 0, val); } static CPUReadMemoryFunc * const mmio_ide_status[] = { @@ -107,18 +103,18 @@ static void mmio_ide_save(QEMUFile* f, void *opaque) { MMIOState *s = opaque; - idebus_save(f, s->bus); - ide_save(f, &s->bus->ifs[0]); - ide_save(f, &s->bus->ifs[1]); + idebus_save(f, &s->bus); + ide_save(f, &s->bus.ifs[0]); + ide_save(f, &s->bus.ifs[1]); } static int mmio_ide_load(QEMUFile* f, void *opaque, int version_id) { MMIOState *s = opaque; - idebus_load(f, s->bus, version_id); - ide_load(f, &s->bus->ifs[0], version_id); - ide_load(f, &s->bus->ifs[1], version_id); + idebus_load(f, &s->bus, version_id); + ide_load(f, &s->bus.ifs[0], version_id); + ide_load(f, &s->bus.ifs[1], version_id); return 0; } @@ -127,12 +123,10 @@ void mmio_ide_init (target_phys_addr_t membase, target_phys_addr_t membase2, DriveInfo *hd0, DriveInfo *hd1) { MMIOState *s = qemu_mallocz(sizeof(MMIOState)); - IDEBus *bus = qemu_mallocz(sizeof(*bus)); int mem1, mem2; - ide_init2(bus, hd0, hd1, irq); + ide_init2(&s->bus, hd0, hd1, irq); - s->bus = bus; s->shift = shift; mem1 = cpu_register_io_memory(mmio_ide_reads, mmio_ide_writes, s);