diff mbox

pcnet-pci: fix wrong opaque given to I/O accessors

Message ID 1314021534-3212-1-git-send-email-avi@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Avi Kivity Aug. 22, 2011, 1:58 p.m. UTC
Another casualty of the memory API conversion.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 hw/pcnet-pci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Gerhard Wiesinger Aug. 22, 2011, 2:16 p.m. UTC | #1
Hello Avi,

Thnx, fixed: OK, maybe some credits :-)

Acked-by: Gerhard Wiesinger <lists@wiesinger.com>

This pattern is still present at (maybe some further problems!!!) and I 
guess it has to be fixed, too:

grep -ir 'ops, s, "' .
./hw/rtl8139.c:    memory_region_init_io(&s->bar_io, &rtl8139_io_ops, s, "rtl8139", 0x100);
./hw/rtl8139.c:    memory_region_init_io(&s->bar_mem, &rtl8139_mmio_ops, s, "rtl8139", 0x100);
./hw/mac_nvram.c:    memory_region_init_io(&s->mem, &macio_nvram_ops, s, "macio-nvram",
./hw/escc.c:    memory_region_init_io(&s->mmio, &escc_mem_ops, s, "escc",
./hw/es1370.c:    memory_region_init_io (&s->io, &es1370_io_ops, s, "es1370", 256);
./hw/usb-uhci.c:    memory_region_init_io(&s->io_bar, &uhci_ioport_ops, s, "uhci", 0x20);
./hw/usb-ehci.c:    memory_region_init_io(&s->mem, &ehci_mem_ops, s, "ehci", MMIO_SIZE);
./hw/ne2000.c:    memory_region_init_io(&s->io, &ne2000_ops, s, "ne2000", size);
./hw/ide/ahci.c:    memory_region_init_io(&s->mem, &ahci_mem_ops, s, "ahci", 0x1000);
./hw/ac97.c:    memory_region_init_io (&s->io_nam, &ac97_io_nam_ops, s, "ac97-nam", 1024);
./hw/ac97.c:    memory_region_init_io (&s->io_nabm, &ac97_io_nabm_ops, s, "ac97-nabm", 256);
./hw/lsi53c895a.c:    memory_region_init_io(&s->mmio_io, &lsi_mmio_ops, s, "lsi-mmio", 0x400);
./hw/lsi53c895a.c:    memory_region_init_io(&s->ram_io, &lsi_ram_ops, s, "lsi-ram", 0x2000);
./hw/lsi53c895a.c:    memory_region_init_io(&s->io_io, &lsi_io_ops, s, "lsi-io", 256);
./hw/mac_dbdma.c:    memory_region_init_io(&s->mem, &dbdma_ops, s, "dbdma", 0x1000);
./hw/eepro100.c:    memory_region_init_io(&s->mmio_bar, &eepro100_ops, s, "eepro100-mmio",
./hw/eepro100.c:    memory_region_init_io(&s->io_bar, &eepro100_ops, s, "eepro100-io",
./hw/eepro100.c:    memory_region_init_io(&s->flash_bar, &eepro100_ops, s, "eepro100-flash",

Ciao,
Gerhard

--
http://www.wiesinger.com/

On Mon, 22 Aug 2011, Avi Kivity wrote:

> Another casualty of the memory API conversion.
>
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
> hw/pcnet-pci.c |    4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/pcnet-pci.c b/hw/pcnet-pci.c
> index 13d9380..51e1320 100644
> --- a/hw/pcnet-pci.c
> +++ b/hw/pcnet-pci.c
> @@ -290,10 +290,10 @@ static int pci_pcnet_init(PCIDevice *pci_dev)
>     pci_conf[PCI_MAX_LAT] = 0xff;
>
>     /* Handler for memory-mapped I/O */
> -    memory_region_init_io(&d->state.mmio, &pcnet_mmio_ops, d, "pcnet-mmio",
> +    memory_region_init_io(&d->state.mmio, &pcnet_mmio_ops, s, "pcnet-mmio",
>                           PCNET_PNPMMIO_SIZE);
>
> -    memory_region_init_io(&d->io_bar, &pcnet_io_ops, d, "pcnet-io",
> +    memory_region_init_io(&d->io_bar, &pcnet_io_ops, s, "pcnet-io",
>                           PCNET_IOPORT_SIZE);
>     pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &d->io_bar);
>
> -- 
> 1.7.5.3
>
>
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Avi Kivity Aug. 24, 2011, 9:22 a.m. UTC | #2
On 08/22/2011 05:16 PM, Gerhard Wiesinger wrote:
> Hello Avi,
>
> Thnx, fixed: OK, maybe some credits :-)
>
> Acked-by: Gerhard Wiesinger <lists@wiesinger.com>
>
> This pattern is still present at (maybe some further problems!!!) and 
> I guess it has to be fixed, too:
>
> grep -ir 'ops, s, "' .
> ./hw/rtl8139.c:    memory_region_init_io(&s->bar_io, &rtl8139_io_ops, 
> s, "rtl8139", 0x100);
> ./hw/rtl8139.c:    memory_region_init_io(&s->bar_mem, 
> &rtl8139_mmio_ops, s, "rtl8139", 0x100);

Usually, when you have

   memory_region_init_io(&s->something, ..., s, ...)

it means everything is fine.  Lance/pcnet is special in this regard.
diff mbox

Patch

diff --git a/hw/pcnet-pci.c b/hw/pcnet-pci.c
index 13d9380..51e1320 100644
--- a/hw/pcnet-pci.c
+++ b/hw/pcnet-pci.c
@@ -290,10 +290,10 @@  static int pci_pcnet_init(PCIDevice *pci_dev)
     pci_conf[PCI_MAX_LAT] = 0xff;
 
     /* Handler for memory-mapped I/O */
-    memory_region_init_io(&d->state.mmio, &pcnet_mmio_ops, d, "pcnet-mmio",
+    memory_region_init_io(&d->state.mmio, &pcnet_mmio_ops, s, "pcnet-mmio",
                           PCNET_PNPMMIO_SIZE);
 
-    memory_region_init_io(&d->io_bar, &pcnet_io_ops, d, "pcnet-io",
+    memory_region_init_io(&d->io_bar, &pcnet_io_ops, s, "pcnet-io",
                           PCNET_IOPORT_SIZE);
     pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &d->io_bar);