qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RFC: qdev: add legacy properties only for those print()-able
@ 2025-10-15 10:54 marcandre.lureau
  2025-10-21  7:51 ` Marc-André Lureau
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: marcandre.lureau @ 2025-10-15 10:54 UTC (permalink / raw)
  To: qemu-devel
  Cc: pbonzini, Marc-André Lureau, Daniel P. Berrangé,
	Eduardo Habkost

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The link properties are not printed in "info qtree", I don't know if
this was intentional. We currently register legacy properties for
link/ptr properties, but they don't have PropertyInfo getters (only
ObjectPropertyAccessor, when using non-legacy properties)

By not registering a (unusable?) legacy property, "info qtree" can now
print the link.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/core/qdev-properties.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index b7e8a89ba5..fe260a9670 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -1143,14 +1143,13 @@ static void qdev_class_add_legacy_property(DeviceClass *dc, const Property *prop
 {
     g_autofree char *name = NULL;
 
-    /* Register pointer properties as legacy properties */
-    if (!prop->info->print && prop->info->get) {
+    if (!prop->info->print) {
         return;
     }
 
     name = g_strdup_printf("legacy-%s", prop->name);
     object_class_property_add(OBJECT_CLASS(dc), name, "str",
-        prop->info->print ? qdev_get_legacy_property : prop->info->get,
+        qdev_get_legacy_property,
         NULL, NULL, (Property *)prop);
 }
 
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-10-22  8:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-15 10:54 [PATCH] RFC: qdev: add legacy properties only for those print()-able marcandre.lureau
2025-10-21  7:51 ` Marc-André Lureau
2025-10-21  8:18 ` Philippe Mathieu-Daudé
2025-10-21 12:53 ` Markus Armbruster
2025-10-21 12:58   ` Marc-André Lureau
2025-10-22  8:18     ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).