Re: [Qemu-devel] [PATCH 06/22] dma/puv3_dma: Convert sysbus init function to realize function

2018-11-20 Thread Philippe Mathieu-Daudé

On 19/11/18 13:08, Mao Zhongyi wrote:

Use DeviceClass rather than SysBusDeviceClass in
puv3_dma_class_init().

Cc: g...@mprc.pku.edu.cn

Signed-off-by: Mao Zhongyi 
Signed-off-by: Zhang Shengju 


Reviewed-by: Philippe Mathieu-Daudé 


---
  hw/dma/puv3_dma.c | 10 --
  1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/hw/dma/puv3_dma.c b/hw/dma/puv3_dma.c
index b97a6c1767..c89eade029 100644
--- a/hw/dma/puv3_dma.c
+++ b/hw/dma/puv3_dma.c
@@ -76,7 +76,7 @@ static const MemoryRegionOps puv3_dma_ops = {
  .endianness = DEVICE_NATIVE_ENDIAN,
  };
  
-static int puv3_dma_init(SysBusDevice *dev)

+static void puv3_dma_realize(DeviceState *dev, Error **errp)
  {
  PUV3DMAState *s = PUV3_DMA(dev);
  int i;
@@ -87,16 +87,14 @@ static int puv3_dma_init(SysBusDevice *dev)
  
  memory_region_init_io(>iomem, OBJECT(s), _dma_ops, s, "puv3_dma",

  PUV3_REGS_OFFSET);
-sysbus_init_mmio(dev, >iomem);
-
-return 0;
+sysbus_init_mmio(SYS_BUS_DEVICE(dev), >iomem);
  }
  
  static void puv3_dma_class_init(ObjectClass *klass, void *data)

  {
-SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
+DeviceClass *dc = DEVICE_CLASS(klass);
  
-sdc->init = puv3_dma_init;

+dc->realize = puv3_dma_realize;
  }
  
  static const TypeInfo puv3_dma_info = {






Re: [Qemu-devel] [PATCH 06/22] dma/puv3_dma: Convert sysbus init function to realize function

2018-11-20 Thread Peter Maydell
On 19 November 2018 at 12:08, Mao Zhongyi
 wrote:
> Use DeviceClass rather than SysBusDeviceClass in
> puv3_dma_class_init().
>
> Cc: g...@mprc.pku.edu.cn
>
> Signed-off-by: Mao Zhongyi 
> Signed-off-by: Zhang Shengju 
> ---
>  hw/dma/puv3_dma.c | 10 --
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/hw/dma/puv3_dma.c b/hw/dma/puv3_dma.c
> index b97a6c1767..c89eade029 100644
> --- a/hw/dma/puv3_dma.c
> +++ b/hw/dma/puv3_dma.c
> @@ -76,7 +76,7 @@ static const MemoryRegionOps puv3_dma_ops = {
>  .endianness = DEVICE_NATIVE_ENDIAN,
>  };
>
> -static int puv3_dma_init(SysBusDevice *dev)
> +static void puv3_dma_realize(DeviceState *dev, Error **errp)
>  {
>  PUV3DMAState *s = PUV3_DMA(dev);
>  int i;
> @@ -87,16 +87,14 @@ static int puv3_dma_init(SysBusDevice *dev)
>
>  memory_region_init_io(>iomem, OBJECT(s), _dma_ops, s, "puv3_dma",
>  PUV3_REGS_OFFSET);
> -sysbus_init_mmio(dev, >iomem);
> -
> -return 0;
> +sysbus_init_mmio(SYS_BUS_DEVICE(dev), >iomem);
>  }
>
>  static void puv3_dma_class_init(ObjectClass *klass, void *data)
>  {
> -SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
> +DeviceClass *dc = DEVICE_CLASS(klass);
>
> -sdc->init = puv3_dma_init;
> +dc->realize = puv3_dma_realize;
>  }
>
>  static const TypeInfo puv3_dma_info = {

Reviewed-by: Peter Maydell 

(I note that this device is missing a reset function and is
instead resetting in its init/realize function, but that's a
separate bug. It's also missing vmstate.)

thanks
-- PMM