diff mbox series

[7/7] hw/usb: Declare link using static DEFINE_PROP_LINK() macro

Message ID 20231017140150.44995-8-philmd@linaro.org
State New
Headers show
Series hw: Few more QOM/QDev cleanups | expand

Commit Message

Philippe Mathieu-Daudé Oct. 17, 2023, 2:01 p.m. UTC
Pull the 'dma' property to the core XHCI type, declare
its link statically using DEFINE_PROP_LINK().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/usb/hcd-xhci-sysbus.c | 4 ----
 hw/usb/hcd-xhci.c        | 2 ++
 2 files changed, 2 insertions(+), 4 deletions(-)

Comments

Mark Cave-Ayland Oct. 17, 2023, 8:19 p.m. UTC | #1
On 17/10/2023 15:01, Philippe Mathieu-Daudé wrote:

> Pull the 'dma' property to the core XHCI type, declare
> its link statically using DEFINE_PROP_LINK().
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/usb/hcd-xhci-sysbus.c | 4 ----
>   hw/usb/hcd-xhci.c        | 2 ++
>   2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/usb/hcd-xhci-sysbus.c b/hw/usb/hcd-xhci-sysbus.c
> index faf57b4797..15983d0b96 100644
> --- a/hw/usb/hcd-xhci-sysbus.c
> +++ b/hw/usb/hcd-xhci-sysbus.c
> @@ -60,10 +60,6 @@ static void xhci_sysbus_instance_init(Object *obj)
>       object_initialize_child(obj, "xhci-core", &s->xhci, TYPE_XHCI);
>       qdev_alias_all_properties(DEVICE(&s->xhci), obj);
>   
> -    object_property_add_link(obj, "dma", TYPE_MEMORY_REGION,
> -                             (Object **)&s->xhci.dma_mr,
> -                             qdev_prop_allow_set_link_before_realize,
> -                             OBJ_PROP_LINK_STRONG);
>       s->xhci.intr_update = NULL;
>       s->xhci.intr_raise = xhci_sysbus_intr_raise;
>   }
> diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
> index 4b60114207..012a6f3644 100644
> --- a/hw/usb/hcd-xhci.c
> +++ b/hw/usb/hcd-xhci.c
> @@ -3638,6 +3638,8 @@ static Property xhci_properties[] = {
>       DEFINE_PROP_UINT32("p3",    XHCIState, numports_3, 4),
>       DEFINE_PROP_LINK("host",    XHCIState, hostOpaque, TYPE_DEVICE,
>                        DeviceState *),
> +    DEFINE_PROP_LINK("dma", XHCIState, dma_mr,
> +                     TYPE_MEMORY_REGION, MemoryRegion *),
>       DEFINE_PROP_END_OF_LIST(),
>   };

I'm slightly unsure about this one: does pulling the "dma" property into the core 
type cause any issues if the property is left unset for any non-sysbus xhci users?


ATB,

Mark.
diff mbox series

Patch

diff --git a/hw/usb/hcd-xhci-sysbus.c b/hw/usb/hcd-xhci-sysbus.c
index faf57b4797..15983d0b96 100644
--- a/hw/usb/hcd-xhci-sysbus.c
+++ b/hw/usb/hcd-xhci-sysbus.c
@@ -60,10 +60,6 @@  static void xhci_sysbus_instance_init(Object *obj)
     object_initialize_child(obj, "xhci-core", &s->xhci, TYPE_XHCI);
     qdev_alias_all_properties(DEVICE(&s->xhci), obj);
 
-    object_property_add_link(obj, "dma", TYPE_MEMORY_REGION,
-                             (Object **)&s->xhci.dma_mr,
-                             qdev_prop_allow_set_link_before_realize,
-                             OBJ_PROP_LINK_STRONG);
     s->xhci.intr_update = NULL;
     s->xhci.intr_raise = xhci_sysbus_intr_raise;
 }
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 4b60114207..012a6f3644 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -3638,6 +3638,8 @@  static Property xhci_properties[] = {
     DEFINE_PROP_UINT32("p3",    XHCIState, numports_3, 4),
     DEFINE_PROP_LINK("host",    XHCIState, hostOpaque, TYPE_DEVICE,
                      DeviceState *),
+    DEFINE_PROP_LINK("dma", XHCIState, dma_mr,
+                     TYPE_MEMORY_REGION, MemoryRegion *),
     DEFINE_PROP_END_OF_LIST(),
 };