[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 05/14] dp8393x: replace PROP_PTR with PROP_LINK
From: |
Peter Maydell |
Subject: |
Re: [PATCH 05/14] dp8393x: replace PROP_PTR with PROP_LINK |
Date: |
Fri, 18 Oct 2019 18:49:43 +0100 |
On Fri, 18 Oct 2019 at 16:42, Marc-André Lureau
<address@hidden> wrote:
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
> hw/mips/mips_jazz.c | 3 ++-
> hw/net/dp8393x.c | 7 +++----
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
> index 8d010a0b6e..878925a963 100644
> --- a/hw/mips/mips_jazz.c
> +++ b/hw/mips/mips_jazz.c
> @@ -284,7 +284,8 @@ static void mips_jazz_init(MachineState *machine,
> dev = qdev_create(NULL, "dp8393x");
> qdev_set_nic_properties(dev, nd);
> qdev_prop_set_uint8(dev, "it_shift", 2);
> - qdev_prop_set_ptr(dev, "dma_mr", rc4030_dma_mr);
> + object_property_set_link(OBJECT(dev), OBJECT(rc4030_dma_mr),
> + "dma_mr", &error_abort);
> qdev_init_nofail(dev);
> sysbus = SYS_BUS_DEVICE(dev);
> sysbus_mmio_map(sysbus, 0, 0x80001000);
> diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
> index a5678e11fa..946c7a8f64 100644
> --- a/hw/net/dp8393x.c
> +++ b/hw/net/dp8393x.c
> @@ -173,7 +173,7 @@ typedef struct dp8393xState {
> int loopback_packet;
>
> /* Memory access */
> - void *dma_mr;
> + MemoryRegion *dma_mr;
> AddressSpace as;
> } dp8393xState;
>
> @@ -922,7 +922,8 @@ static const VMStateDescription vmstate_dp8393x = {
>
> static Property dp8393x_properties[] = {
> DEFINE_NIC_PROPERTIES(dp8393xState, conf),
> - DEFINE_PROP_PTR("dma_mr", dp8393xState, dma_mr),
> + DEFINE_PROP_LINK("dma_mr", dp8393xState, dma_mr,
> + TYPE_MEMORY_REGION, MemoryRegion *),
> DEFINE_PROP_UINT8("it_shift", dp8393xState, it_shift, 0),
> DEFINE_PROP_END_OF_LIST(),
> };
Link property is the correct way to pass a MemoryRegion to
a device for DMA purposes, so this is a good cleanup.
> @@ -936,8 +937,6 @@ static void dp8393x_class_init(ObjectClass *klass, void
> *data)
> dc->reset = dp8393x_reset;
> dc->vmsd = &vmstate_dp8393x;
> dc->props = dp8393x_properties;
> - /* Reason: dma_mr property can't be set */
> - dc->user_creatable = false;
> }
Sidenote: as a sysbus device, this remains non-usercreatable
even though we can drop the specific flag here.
Reviewed-by: Peter Maydell <address@hidden>
thanks
-- PMM
- [PATCH 02/14] vmmouse: replace PROP_PTR with PROP_LINK, (continued)
- [PATCH 05/14] dp8393x: replace PROP_PTR with PROP_LINK, Marc-André Lureau, 2019/10/18
- [PATCH 06/14] leon3: replace PROP_PTR with PROP_LINK, Marc-André Lureau, 2019/10/18
- [PATCH 07/14] RFC: mips/cps: fix setting saar property, Marc-André Lureau, 2019/10/18
- [PATCH 08/14] cris: replace PROP_PTR with PROP_LINK for interrupt vector, Marc-André Lureau, 2019/10/18
- [PATCH 09/14] smbus-eeprom: remove PROP_PTR, Marc-André Lureau, 2019/10/18