[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 24/24] hw/[u-x]*: pass owner to memory_region_in
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH 24/24] hw/[u-x]*: pass owner to memory_region_init_io |
Date: |
Tue, 02 Jul 2013 01:42:06 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 |
Am 25.06.2013 16:15, schrieb Paolo Bonzini:
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
> hw/usb/hcd-ehci-sysbus.c | 2 +-
> hw/usb/hcd-ehci.c | 8 ++++----
> hw/usb/hcd-ohci.c | 3 ++-
> hw/usb/hcd-uhci.c | 4 +++-
> hw/usb/hcd-xhci.c | 12 ++++++------
> hw/virtio/virtio-pci.c | 4 ++--
> hw/watchdog/wdt_i6300esb.c | 3 ++-
> hw/xen/xen_apic.c | 4 ++--
> hw/xen/xen_platform.c | 7 ++++---
> hw/xen/xen_pt.c | 4 ++--
> hw/xen/xen_pt_msi.c | 3 ++-
> hw/xtensa/xtensa_lx60.c | 2 +-
> 12 files changed, 31 insertions(+), 25 deletions(-)
>
> diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c
> index 76b4c05..54147b5 100644
> --- a/hw/usb/hcd-ehci-sysbus.c
> +++ b/hw/usb/hcd-ehci-sysbus.c
> @@ -173,7 +173,7 @@ static void fusbh200_ehci_init(Object *obj)
> FUSBH200EHCIState *f = FUSBH200_EHCI(obj);
> EHCIState *s = &i->ehci;
>
> - memory_region_init_io(&f->mem_vendor, NULL, &fusbh200_ehci_mmio_ops, s,
> + memory_region_init_io(&f->mem_vendor, OBJECT(f),
> &fusbh200_ehci_mmio_ops, s,
> "fusbh200", 0x4c);
> memory_region_add_subregion(&s->mem,
> s->opregbase + s->portscbase + 4 * s->portnr,
[snip]
I happened to notice that the scripted approach you describe in the
cover letter causes some unnecessary indirection here:
In this hunk a human could've just supplied the function argument obj.
But since OBJECT() is not a dynamic cast and f is referenced on the same
line for the MemoryRegion itself, I guess there is no harm in always
using OBJECT(f) for simplicity.
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
- Re: [Qemu-devel] [PATCH 24/24] hw/[u-x]*: pass owner to memory_region_init_io,
Andreas Färber <=