From nobody Thu Sep 19 02:05:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547170001279814.1421447014403; Thu, 10 Jan 2019 17:26:41 -0800 (PST) Received: from localhost ([127.0.0.1]:49705 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghlao-0007aC-VY for importer@patchew.org; Thu, 10 Jan 2019 20:26:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghlYv-0006SA-Md for qemu-devel@nongnu.org; Thu, 10 Jan 2019 20:24:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghlYt-0000vr-Ru for qemu-devel@nongnu.org; Thu, 10 Jan 2019 20:24:41 -0500 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]:50532) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghlYr-0000qb-Rn for qemu-devel@nongnu.org; Thu, 10 Jan 2019 20:24:39 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id A22297456BB; Fri, 11 Jan 2019 02:24:32 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 8FEB77456A0; Fri, 11 Jan 2019 02:24:24 +0100 (CET) Message-Id: <7a31c155c9899869794499d841d30c7ef32aae47.1547166960.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Date: Fri, 11 Jan 2019 01:36:00 +0100 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:738:2001:2001::2001 Subject: [Qemu-devel] [PATCH 2/5] cmd646: Remove IDEBus from CMD646BAR X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , John Snow , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The cmd646 io mem ops callbacks only need the IDEBus which is currently passed via a CMD646BAR struct. No need to wrap it up like that, we can pass it directly to these callbacks which then allows to drop the IDEBus from the CMD646BAR. Signed-off-by: BALATON Zoltan --- hw/ide/cmd646.c | 29 ++++++++++++++--------------- include/hw/ide/pci.h | 1 - 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c index 41c1831f9a..c24f71e219 100644 --- a/hw/ide/cmd646.c +++ b/hw/ide/cmd646.c @@ -53,23 +53,23 @@ static void cmd646_update_irq(PCIDevice *pd); static uint64_t cmd646_cmd_read(void *opaque, hwaddr addr, unsigned size) { - CMD646BAR *cmd646bar =3D opaque; + IDEBus *bus =3D opaque; =20 if (addr !=3D 2 || size !=3D 1) { return ((uint64_t)1 << (size * 8)) - 1; } - return ide_status_read(cmd646bar->bus, addr + 2); + return ide_status_read(bus, addr + 2); } =20 static void cmd646_cmd_write(void *opaque, hwaddr addr, uint64_t data, unsigned size) { - CMD646BAR *cmd646bar =3D opaque; + IDEBus *bus =3D opaque; =20 if (addr !=3D 2 || size !=3D 1) { return; } - ide_cmd_write(cmd646bar->bus, addr + 2, data); + ide_cmd_write(bus, addr + 2, data); } =20 static const MemoryRegionOps cmd646_cmd_ops =3D { @@ -81,15 +81,15 @@ static const MemoryRegionOps cmd646_cmd_ops =3D { static uint64_t cmd646_data_read(void *opaque, hwaddr addr, unsigned size) { - CMD646BAR *cmd646bar =3D opaque; + IDEBus *bus =3D opaque; =20 if (size =3D=3D 1) { - return ide_ioport_read(cmd646bar->bus, addr); + return ide_ioport_read(bus, addr); } else if (addr =3D=3D 0) { if (size =3D=3D 2) { - return ide_data_readw(cmd646bar->bus, addr); + return ide_data_readw(bus, addr); } else { - return ide_data_readl(cmd646bar->bus, addr); + return ide_data_readl(bus, addr); } } return ((uint64_t)1 << (size * 8)) - 1; @@ -98,15 +98,15 @@ static uint64_t cmd646_data_read(void *opaque, hwaddr a= ddr, static void cmd646_data_write(void *opaque, hwaddr addr, uint64_t data, unsigned size) { - CMD646BAR *cmd646bar =3D opaque; + IDEBus *bus =3D opaque; =20 if (size =3D=3D 1) { - ide_ioport_write(cmd646bar->bus, addr, data); + ide_ioport_write(bus, addr, data); } else if (addr =3D=3D 0) { if (size =3D=3D 2) { - ide_data_writew(cmd646bar->bus, addr, data); + ide_data_writew(bus, addr, data); } else { - ide_data_writel(cmd646bar->bus, addr, data); + ide_data_writel(bus, addr, data); } } } @@ -122,10 +122,9 @@ static void setup_cmd646_bar(PCIIDEState *d, int bus_n= um) IDEBus *bus =3D &d->bus[bus_num]; CMD646BAR *bar =3D &d->cmd646_bar[bus_num]; =20 - bar->bus =3D bus; - memory_region_init_io(&bar->cmd, OBJECT(d), &cmd646_cmd_ops, bar, + memory_region_init_io(&bar->cmd, OBJECT(d), &cmd646_cmd_ops, bus, "cmd646-cmd", 4); - memory_region_init_io(&bar->data, OBJECT(d), &cmd646_data_ops, bar, + memory_region_init_io(&bar->data, OBJECT(d), &cmd646_data_ops, bus, "cmd646-data", 8); } =20 diff --git a/include/hw/ide/pci.h b/include/hw/ide/pci.h index ed723acfb4..013d7937d2 100644 --- a/include/hw/ide/pci.h +++ b/include/hw/ide/pci.h @@ -40,7 +40,6 @@ typedef struct BMDMAState { typedef struct CMD646BAR { MemoryRegion cmd; MemoryRegion data; - IDEBus *bus; } CMD646BAR; =20 #define TYPE_PCI_IDE "pci-ide" --=20 2.13.7