[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PULL 09/45] hw/sh4/sh_pci: Use DeviceState::realize rath
From: |
David Gibson |
Subject: |
Re: [Qemu-ppc] [PULL 09/45] hw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init |
Date: |
Tue, 23 Oct 2018 16:12:39 +0100 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Thu, Oct 18, 2018 at 05:03:46PM -0300, Eduardo Habkost wrote:
> From: Philippe Mathieu-Daudé <address@hidden>
>
> Move from the legacy SysBusDevice::init method to using DeviceState::realize.
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> Message-Id: <address@hidden>
> Reviewed-by: Peter Maydell <address@hidden>
> Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: David Gibson <address@hidden>
> ---
> hw/sh4/sh_pci.c | 20 +++++++++-----------
> 1 file changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/hw/sh4/sh_pci.c b/hw/sh4/sh_pci.c
> index 4ec2e35500..379d0685ed 100644
> --- a/hw/sh4/sh_pci.c
> +++ b/hw/sh4/sh_pci.c
> @@ -120,16 +120,15 @@ static void sh_pci_set_irq(void *opaque, int irq_num,
> int level)
> qemu_set_irq(pic[irq_num], level);
> }
>
> -static int sh_pci_device_init(SysBusDevice *dev)
> +static void sh_pci_device_realize(DeviceState *dev, Error **errp)
> {
> - PCIHostState *phb;
> - SHPCIState *s;
> + SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
> + SHPCIState *s = SH_PCI_HOST_BRIDGE(dev);
> + PCIHostState *phb = PCI_HOST_BRIDGE(s);
> int i;
>
> - s = SH_PCI_HOST_BRIDGE(dev);
> - phb = PCI_HOST_BRIDGE(s);
> for (i = 0; i < 4; i++) {
> - sysbus_init_irq(dev, &s->irq[i]);
> + sysbus_init_irq(sbd, &s->irq[i]);
> }
> phb->bus = pci_register_root_bus(DEVICE(dev), "pci",
> sh_pci_set_irq, sh_pci_map_irq,
> @@ -143,13 +142,12 @@ static int sh_pci_device_init(SysBusDevice *dev)
> &s->memconfig_p4, 0, 0x224);
> memory_region_init_alias(&s->isa, OBJECT(s), "sh_pci.isa",
> get_system_io(), 0, 0x40000);
> - sysbus_init_mmio(dev, &s->memconfig_p4);
> - sysbus_init_mmio(dev, &s->memconfig_a7);
> + sysbus_init_mmio(sbd, &s->memconfig_p4);
> + sysbus_init_mmio(sbd, &s->memconfig_a7);
> s->iobr = 0xfe240000;
> memory_region_add_subregion(get_system_memory(), s->iobr, &s->isa);
>
> s->dev = pci_create_simple(phb->bus, PCI_DEVFN(0, 0), "sh_pci_host");
> - return 0;
> }
>
> static void sh_pci_host_realize(PCIDevice *d, Error **errp)
> @@ -187,9 +185,9 @@ static const TypeInfo sh_pci_host_info = {
>
> static void sh_pci_device_class_init(ObjectClass *klass, void *data)
> {
> - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
> + DeviceClass *dc = DEVICE_CLASS(klass);
>
> - sdc->init = sh_pci_device_init;
> + dc->realize = sh_pci_device_realize;
> }
>
> static const TypeInfo sh_pci_device_info = {
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature
- [Qemu-ppc] [PULL 06/45] hw/timer/sun4v-rtc: Convert from DPRINTF() macro to trace events, (continued)
- [Qemu-ppc] [PULL 06/45] hw/timer/sun4v-rtc: Convert from DPRINTF() macro to trace events, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 11/45] hw/mips/gt64xxx_pci: Convert gt64120_reset() function into Device reset method, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 08/45] hw/ssi/xilinx_spi: Use DeviceState::realize rather than SysBusDevice::init, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 07/45] hw/timer/sun4v-rtc: Use DeviceState::realize rather than SysBusDevice::init, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 10/45] hw/pci-host/bonito: Use DeviceState::realize rather than SysBusDevice::init, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 09/45] hw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init, Eduardo Habkost, 2018/10/18
- Re: [Qemu-ppc] [PULL 09/45] hw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init,
David Gibson <=
- [Qemu-ppc] [PULL 12/45] hw/mips/gt64xxx_pci: Mark as bridge device, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 13/45] hw/sparc64/niagara: Model the I/O Bridge with the 'unimplemented_device', Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 14/45] hw/alpha/typhoon: Remove unuseful code, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 15/45] hw/hppa/dino: Remove unuseful code, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 16/45] hw/mips/malta: Remove unuseful code, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 17/45] machine: fix a typo, Eduardo Habkost, 2018/10/18