diff mbox

[v9,14/37] qapi: Swap visit_* arguments for consistent 'name' placement

Message ID 1453219845-30939-15-git-send-email-eblake@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Blake Jan. 19, 2016, 4:10 p.m. UTC
JSON uses "name":value, but many of our visitor interfaces were
called with visit_type_FOO(v, &value, name, errp).  This can be
a bit confusing to have to mentally swap the parameter order to
match JSON order.  It's particularly bad for visit_start_struct(),
where the 'name' parameter is smack in the middle of the
otherwise-related group of 'obj, kind, size' parameters! It's
time to do a global swap of the parameter ordering, so that the
'name' parameter is always immediately after the Visitor argument.

Additional reasons in favor of the swap: name is always an input
parameter, while &value is sometimes an output parameter (depending
on whether the caller is using an input visitor); and it is nicer
to list input parameters first.  Also, the existing include/qjson.h
prefers listing 'name' first in json_prop_*(), and I have plans to
unify that file with the qapi visitors; listing 'name' first in
qapi will minimize churn to the (admittedly few) qjson.h clients.

The next patches will then fix docs, object.h, visitor-impl.h, and
those clients to match.

Done by first patching scripts/qapi*.py by hand to make generated
files do what I want, then by running the following Coccinelle
script to affect the rest of the code base:
 $ spatch --sp-file script `git grep -l '\bvisit_' -- '**/*.[ch]'`
I then had to apply some touchups (Coccinelle insisted on TAB
indentation in visitor.h, and botched the signature of
visit_type_enum() by rewriting 'const char *const strings[]' to
the syntactically invalid 'const char*const[] strings').

    // Part 1: Swap declaration order
    @@
    type TV, TErr, TObj, T1, T2;
    identifier OBJ, ARG1, ARG2;
    @@
     void visit_start_struct
    -(TV v, TObj OBJ, T1 ARG1, const char *name, T2 ARG2, TErr errp)
    +(TV v, const char *name, TObj OBJ, T1 ARG1, T2 ARG2, TErr errp)
     { ... }

    @@
    type bool, TV, T1;
    identifier ARG1;
    @@
     bool visit_optional
    -(TV v, T1 ARG1, const char *name)
    +(TV v, const char *name, T1 ARG1)
     { ... }

    @@
    type TV, TErr, TObj, T1;
    identifier OBJ, ARG1;
    @@
     void visit_get_next_type
    -(TV v, TObj OBJ, T1 ARG1, const char *name, TErr errp)
    +(TV v, const char *name, TObj OBJ, T1 ARG1, TErr errp)
     { ... }

    @@
    type TV, TErr, TObj, T1, T2;
    identifier OBJ, ARG1, ARG2;
    @@
     void visit_type_enum
    -(TV v, TObj OBJ, T1 ARG1, T2 ARG2, const char *name, TErr errp)
    +(TV v, const char *name, TObj OBJ, T1 ARG1, T2 ARG2, TErr errp)
     { ... }

    @@
    type TV, TErr, TObj;
    identifier OBJ;
    identifier VISIT_TYPE =~ "^visit_type_";
    @@
     void VISIT_TYPE
    -(TV v, TObj OBJ, const char *name, TErr errp)
    +(TV v, const char *name, TObj OBJ, TErr errp)
     { ... }

    // Part 2: swap caller order
    @@
    expression V, NAME, OBJ, ARG1, ARG2, ERR;
    identifier VISIT_TYPE =~ "^visit_type_";
    @@
    (
    -visit_start_struct(V, OBJ, ARG1, NAME, ARG2, ERR)
    +visit_start_struct(V, NAME, OBJ, ARG1, ARG2, ERR)
    |
    -visit_optional(V, ARG1, NAME)
    +visit_optional(V, NAME, ARG1)
    |
    -visit_get_next_type(V, OBJ, ARG1, NAME, ERR)
    +visit_get_next_type(V, NAME, OBJ, ARG1, ERR)
    |
    -visit_type_enum(V, OBJ, ARG1, ARG2, NAME, ERR)
    +visit_type_enum(V, NAME, OBJ, ARG1, ARG2, ERR)
    |
    -VISIT_TYPE(V, OBJ, NAME, ERR)
    +VISIT_TYPE(V, NAME, OBJ, ERR)
    )

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
v9: mention later docs cleanup in commit message, rebase to master
v8: new patch
---
 backends/hostmem.c                 |  8 ++--
 block/qapi.c                       |  2 +-
 blockdev.c                         |  4 +-
 bootdevice.c                       |  4 +-
 hmp.c                              |  8 ++--
 hw/acpi/core.c                     |  4 +-
 hw/acpi/ich9.c                     | 14 +++----
 hw/block/nvme.c                    |  4 +-
 hw/core/machine.c                  | 10 ++---
 hw/core/qdev-properties-system.c   | 12 +++---
 hw/core/qdev-properties.c          | 66 +++++++++++++++----------------
 hw/core/qdev.c                     |  2 +-
 hw/i386/pc.c                       | 14 +++----
 hw/ide/qdev.c                      |  4 +-
 hw/intc/xics.c                     |  8 ++--
 hw/isa/lpc_ich9.c                  |  2 +-
 hw/mem/pc-dimm.c                   |  2 +-
 hw/misc/edu.c                      |  2 +-
 hw/misc/tmp105.c                   |  4 +-
 hw/net/ne2000-isa.c                |  4 +-
 hw/pci-host/piix.c                 |  8 ++--
 hw/pci-host/q35.c                  | 10 ++---
 hw/ppc/spapr_drc.c                 | 12 +++---
 hw/usb/dev-storage.c               |  4 +-
 hw/virtio/virtio-balloon.c         | 12 +++---
 include/qapi/visitor.h             | 52 +++++++++++++++----------
 memory.c                           |  8 ++--
 net/dump.c                         |  4 +-
 net/filter-buffer.c                |  4 +-
 net/net.c                          |  4 +-
 numa.c                             |  6 +--
 qapi/qapi-visit-core.c             | 54 +++++++++++++------------
 qemu-img.c                         | 11 +++---
 qom/object.c                       | 49 ++++++++++++-----------
 replay/replay-input.c              |  4 +-
 scripts/qapi-commands.py           |  4 +-
 scripts/qapi-event.py              |  2 +-
 scripts/qapi-types.py              |  2 +-
 scripts/qapi-visit.py              | 28 ++++++-------
 scripts/qapi.py                    |  4 +-
 target-i386/cpu.c                  | 30 +++++++-------
 target-ppc/translate_init.c        |  4 +-
 tests/test-opts-visitor.c          |  6 +--
 tests/test-qdev-global-props.c     |  4 +-
 tests/test-qmp-commands.c          |  2 +-
 tests/test-qmp-input-strict.c      | 28 ++++++-------
 tests/test-qmp-input-visitor.c     | 80 +++++++++++++++++++-------------------
 tests/test-qmp-output-visitor.c    | 34 ++++++++--------
 tests/test-string-input-visitor.c  | 34 ++++++++--------
 tests/test-string-output-visitor.c | 16 ++++----
 tests/test-visitor-serialization.c | 54 ++++++++++++-------------
 util/qemu-sockets.c                |  4 +-
 vl.c                               |  4 +-
 53 files changed, 387 insertions(+), 373 deletions(-)

Comments

Markus Armbruster Jan. 20, 2016, 6:28 p.m. UTC | #1
Eric Blake <eblake@redhat.com> writes:

> JSON uses "name":value, but many of our visitor interfaces were
> called with visit_type_FOO(v, &value, name, errp).  This can be
> a bit confusing to have to mentally swap the parameter order to
> match JSON order.  It's particularly bad for visit_start_struct(),
> where the 'name' parameter is smack in the middle of the
> otherwise-related group of 'obj, kind, size' parameters! It's
> time to do a global swap of the parameter ordering, so that the
> 'name' parameter is always immediately after the Visitor argument.

Yes, please!

> Additional reasons in favor of the swap: name is always an input
> parameter, while &value is sometimes an output parameter (depending
> on whether the caller is using an input visitor); and it is nicer
> to list input parameters first.

Except when it isn't: memcpy(), strcat(), ...  I'd scratch this
argument.  The case for the transformation is plenty strong without it.


>                                  Also, the existing include/qjson.h
> prefers listing 'name' first in json_prop_*(), and I have plans to
> unify that file with the qapi visitors; listing 'name' first in
> qapi will minimize churn to the (admittedly few) qjson.h clients.
>
> The next patches will then fix docs, object.h, visitor-impl.h, and
> those clients to match.
>
> Done by first patching scripts/qapi*.py by hand to make generated
> files do what I want, then by running the following Coccinelle
> script to affect the rest of the code base:
>  $ spatch --sp-file script `git grep -l '\bvisit_' -- '**/*.[ch]'`
> I then had to apply some touchups (Coccinelle insisted on TAB
> indentation in visitor.h, and botched the signature of
> visit_type_enum() by rewriting 'const char *const strings[]' to
> the syntactically invalid 'const char*const[] strings').
>
>     // Part 1: Swap declaration order
>     @@
>     type TV, TErr, TObj, T1, T2;
>     identifier OBJ, ARG1, ARG2;
>     @@
>      void visit_start_struct
>     -(TV v, TObj OBJ, T1 ARG1, const char *name, T2 ARG2, TErr errp)
>     +(TV v, const char *name, TObj OBJ, T1 ARG1, T2 ARG2, TErr errp)

Rotates second to fourth parameters right.  Their types are sufficiently
incompatible, so the compiler should catch inconsistencies.

Similar argument for the other functions.

>      { ... }
>
>     @@
>     type bool, TV, T1;
>     identifier ARG1;
>     @@
>      bool visit_optional
>     -(TV v, T1 ARG1, const char *name)
>     +(TV v, const char *name, T1 ARG1)
>      { ... }
>
>     @@
>     type TV, TErr, TObj, T1;
>     identifier OBJ, ARG1;
>     @@
>      void visit_get_next_type
>     -(TV v, TObj OBJ, T1 ARG1, const char *name, TErr errp)
>     +(TV v, const char *name, TObj OBJ, T1 ARG1, TErr errp)
>      { ... }
>
>     @@
>     type TV, TErr, TObj, T1, T2;
>     identifier OBJ, ARG1, ARG2;
>     @@
>      void visit_type_enum
>     -(TV v, TObj OBJ, T1 ARG1, T2 ARG2, const char *name, TErr errp)
>     +(TV v, const char *name, TObj OBJ, T1 ARG1, T2 ARG2, TErr errp)
>      { ... }
>
>     @@
>     type TV, TErr, TObj;
>     identifier OBJ;
>     identifier VISIT_TYPE =~ "^visit_type_";
>     @@
>      void VISIT_TYPE
>     -(TV v, TObj OBJ, const char *name, TErr errp)
>     +(TV v, const char *name, TObj OBJ, TErr errp)
>      { ... }
>
>     // Part 2: swap caller order
>     @@
>     expression V, NAME, OBJ, ARG1, ARG2, ERR;
>     identifier VISIT_TYPE =~ "^visit_type_";
>     @@
>     (
>     -visit_start_struct(V, OBJ, ARG1, NAME, ARG2, ERR)
>     +visit_start_struct(V, NAME, OBJ, ARG1, ARG2, ERR)
>     |
>     -visit_optional(V, ARG1, NAME)
>     +visit_optional(V, NAME, ARG1)
>     |
>     -visit_get_next_type(V, OBJ, ARG1, NAME, ERR)
>     +visit_get_next_type(V, NAME, OBJ, ARG1, ERR)
>     |
>     -visit_type_enum(V, OBJ, ARG1, ARG2, NAME, ERR)
>     +visit_type_enum(V, NAME, OBJ, ARG1, ARG2, ERR)
>     |
>     -VISIT_TYPE(V, OBJ, NAME, ERR)
>     +VISIT_TYPE(V, NAME, OBJ, ERR)
>     )
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Didn't check the patch closely.
diff mbox

Patch

diff --git a/backends/hostmem.c b/backends/hostmem.c
index 1b4eb45..a9d30d8 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -32,7 +32,7 @@  host_memory_backend_get_size(Object *obj, Visitor *v, void *opaque,
     HostMemoryBackend *backend = MEMORY_BACKEND(obj);
     uint64_t value = backend->size;

-    visit_type_size(v, &value, name, errp);
+    visit_type_size(v, name, &value, errp);
 }

 static void
@@ -48,7 +48,7 @@  host_memory_backend_set_size(Object *obj, Visitor *v, void *opaque,
         goto out;
     }

-    visit_type_size(v, &value, name, &local_err);
+    visit_type_size(v, name, &value, &local_err);
     if (local_err) {
         goto out;
     }
@@ -91,7 +91,7 @@  host_memory_backend_get_host_nodes(Object *obj, Visitor *v, void *opaque,
         node = &(*node)->next;
     } while (true);

-    visit_type_uint16List(v, &host_nodes, name, errp);
+    visit_type_uint16List(v, name, &host_nodes, errp);
 }

 static void
@@ -102,7 +102,7 @@  host_memory_backend_set_host_nodes(Object *obj, Visitor *v, void *opaque,
     HostMemoryBackend *backend = MEMORY_BACKEND(obj);
     uint16List *l = NULL;

-    visit_type_uint16List(v, &l, name, errp);
+    visit_type_uint16List(v, name, &l, errp);

     while (l) {
         bitmap_set(backend->host_nodes, l->value, 1);
diff --git a/block/qapi.c b/block/qapi.c
index 58d3975..4fe3ce2 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -635,7 +635,7 @@  void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f,
     QmpOutputVisitor *ov = qmp_output_visitor_new();
     QObject *obj, *data;

-    visit_type_ImageInfoSpecific(qmp_output_get_visitor(ov), &info_spec, NULL,
+    visit_type_ImageInfoSpecific(qmp_output_get_visitor(ov), NULL, &info_spec,
                                  &error_abort);
     obj = qmp_output_get_qobject(ov);
     assert(qobject_type(obj) == QTYPE_QDICT);
diff --git a/blockdev.c b/blockdev.c
index 1392fff..29f393c 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3816,8 +3816,8 @@  void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
         }
     }

-    visit_type_BlockdevOptions(qmp_output_get_visitor(ov),
-                               &options, NULL, &local_err);
+    visit_type_BlockdevOptions(qmp_output_get_visitor(ov), NULL, &options,
+                               &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         goto fail;
diff --git a/bootdevice.c b/bootdevice.c
index 3cdc0d7..d307cfc 100644
--- a/bootdevice.c
+++ b/bootdevice.c
@@ -274,7 +274,7 @@  static void device_get_bootindex(Object *obj, Visitor *v, void *opaque,
                                  const char *name, Error **errp)
 {
     BootIndexProperty *prop = opaque;
-    visit_type_int32(v, prop->bootindex, name, errp);
+    visit_type_int32(v, name, prop->bootindex, errp);
 }

 static void device_set_bootindex(Object *obj, Visitor *v, void *opaque,
@@ -284,7 +284,7 @@  static void device_set_bootindex(Object *obj, Visitor *v, void *opaque,
     int32_t boot_index;
     Error *local_err = NULL;

-    visit_type_int32(v, &boot_index, name, &local_err);
+    visit_type_int32(v, name, &boot_index, &local_err);
     if (local_err) {
         goto out;
     }
diff --git a/hmp.c b/hmp.c
index 6d67f9b..3beea3a 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1675,13 +1675,13 @@  void hmp_object_add(Monitor *mon, const QDict *qdict)
     }

     qdict_del(pdict, "qom-type");
-    visit_type_str(v, &type, "qom-type", &err);
+    visit_type_str(v, "qom-type", &type, &err);
     if (err) {
         goto out_end;
     }

     qdict_del(pdict, "id");
-    visit_type_str(v, &id, "id", &err);
+    visit_type_str(v, "id", &id, &err);
     if (err) {
         goto out_end;
     }
@@ -1949,8 +1949,8 @@  void hmp_info_memdev(Monitor *mon, const QDict *qdict)

     while (m) {
         ov = string_output_visitor_new(false);
-        visit_type_uint16List(string_output_get_visitor(ov),
-                              &m->value->host_nodes, NULL, NULL);
+        visit_type_uint16List(string_output_get_visitor(ov), NULL,
+                              &m->value->host_nodes, NULL);
         monitor_printf(mon, "memory backend: %d\n", i);
         monitor_printf(mon, "  size:  %" PRId64 "\n", m->value->size);
         monitor_printf(mon, "  merge: %s\n",
diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index 21e113d..ef1f037 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -242,7 +242,7 @@  void acpi_table_add(const QemuOpts *opts, Error **errp)
         OptsVisitor *ov;

         ov = opts_visitor_new(opts);
-        visit_type_AcpiTableOptions(opts_get_visitor(ov), &hdrs, NULL, &err);
+        visit_type_AcpiTableOptions(opts_get_visitor(ov), NULL, &hdrs, &err);
         opts_visitor_cleanup(ov);
     }

@@ -301,7 +301,7 @@  out:
         QapiDeallocVisitor *dv;

         dv = qapi_dealloc_visitor_new();
-        visit_type_AcpiTableOptions(qapi_dealloc_get_visitor(dv), &hdrs, NULL,
+        visit_type_AcpiTableOptions(qapi_dealloc_get_visitor(dv), NULL, &hdrs,
                                     NULL);
         qapi_dealloc_visitor_cleanup(dv);
     }
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 1c7fcfa..0a486fb 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -289,7 +289,7 @@  static void ich9_pm_get_gpe0_blk(Object *obj, Visitor *v,
     ICH9LPCPMRegs *pm = opaque;
     uint32_t value = pm->pm_io_base + ICH9_PMIO_GPE0_STS;

-    visit_type_uint32(v, &value, name, errp);
+    visit_type_uint32(v, name, &value, errp);
 }

 static bool ich9_pm_get_memory_hotplug_support(Object *obj, Error **errp)
@@ -314,7 +314,7 @@  static void ich9_pm_get_disable_s3(Object *obj, Visitor *v,
     ICH9LPCPMRegs *pm = opaque;
     uint8_t value = pm->disable_s3;

-    visit_type_uint8(v, &value, name, errp);
+    visit_type_uint8(v, name, &value, errp);
 }

 static void ich9_pm_set_disable_s3(Object *obj, Visitor *v,
@@ -325,7 +325,7 @@  static void ich9_pm_set_disable_s3(Object *obj, Visitor *v,
     Error *local_err = NULL;
     uint8_t value;

-    visit_type_uint8(v, &value, name, &local_err);
+    visit_type_uint8(v, name, &value, &local_err);
     if (local_err) {
         goto out;
     }
@@ -341,7 +341,7 @@  static void ich9_pm_get_disable_s4(Object *obj, Visitor *v,
     ICH9LPCPMRegs *pm = opaque;
     uint8_t value = pm->disable_s4;

-    visit_type_uint8(v, &value, name, errp);
+    visit_type_uint8(v, name, &value, errp);
 }

 static void ich9_pm_set_disable_s4(Object *obj, Visitor *v,
@@ -352,7 +352,7 @@  static void ich9_pm_set_disable_s4(Object *obj, Visitor *v,
     Error *local_err = NULL;
     uint8_t value;

-    visit_type_uint8(v, &value, name, &local_err);
+    visit_type_uint8(v, name, &value, &local_err);
     if (local_err) {
         goto out;
     }
@@ -368,7 +368,7 @@  static void ich9_pm_get_s4_val(Object *obj, Visitor *v,
     ICH9LPCPMRegs *pm = opaque;
     uint8_t value = pm->s4_val;

-    visit_type_uint8(v, &value, name, errp);
+    visit_type_uint8(v, name, &value, errp);
 }

 static void ich9_pm_set_s4_val(Object *obj, Visitor *v,
@@ -379,7 +379,7 @@  static void ich9_pm_set_s4_val(Object *obj, Visitor *v,
     Error *local_err = NULL;
     uint8_t value;

-    visit_type_uint8(v, &value, name, &local_err);
+    visit_type_uint8(v, name, &value, &local_err);
     if (local_err) {
         goto out;
     }
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 169e4fa..3676e2e 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -920,7 +920,7 @@  static void nvme_get_bootindex(Object *obj, Visitor *v, void *opaque,
 {
     NvmeCtrl *s = NVME(obj);

-    visit_type_int32(v, &s->conf.bootindex, name, errp);
+    visit_type_int32(v, name, &s->conf.bootindex, errp);
 }

 static void nvme_set_bootindex(Object *obj, Visitor *v, void *opaque,
@@ -930,7 +930,7 @@  static void nvme_set_bootindex(Object *obj, Visitor *v, void *opaque,
     int32_t boot_index;
     Error *local_err = NULL;

-    visit_type_int32(v, &boot_index, name, &local_err);
+    visit_type_int32(v, name, &boot_index, &local_err);
     if (local_err) {
         goto out;
     }
diff --git a/hw/core/machine.c b/hw/core/machine.c
index c46ddc7..0fd1e73 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -40,7 +40,7 @@  static void machine_set_kernel_irqchip(Object *obj, Visitor *v,
     MachineState *ms = MACHINE(obj);
     OnOffSplit mode;

-    visit_type_OnOffSplit(v, &mode, name, &err);
+    visit_type_OnOffSplit(v, name, &mode, &err);
     if (err) {
         error_propagate(errp, err);
         return;
@@ -74,7 +74,7 @@  static void machine_get_kvm_shadow_mem(Object *obj, Visitor *v,
     MachineState *ms = MACHINE(obj);
     int64_t value = ms->kvm_shadow_mem;

-    visit_type_int(v, &value, name, errp);
+    visit_type_int(v, name, &value, errp);
 }

 static void machine_set_kvm_shadow_mem(Object *obj, Visitor *v,
@@ -85,7 +85,7 @@  static void machine_set_kvm_shadow_mem(Object *obj, Visitor *v,
     Error *error = NULL;
     int64_t value;

-    visit_type_int(v, &value, name, &error);
+    visit_type_int(v, name, &value, &error);
     if (error) {
         error_propagate(errp, error);
         return;
@@ -176,7 +176,7 @@  static void machine_get_phandle_start(Object *obj, Visitor *v,
     MachineState *ms = MACHINE(obj);
     int64_t value = ms->phandle_start;

-    visit_type_int(v, &value, name, errp);
+    visit_type_int(v, name, &value, errp);
 }

 static void machine_set_phandle_start(Object *obj, Visitor *v,
@@ -187,7 +187,7 @@  static void machine_set_phandle_start(Object *obj, Visitor *v,
     Error *error = NULL;
     int64_t value;

-    visit_type_int(v, &value, name, &error);
+    visit_type_int(v, name, &value, &error);
     if (error) {
         error_propagate(errp, error);
         return;
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index 1589aba..86e0b02 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -30,7 +30,7 @@  static void get_pointer(Object *obj, Visitor *v, Property *prop,
     char *p;

     p = *ptr ? print(*ptr) : g_strdup("");
-    visit_type_str(v, &p, name, errp);
+    visit_type_str(v, name, &p, errp);
     g_free(p);
 }

@@ -50,7 +50,7 @@  static void set_pointer(Object *obj, Visitor *v, Property *prop,
         return;
     }

-    visit_type_str(v, &str, name, &local_err);
+    visit_type_str(v, name, &str, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
@@ -201,7 +201,7 @@  static void get_netdev(Object *obj, Visitor *v, void *opaque,
     NICPeers *peers_ptr = qdev_get_prop_ptr(dev, prop);
     char *p = g_strdup(peers_ptr->ncs[0] ? peers_ptr->ncs[0]->name : "");

-    visit_type_str(v, &p, name, errp);
+    visit_type_str(v, name, &p, errp);
     g_free(p);
 }

@@ -222,7 +222,7 @@  static void set_netdev(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_str(v, &str, name, &local_err);
+    visit_type_str(v, name, &str, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
@@ -307,7 +307,7 @@  static void get_vlan(Object *obj, Visitor *v, void *opaque,
         }
     }

-    visit_type_int32(v, &id, name, errp);
+    visit_type_int32(v, name, &id, errp);
 }

 static void set_vlan(Object *obj, Visitor *v, void *opaque,
@@ -326,7 +326,7 @@  static void set_vlan(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_int32(v, &id, name, &local_err);
+    visit_type_int32(v, name, &id, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 3572810..971219d 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -48,8 +48,8 @@  static void get_enum(Object *obj, Visitor *v, void *opaque,
     Property *prop = opaque;
     int *ptr = qdev_get_prop_ptr(dev, prop);

-    visit_type_enum(v, ptr, prop->info->enum_table,
-                    prop->info->name, prop->name, errp);
+    visit_type_enum(v, prop->name, ptr, prop->info->enum_table,
+                    prop->info->name, errp);
 }

 static void set_enum(Object *obj, Visitor *v, void *opaque,
@@ -64,8 +64,8 @@  static void set_enum(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_enum(v, ptr, prop->info->enum_table,
-                    prop->info->name, prop->name, errp);
+    visit_type_enum(v, prop->name, ptr, prop->info->enum_table,
+                    prop->info->name, errp);
 }

 /* Bit */
@@ -95,7 +95,7 @@  static void prop_get_bit(Object *obj, Visitor *v, void *opaque,
     uint32_t *p = qdev_get_prop_ptr(dev, prop);
     bool value = (*p & qdev_get_prop_mask(prop)) != 0;

-    visit_type_bool(v, &value, name, errp);
+    visit_type_bool(v, name, &value, errp);
 }

 static void prop_set_bit(Object *obj, Visitor *v, void *opaque,
@@ -111,7 +111,7 @@  static void prop_set_bit(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_bool(v, &value, name, &local_err);
+    visit_type_bool(v, name, &value, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
@@ -153,7 +153,7 @@  static void prop_get_bit64(Object *obj, Visitor *v, void *opaque,
     uint64_t *p = qdev_get_prop_ptr(dev, prop);
     bool value = (*p & qdev_get_prop_mask64(prop)) != 0;

-    visit_type_bool(v, &value, name, errp);
+    visit_type_bool(v, name, &value, errp);
 }

 static void prop_set_bit64(Object *obj, Visitor *v, void *opaque,
@@ -169,7 +169,7 @@  static void prop_set_bit64(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_bool(v, &value, name, &local_err);
+    visit_type_bool(v, name, &value, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
@@ -193,7 +193,7 @@  static void get_bool(Object *obj, Visitor *v, void *opaque,
     Property *prop = opaque;
     bool *ptr = qdev_get_prop_ptr(dev, prop);

-    visit_type_bool(v, ptr, name, errp);
+    visit_type_bool(v, name, ptr, errp);
 }

 static void set_bool(Object *obj, Visitor *v, void *opaque,
@@ -208,7 +208,7 @@  static void set_bool(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_bool(v, ptr, name, errp);
+    visit_type_bool(v, name, ptr, errp);
 }

 PropertyInfo qdev_prop_bool = {
@@ -226,7 +226,7 @@  static void get_uint8(Object *obj, Visitor *v, void *opaque,
     Property *prop = opaque;
     uint8_t *ptr = qdev_get_prop_ptr(dev, prop);

-    visit_type_uint8(v, ptr, name, errp);
+    visit_type_uint8(v, name, ptr, errp);
 }

 static void set_uint8(Object *obj, Visitor *v, void *opaque,
@@ -241,7 +241,7 @@  static void set_uint8(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_uint8(v, ptr, name, errp);
+    visit_type_uint8(v, name, ptr, errp);
 }

 PropertyInfo qdev_prop_uint8 = {
@@ -259,7 +259,7 @@  static void get_uint16(Object *obj, Visitor *v, void *opaque,
     Property *prop = opaque;
     uint16_t *ptr = qdev_get_prop_ptr(dev, prop);

-    visit_type_uint16(v, ptr, name, errp);
+    visit_type_uint16(v, name, ptr, errp);
 }

 static void set_uint16(Object *obj, Visitor *v, void *opaque,
@@ -274,7 +274,7 @@  static void set_uint16(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_uint16(v, ptr, name, errp);
+    visit_type_uint16(v, name, ptr, errp);
 }

 PropertyInfo qdev_prop_uint16 = {
@@ -292,7 +292,7 @@  static void get_uint32(Object *obj, Visitor *v, void *opaque,
     Property *prop = opaque;
     uint32_t *ptr = qdev_get_prop_ptr(dev, prop);

-    visit_type_uint32(v, ptr, name, errp);
+    visit_type_uint32(v, name, ptr, errp);
 }

 static void set_uint32(Object *obj, Visitor *v, void *opaque,
@@ -307,7 +307,7 @@  static void set_uint32(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_uint32(v, ptr, name, errp);
+    visit_type_uint32(v, name, ptr, errp);
 }

 static void get_int32(Object *obj, Visitor *v, void *opaque,
@@ -317,7 +317,7 @@  static void get_int32(Object *obj, Visitor *v, void *opaque,
     Property *prop = opaque;
     int32_t *ptr = qdev_get_prop_ptr(dev, prop);

-    visit_type_int32(v, ptr, name, errp);
+    visit_type_int32(v, name, ptr, errp);
 }

 static void set_int32(Object *obj, Visitor *v, void *opaque,
@@ -332,7 +332,7 @@  static void set_int32(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_int32(v, ptr, name, errp);
+    visit_type_int32(v, name, ptr, errp);
 }

 PropertyInfo qdev_prop_uint32 = {
@@ -356,7 +356,7 @@  static void get_uint64(Object *obj, Visitor *v, void *opaque,
     Property *prop = opaque;
     uint64_t *ptr = qdev_get_prop_ptr(dev, prop);

-    visit_type_uint64(v, ptr, name, errp);
+    visit_type_uint64(v, name, ptr, errp);
 }

 static void set_uint64(Object *obj, Visitor *v, void *opaque,
@@ -371,7 +371,7 @@  static void set_uint64(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_uint64(v, ptr, name, errp);
+    visit_type_uint64(v, name, ptr, errp);
 }

 PropertyInfo qdev_prop_uint64 = {
@@ -397,9 +397,9 @@  static void get_string(Object *obj, Visitor *v, void *opaque,

     if (!*ptr) {
         char *str = (char *)"";
-        visit_type_str(v, &str, name, errp);
+        visit_type_str(v, name, &str, errp);
     } else {
-        visit_type_str(v, ptr, name, errp);
+        visit_type_str(v, name, ptr, errp);
     }
 }

@@ -417,7 +417,7 @@  static void set_string(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_str(v, &str, name, &local_err);
+    visit_type_str(v, name, &str, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
@@ -460,7 +460,7 @@  static void get_mac(Object *obj, Visitor *v, void *opaque,
              mac->a[0], mac->a[1], mac->a[2],
              mac->a[3], mac->a[4], mac->a[5]);

-    visit_type_str(v, &p, name, errp);
+    visit_type_str(v, name, &p, errp);
 }

 static void set_mac(Object *obj, Visitor *v, void *opaque,
@@ -478,7 +478,7 @@  static void set_mac(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_str(v, &str, name, &local_err);
+    visit_type_str(v, name, &str, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
@@ -561,11 +561,11 @@  static void set_pci_devfn(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_str(v, &str, name, &local_err);
+    visit_type_str(v, name, &str, &local_err);
     if (local_err) {
         error_free(local_err);
         local_err = NULL;
-        visit_type_int32(v, &value, name, &local_err);
+        visit_type_int32(v, name, &value, &local_err);
         if (local_err) {
             error_propagate(errp, local_err);
         } else if (value < -1 || value > 255) {
@@ -632,7 +632,7 @@  static void set_blocksize(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_uint16(v, &value, name, &local_err);
+    visit_type_uint16(v, name, &value, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
@@ -678,7 +678,7 @@  static void get_pci_host_devaddr(Object *obj, Visitor *v, void *opaque,
                   addr->domain, addr->bus, addr->slot, addr->function);
     assert(rc == sizeof(buffer) - 1);

-    visit_type_str(v, &p, name, errp);
+    visit_type_str(v, name, &p, errp);
 }

 /*
@@ -703,7 +703,7 @@  static void set_pci_host_devaddr(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_str(v, &str, name, &local_err);
+    visit_type_str(v, name, &str, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
@@ -825,7 +825,7 @@  static void set_prop_arraylen(Object *obj, Visitor *v, void *opaque,
                    name);
         return;
     }
-    visit_type_uint32(v, alenptr, name, &local_err);
+    visit_type_uint32(v, name, alenptr, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
@@ -1089,7 +1089,7 @@  static void get_size(Object *obj, Visitor *v, void *opaque,
     Property *prop = opaque;
     uint64_t *ptr = qdev_get_prop_ptr(dev, prop);

-    visit_type_size(v, ptr, name, errp);
+    visit_type_size(v, name, ptr, errp);
 }

 static void set_size(Object *obj, Visitor *v, void *opaque,
@@ -1099,7 +1099,7 @@  static void set_size(Object *obj, Visitor *v, void *opaque,
     Property *prop = opaque;
     uint64_t *ptr = qdev_get_prop_ptr(dev, prop);

-    visit_type_size(v, ptr, name, errp);
+    visit_type_size(v, name, ptr, errp);
 }

 PropertyInfo qdev_prop_size = {
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 44bf790..b343a4d 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -897,7 +897,7 @@  static void qdev_get_legacy_property(Object *obj, Visitor *v, void *opaque,
     char *ptr = buffer;

     prop->info->print(dev, prop, buffer, sizeof(buffer));
-    visit_type_str(v, &ptr, name, errp);
+    visit_type_str(v, name, &ptr, errp);
 }

 /**
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 9e37186..0ec39dc 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1760,7 +1760,7 @@  pc_machine_get_hotplug_memory_region_size(Object *obj, Visitor *v, void *opaque,
     PCMachineState *pcms = PC_MACHINE(obj);
     int64_t value = memory_region_size(&pcms->hotplug_memory.mr);

-    visit_type_int(v, &value, name, errp);
+    visit_type_int(v, name, &value, errp);
 }

 static void pc_machine_get_max_ram_below_4g(Object *obj, Visitor *v,
@@ -1770,7 +1770,7 @@  static void pc_machine_get_max_ram_below_4g(Object *obj, Visitor *v,
     PCMachineState *pcms = PC_MACHINE(obj);
     uint64_t value = pcms->max_ram_below_4g;

-    visit_type_size(v, &value, name, errp);
+    visit_type_size(v, name, &value, errp);
 }

 static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v,
@@ -1781,7 +1781,7 @@  static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v,
     Error *error = NULL;
     uint64_t value;

-    visit_type_size(v, &value, name, &error);
+    visit_type_size(v, name, &value, &error);
     if (error) {
         error_propagate(errp, error);
         return;
@@ -1809,7 +1809,7 @@  static void pc_machine_get_vmport(Object *obj, Visitor *v, void *opaque,
     PCMachineState *pcms = PC_MACHINE(obj);
     OnOffAuto vmport = pcms->vmport;

-    visit_type_OnOffAuto(v, &vmport, name, errp);
+    visit_type_OnOffAuto(v, name, &vmport, errp);
 }

 static void pc_machine_set_vmport(Object *obj, Visitor *v, void *opaque,
@@ -1817,7 +1817,7 @@  static void pc_machine_set_vmport(Object *obj, Visitor *v, void *opaque,
 {
     PCMachineState *pcms = PC_MACHINE(obj);

-    visit_type_OnOffAuto(v, &pcms->vmport, name, errp);
+    visit_type_OnOffAuto(v, name, &pcms->vmport, errp);
 }

 bool pc_machine_is_smm_enabled(PCMachineState *pcms)
@@ -1851,7 +1851,7 @@  static void pc_machine_get_smm(Object *obj, Visitor *v, void *opaque,
     PCMachineState *pcms = PC_MACHINE(obj);
     OnOffAuto smm = pcms->smm;

-    visit_type_OnOffAuto(v, &smm, name, errp);
+    visit_type_OnOffAuto(v, name, &smm, errp);
 }

 static void pc_machine_set_smm(Object *obj, Visitor *v, void *opaque,
@@ -1859,7 +1859,7 @@  static void pc_machine_set_smm(Object *obj, Visitor *v, void *opaque,
 {
     PCMachineState *pcms = PC_MACHINE(obj);

-    visit_type_OnOffAuto(v, &pcms->smm, name, errp);
+    visit_type_OnOffAuto(v, name, &pcms->smm, errp);
 }

 static bool pc_machine_get_nvdimm(Object *obj, Error **errp)
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index 1f83109..66f56e7 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -204,7 +204,7 @@  static void ide_dev_get_bootindex(Object *obj, Visitor *v, void *opaque,
 {
     IDEDevice *d = IDE_DEVICE(obj);

-    visit_type_int32(v, &d->conf.bootindex, name, errp);
+    visit_type_int32(v, name, &d->conf.bootindex, errp);
 }

 static void ide_dev_set_bootindex(Object *obj, Visitor *v, void *opaque,
@@ -214,7 +214,7 @@  static void ide_dev_set_bootindex(Object *obj, Visitor *v, void *opaque,
     int32_t boot_index;
     Error *local_err = NULL;

-    visit_type_int32(v, &boot_index, name, &local_err);
+    visit_type_int32(v, name, &boot_index, &local_err);
     if (local_err) {
         goto out;
     }
diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index 9ff5796..502c87f 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -94,7 +94,7 @@  static void xics_prop_get_nr_irqs(Object *obj, Visitor *v,
     XICSState *icp = XICS_COMMON(obj);
     int64_t value = icp->nr_irqs;

-    visit_type_int(v, &value, name, errp);
+    visit_type_int(v, name, &value, errp);
 }

 static void xics_prop_set_nr_irqs(Object *obj, Visitor *v,
@@ -105,7 +105,7 @@  static void xics_prop_set_nr_irqs(Object *obj, Visitor *v,
     Error *error = NULL;
     int64_t value;

-    visit_type_int(v, &value, name, &error);
+    visit_type_int(v, name, &value, &error);
     if (error) {
         error_propagate(errp, error);
         return;
@@ -128,7 +128,7 @@  static void xics_prop_get_nr_servers(Object *obj, Visitor *v,
     XICSState *icp = XICS_COMMON(obj);
     int64_t value = icp->nr_servers;

-    visit_type_int(v, &value, name, errp);
+    visit_type_int(v, name, &value, errp);
 }

 static void xics_prop_set_nr_servers(Object *obj, Visitor *v,
@@ -140,7 +140,7 @@  static void xics_prop_set_nr_servers(Object *obj, Visitor *v,
     Error *error = NULL;
     int64_t value;

-    visit_type_int(v, &value, name, &error);
+    visit_type_int(v, name, &value, &error);
     if (error) {
         error_propagate(errp, error);
         return;
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index ed9907d..358f707 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -576,7 +576,7 @@  static void ich9_lpc_get_sci_int(Object *obj, Visitor *v,
     ICH9LPCState *lpc = ICH9_LPC_DEVICE(obj);
     uint32_t value = ich9_lpc_sci_irq(lpc);

-    visit_type_uint32(v, &value, name, errp);
+    visit_type_uint32(v, name, &value, errp);
 }

 static void ich9_lpc_add_properties(ICH9LPCState *lpc)
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index d5cdab2..123baeb 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -382,7 +382,7 @@  static void pc_dimm_get_size(Object *obj, Visitor *v, void *opaque,
     mr = host_memory_backend_get_memory(dimm->hostmem, errp);
     value = memory_region_size(mr);

-    visit_type_int(v, &value, name, errp);
+    visit_type_int(v, name, &value, errp);
 }

 static void pc_dimm_check_memdev_is_busy(Object *obj, const char *name,
diff --git a/hw/misc/edu.c b/hw/misc/edu.c
index a7171eb..4a3dc76 100644
--- a/hw/misc/edu.c
+++ b/hw/misc/edu.c
@@ -367,7 +367,7 @@  static void edu_obj_uint64(Object *obj, Visitor *v, void *opaque,
 {
     uint64_t *val = opaque;

-    visit_type_uint64(v, val, name, errp);
+    visit_type_uint64(v, name, val, errp);
 }

 static void edu_instance_init(Object *obj)
diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c
index f3fe8b8..1850315 100644
--- a/hw/misc/tmp105.c
+++ b/hw/misc/tmp105.c
@@ -58,7 +58,7 @@  static void tmp105_get_temperature(Object *obj, Visitor *v, void *opaque,
     TMP105State *s = TMP105(obj);
     int64_t value = s->temperature * 1000 / 256;

-    visit_type_int(v, &value, name, errp);
+    visit_type_int(v, name, &value, errp);
 }

 /* Units are 0.001 centigrades relative to 0 C.  s->temperature is 8.8
@@ -71,7 +71,7 @@  static void tmp105_set_temperature(Object *obj, Visitor *v, void *opaque,
     Error *local_err = NULL;
     int64_t temp;

-    visit_type_int(v, &temp, name, &local_err);
+    visit_type_int(v, name, &temp, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
diff --git a/hw/net/ne2000-isa.c b/hw/net/ne2000-isa.c
index 18b0644..46ef304 100644
--- a/hw/net/ne2000-isa.c
+++ b/hw/net/ne2000-isa.c
@@ -99,7 +99,7 @@  static void isa_ne2000_get_bootindex(Object *obj, Visitor *v, void *opaque,
     ISANE2000State *isa = ISA_NE2000(obj);
     NE2000State *s = &isa->ne2000;

-    visit_type_int32(v, &s->c.bootindex, name, errp);
+    visit_type_int32(v, name, &s->c.bootindex, errp);
 }

 static void isa_ne2000_set_bootindex(Object *obj, Visitor *v, void *opaque,
@@ -110,7 +110,7 @@  static void isa_ne2000_set_bootindex(Object *obj, Visitor *v, void *opaque,
     int32_t boot_index;
     Error *local_err = NULL;

-    visit_type_int32(v, &boot_index, name, &local_err);
+    visit_type_int32(v, name, &boot_index, &local_err);
     if (local_err) {
         goto out;
     }
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index b0d7e31..dbae0aa 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -221,7 +221,7 @@  static void i440fx_pcihost_get_pci_hole_start(Object *obj, Visitor *v,
     I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj);
     uint32_t value = s->pci_info.w32.begin;

-    visit_type_uint32(v, &value, name, errp);
+    visit_type_uint32(v, name, &value, errp);
 }

 static void i440fx_pcihost_get_pci_hole_end(Object *obj, Visitor *v,
@@ -231,7 +231,7 @@  static void i440fx_pcihost_get_pci_hole_end(Object *obj, Visitor *v,
     I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj);
     uint32_t value = s->pci_info.w32.end;

-    visit_type_uint32(v, &value, name, errp);
+    visit_type_uint32(v, name, &value, errp);
 }

 static void i440fx_pcihost_get_pci_hole64_start(Object *obj, Visitor *v,
@@ -243,7 +243,7 @@  static void i440fx_pcihost_get_pci_hole64_start(Object *obj, Visitor *v,

     pci_bus_get_w64_range(h->bus, &w64);

-    visit_type_uint64(v, &w64.begin, name, errp);
+    visit_type_uint64(v, name, &w64.begin, errp);
 }

 static void i440fx_pcihost_get_pci_hole64_end(Object *obj, Visitor *v,
@@ -255,7 +255,7 @@  static void i440fx_pcihost_get_pci_hole64_end(Object *obj, Visitor *v,

     pci_bus_get_w64_range(h->bus, &w64);

-    visit_type_uint64(v, &w64.end, name, errp);
+    visit_type_uint64(v, name, &w64.end, errp);
 }

 static void i440fx_pcihost_initfn(Object *obj)
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index 1fb4707..2b3608a 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -73,7 +73,7 @@  static void q35_host_get_pci_hole_start(Object *obj, Visitor *v,
     Q35PCIHost *s = Q35_HOST_DEVICE(obj);
     uint32_t value = s->mch.pci_info.w32.begin;

-    visit_type_uint32(v, &value, name, errp);
+    visit_type_uint32(v, name, &value, errp);
 }

 static void q35_host_get_pci_hole_end(Object *obj, Visitor *v,
@@ -83,7 +83,7 @@  static void q35_host_get_pci_hole_end(Object *obj, Visitor *v,
     Q35PCIHost *s = Q35_HOST_DEVICE(obj);
     uint32_t value = s->mch.pci_info.w32.end;

-    visit_type_uint32(v, &value, name, errp);
+    visit_type_uint32(v, name, &value, errp);
 }

 static void q35_host_get_pci_hole64_start(Object *obj, Visitor *v,
@@ -95,7 +95,7 @@  static void q35_host_get_pci_hole64_start(Object *obj, Visitor *v,

     pci_bus_get_w64_range(h->bus, &w64);

-    visit_type_uint64(v, &w64.begin, name, errp);
+    visit_type_uint64(v, name, &w64.begin, errp);
 }

 static void q35_host_get_pci_hole64_end(Object *obj, Visitor *v,
@@ -107,7 +107,7 @@  static void q35_host_get_pci_hole64_end(Object *obj, Visitor *v,

     pci_bus_get_w64_range(h->bus, &w64);

-    visit_type_uint64(v, &w64.end, name, errp);
+    visit_type_uint64(v, name, &w64.end, errp);
 }

 static void q35_host_get_mmcfg_size(Object *obj, Visitor *v,
@@ -117,7 +117,7 @@  static void q35_host_get_mmcfg_size(Object *obj, Visitor *v,
     PCIExpressHost *e = PCIE_HOST_BRIDGE(obj);
     uint32_t value = e->size;

-    visit_type_uint32(v, &value, name, errp);
+    visit_type_uint32(v, name, &value, errp);
 }

 static Property mch_props[] = {
diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
index dccb908..9c8fbe8 100644
--- a/hw/ppc/spapr_drc.c
+++ b/hw/ppc/spapr_drc.c
@@ -220,7 +220,7 @@  static void prop_get_index(Object *obj, Visitor *v, void *opaque,
     sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj);
     sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
     uint32_t value = (uint32_t)drck->get_index(drc);
-    visit_type_uint32(v, &value, name, errp);
+    visit_type_uint32(v, name, &value, errp);
 }

 static void prop_get_type(Object *obj, Visitor *v, void *opaque,
@@ -229,7 +229,7 @@  static void prop_get_type(Object *obj, Visitor *v, void *opaque,
     sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj);
     sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
     uint32_t value = (uint32_t)drck->get_type(drc);
-    visit_type_uint32(v, &value, name, errp);
+    visit_type_uint32(v, name, &value, errp);
 }

 static char *prop_get_name(Object *obj, Error **errp)
@@ -247,7 +247,7 @@  static void prop_get_entity_sense(Object *obj, Visitor *v, void *opaque,
     uint32_t value;

     drck->entity_sense(drc, &value);
-    visit_type_uint32(v, &value, name, errp);
+    visit_type_uint32(v, name, &value, errp);
 }

 static void prop_get_fdt(Object *obj, Visitor *v, void *opaque,
@@ -259,7 +259,7 @@  static void prop_get_fdt(Object *obj, Visitor *v, void *opaque,
     void *fdt;

     if (!drc->fdt) {
-        visit_start_struct(v, NULL, NULL, name, 0, &err);
+        visit_start_struct(v, name, NULL, NULL, 0, &err);
         if (!err) {
             visit_end_struct(v, &err);
         }
@@ -282,7 +282,7 @@  static void prop_get_fdt(Object *obj, Visitor *v, void *opaque,
         case FDT_BEGIN_NODE:
             fdt_depth++;
             name = fdt_get_name(fdt, fdt_offset, &name_len);
-            visit_start_struct(v, NULL, NULL, name, 0, &err);
+            visit_start_struct(v, name, NULL, NULL, 0, &err);
             if (err) {
                 error_propagate(errp, err);
                 return;
@@ -308,7 +308,7 @@  static void prop_get_fdt(Object *obj, Visitor *v, void *opaque,
                 return;
             }
             for (i = 0; i < prop_len; i++) {
-                visit_type_uint8(v, (uint8_t *)&prop->data[i], NULL, &err);
+                visit_type_uint8(v, NULL, (uint8_t *)&prop->data[i], &err);
                 if (err) {
                     error_propagate(errp, err);
                     return;
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index 597d8fd..3261446 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -786,7 +786,7 @@  static void usb_msd_get_bootindex(Object *obj, Visitor *v, void *opaque,
     USBDevice *dev = USB_DEVICE(obj);
     MSDState *s = USB_STORAGE_DEV(dev);

-    visit_type_int32(v, &s->conf.bootindex, name, errp);
+    visit_type_int32(v, name, &s->conf.bootindex, errp);
 }

 static void usb_msd_set_bootindex(Object *obj, Visitor *v, void *opaque,
@@ -797,7 +797,7 @@  static void usb_msd_set_bootindex(Object *obj, Visitor *v, void *opaque,
     int32_t boot_index;
     Error *local_err = NULL;

-    visit_type_int32(v, &boot_index, name, &local_err);
+    visit_type_int32(v, name, &boot_index, &local_err);
     if (local_err) {
         goto out;
     }
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 9cc7cf9..1d81a34 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -117,21 +117,21 @@  static void balloon_stats_get_all(Object *obj, Visitor *v,
     VirtIOBalloon *s = opaque;
     int i;

-    visit_start_struct(v, NULL, "guest-stats", name, 0, &err);
+    visit_start_struct(v, name, NULL, "guest-stats", 0, &err);
     if (err) {
         goto out;
     }
-    visit_type_int(v, &s->stats_last_update, "last-update", &err);
+    visit_type_int(v, "last-update", &s->stats_last_update, &err);
     if (err) {
         goto out_end;
     }

-    visit_start_struct(v, NULL, NULL, "stats", 0, &err);
+    visit_start_struct(v, "stats", NULL, NULL, 0, &err);
     if (err) {
         goto out_end;
     }
     for (i = 0; i < VIRTIO_BALLOON_S_NR; i++) {
-        visit_type_uint64(v, &s->stats[i], balloon_stat_names[i], &err);
+        visit_type_uint64(v, balloon_stat_names[i], &s->stats[i], &err);
         if (err) {
             goto out_nested;
         }
@@ -154,7 +154,7 @@  static void balloon_stats_get_poll_interval(Object *obj, Visitor *v,
                                             Error **errp)
 {
     VirtIOBalloon *s = opaque;
-    visit_type_int(v, &s->stats_poll_interval, name, errp);
+    visit_type_int(v, name, &s->stats_poll_interval, errp);
 }

 static void balloon_stats_set_poll_interval(Object *obj, Visitor *v,
@@ -165,7 +165,7 @@  static void balloon_stats_set_poll_interval(Object *obj, Visitor *v,
     Error *local_err = NULL;
     int64_t value;

-    visit_type_int(v, &value, name, &local_err);
+    visit_type_int(v, name, &value, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h
index a14a16d..eb50116 100644
--- a/include/qapi/visitor.h
+++ b/include/qapi/visitor.h
@@ -27,8 +27,8 @@  typedef struct GenericList
     struct GenericList *next;
 } GenericList;

-void visit_start_struct(Visitor *v, void **obj, const char *kind,
-                        const char *name, size_t size, Error **errp);
+void visit_start_struct(Visitor *v, const char *name, void **obj,
+                        const char *kind, size_t size, Error **errp);
 void visit_end_struct(Visitor *v, Error **errp);
 void visit_start_implicit_struct(Visitor *v, void **obj, size_t size,
                                  Error **errp);
@@ -43,7 +43,7 @@  void visit_end_list(Visitor *v, Error **errp);
  * corresponding visit_type_*() needs calling; for other visitors,
  * leave *@present unchanged.  Return *@present for convenience.
  */
-bool visit_optional(Visitor *v, bool *present, const char *name);
+bool visit_optional(Visitor *v, const char *name, bool *present);

 /**
  * Determine the qtype of the item @name in the current object visit.
@@ -51,24 +51,34 @@  bool visit_optional(Visitor *v, bool *present, const char *name);
  * alternate type; for other visitors, leave *@type unchanged.
  * If @promote_int, treat integers as QTYPE_FLOAT.
  */
-void visit_get_next_type(Visitor *v, QType *type, bool promote_int,
-                         const char *name, Error **errp);
-void visit_type_enum(Visitor *v, int *obj, const char * const strings[],
-                     const char *kind, const char *name, Error **errp);
-void visit_type_int(Visitor *v, int64_t *obj, const char *name, Error **errp);
-void visit_type_uint8(Visitor *v, uint8_t *obj, const char *name, Error **errp);
-void visit_type_uint16(Visitor *v, uint16_t *obj, const char *name, Error **errp);
-void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp);
-void visit_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp);
-void visit_type_int8(Visitor *v, int8_t *obj, const char *name, Error **errp);
-void visit_type_int16(Visitor *v, int16_t *obj, const char *name, Error **errp);
-void visit_type_int32(Visitor *v, int32_t *obj, const char *name, Error **errp);
-void visit_type_int64(Visitor *v, int64_t *obj, const char *name, Error **errp);
-void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp);
-void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp);
-void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp);
-void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp);
-void visit_type_any(Visitor *v, QObject **obj, const char *name, Error **errp);
+void visit_get_next_type(Visitor *v, const char *name, QType *type,
+                         bool promote_int, Error **errp);
+void visit_type_enum(Visitor *v, const char *name, int *obj,
+                     const char *const strings[], const char *kind,
+                     Error **errp);
+void visit_type_int(Visitor *v, const char *name, int64_t *obj, Error **errp);
+void visit_type_uint8(Visitor *v, const char *name, uint8_t *obj,
+                      Error **errp);
+void visit_type_uint16(Visitor *v, const char *name, uint16_t *obj,
+                       Error **errp);
+void visit_type_uint32(Visitor *v, const char *name, uint32_t *obj,
+                       Error **errp);
+void visit_type_uint64(Visitor *v, const char *name, uint64_t *obj,
+                       Error **errp);
+void visit_type_int8(Visitor *v, const char *name, int8_t *obj, Error **errp);
+void visit_type_int16(Visitor *v, const char *name, int16_t *obj,
+                      Error **errp);
+void visit_type_int32(Visitor *v, const char *name, int32_t *obj,
+                      Error **errp);
+void visit_type_int64(Visitor *v, const char *name, int64_t *obj,
+                      Error **errp);
+void visit_type_size(Visitor *v, const char *name, uint64_t *obj,
+                     Error **errp);
+void visit_type_bool(Visitor *v, const char *name, bool *obj, Error **errp);
+void visit_type_str(Visitor *v, const char *name, char **obj, Error **errp);
+void visit_type_number(Visitor *v, const char *name, double *obj,
+                       Error **errp);
+void visit_type_any(Visitor *v, const char *name, QObject **obj, Error **errp);
 bool visit_start_union(Visitor *v, bool data_present, Error **errp);
 void visit_end_union(Visitor *v, bool data_present, Error **errp);

diff --git a/memory.c b/memory.c
index 93bd8ed..49eb809 100644
--- a/memory.c
+++ b/memory.c
@@ -934,7 +934,7 @@  static void memory_region_get_addr(Object *obj, Visitor *v, void *opaque,
     MemoryRegion *mr = MEMORY_REGION(obj);
     uint64_t value = mr->addr;

-    visit_type_uint64(v, &value, name, errp);
+    visit_type_uint64(v, name, &value, errp);
 }

 static void memory_region_get_container(Object *obj, Visitor *v, void *opaque,
@@ -946,7 +946,7 @@  static void memory_region_get_container(Object *obj, Visitor *v, void *opaque,
     if (mr->container) {
         path = object_get_canonical_path(OBJECT(mr->container));
     }
-    visit_type_str(v, &path, name, errp);
+    visit_type_str(v, name, &path, errp);
     if (mr->container) {
         g_free(path);
     }
@@ -966,7 +966,7 @@  static void memory_region_get_priority(Object *obj, Visitor *v, void *opaque,
     MemoryRegion *mr = MEMORY_REGION(obj);
     int32_t value = mr->priority;

-    visit_type_int32(v, &value, name, errp);
+    visit_type_int32(v, name, &value, errp);
 }

 static bool memory_region_get_may_overlap(Object *obj, Error **errp)
@@ -982,7 +982,7 @@  static void memory_region_get_size(Object *obj, Visitor *v, void *opaque,
     MemoryRegion *mr = MEMORY_REGION(obj);
     uint64_t value = memory_region_size(mr);

-    visit_type_uint64(v, &value, name, errp);
+    visit_type_uint64(v, name, &value, errp);
 }

 static void memory_region_initfn(Object *obj)
diff --git a/net/dump.c b/net/dump.c
index 88d9582..0aac9b8 100644
--- a/net/dump.c
+++ b/net/dump.c
@@ -277,7 +277,7 @@  static void filter_dump_get_maxlen(Object *obj, Visitor *v, void *opaque,
     NetFilterDumpState *nfds = FILTER_DUMP(obj);
     uint32_t value = nfds->maxlen;

-    visit_type_uint32(v, &value, name, errp);
+    visit_type_uint32(v, name, &value, errp);
 }

 static void filter_dump_set_maxlen(Object *obj, Visitor *v, void *opaque,
@@ -287,7 +287,7 @@  static void filter_dump_set_maxlen(Object *obj, Visitor *v, void *opaque,
     Error *local_err = NULL;
     uint32_t value;

-    visit_type_uint32(v, &value, name, &local_err);
+    visit_type_uint32(v, name, &value, &local_err);
     if (local_err) {
         goto out;
     }
diff --git a/net/filter-buffer.c b/net/filter-buffer.c
index 57be149..3173d26 100644
--- a/net/filter-buffer.c
+++ b/net/filter-buffer.c
@@ -138,7 +138,7 @@  static void filter_buffer_get_interval(Object *obj, Visitor *v, void *opaque,
     FilterBufferState *s = FILTER_BUFFER(obj);
     uint32_t value = s->interval;

-    visit_type_uint32(v, &value, name, errp);
+    visit_type_uint32(v, name, &value, errp);
 }

 static void filter_buffer_set_interval(Object *obj, Visitor *v, void *opaque,
@@ -148,7 +148,7 @@  static void filter_buffer_set_interval(Object *obj, Visitor *v, void *opaque,
     Error *local_err = NULL;
     uint32_t value;

-    visit_type_uint32(v, &value, name, &local_err);
+    visit_type_uint32(v, name, &value, &local_err);
     if (local_err) {
         goto out;
     }
diff --git a/net/net.c b/net/net.c
index 87dd356..428636a 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1035,9 +1035,9 @@  static int net_client_init1(const void *object, int is_netdev, Error **errp)
 static void net_visit(Visitor *v, int is_netdev, void **object, Error **errp)
 {
     if (is_netdev) {
-        visit_type_Netdev(v, (Netdev **)object, NULL, errp);
+        visit_type_Netdev(v, NULL, (Netdev **)object, errp);
     } else {
-        visit_type_NetLegacy(v, (NetLegacy **)object, NULL, errp);
+        visit_type_NetLegacy(v, NULL, (NetLegacy **)object, errp);
     }
 }

diff --git a/numa.c b/numa.c
index 425ef8d..dbf3278 100644
--- a/numa.c
+++ b/numa.c
@@ -218,7 +218,7 @@  static int parse_numa(void *opaque, QemuOpts *opts, Error **errp)

     {
         OptsVisitor *ov = opts_visitor_new(opts);
-        visit_type_NumaOptions(opts_get_visitor(ov), &object, NULL, &err);
+        visit_type_NumaOptions(opts_get_visitor(ov), NULL, &object, &err);
         opts_visitor_cleanup(ov);
     }

@@ -245,8 +245,8 @@  error:

     if (object) {
         QapiDeallocVisitor *dv = qapi_dealloc_visitor_new();
-        visit_type_NumaOptions(qapi_dealloc_get_visitor(dv),
-                               &object, NULL, NULL);
+        visit_type_NumaOptions(qapi_dealloc_get_visitor(dv), NULL, &object,
+                               NULL);
         qapi_dealloc_visitor_cleanup(dv);
     }

diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
index a48fd4e..609db22 100644
--- a/qapi/qapi-visit-core.c
+++ b/qapi/qapi-visit-core.c
@@ -17,8 +17,8 @@ 
 #include "qapi/visitor.h"
 #include "qapi/visitor-impl.h"

-void visit_start_struct(Visitor *v, void **obj, const char *kind,
-                        const char *name, size_t size, Error **errp)
+void visit_start_struct(Visitor *v, const char *name, void **obj,
+                        const char *kind, size_t size, Error **errp)
 {
     v->start_struct(v, obj, kind, name, size, errp);
 }
@@ -73,7 +73,7 @@  void visit_end_union(Visitor *v, bool data_present, Error **errp)
     }
 }

-bool visit_optional(Visitor *v, bool *present, const char *name)
+bool visit_optional(Visitor *v, const char *name, bool *present)
 {
     if (v->optional) {
         v->optional(v, present, name);
@@ -81,21 +81,22 @@  bool visit_optional(Visitor *v, bool *present, const char *name)
     return *present;
 }

-void visit_get_next_type(Visitor *v, QType *type, bool promote_int,
-                         const char *name, Error **errp)
+void visit_get_next_type(Visitor *v, const char *name, QType *type,
+                         bool promote_int, Error **errp)
 {
     if (v->get_next_type) {
         v->get_next_type(v, type, promote_int, name, errp);
     }
 }

-void visit_type_enum(Visitor *v, int *obj, const char * const strings[],
-                     const char *kind, const char *name, Error **errp)
+void visit_type_enum(Visitor *v, const char *name, int *obj,
+                     const char *const strings[], const char *kind,
+                     Error **errp)
 {
     v->type_enum(v, obj, strings, kind, name, errp);
 }

-void visit_type_int(Visitor *v, int64_t *obj, const char *name, Error **errp)
+void visit_type_int(Visitor *v, const char *name, int64_t *obj, Error **errp)
 {
     v->type_int64(v, obj, name, errp);
 }
@@ -117,14 +118,15 @@  static void visit_type_uintN(Visitor *v, uint64_t *obj, const char *name,
     }
 }

-void visit_type_uint8(Visitor *v, uint8_t *obj, const char *name, Error **errp)
+void visit_type_uint8(Visitor *v, const char *name, uint8_t *obj,
+                      Error **errp)
 {
     uint64_t value = *obj;
     visit_type_uintN(v, &value, name, UINT8_MAX, "uint8_t", errp);
     *obj = value;
 }

-void visit_type_uint16(Visitor *v, uint16_t *obj, const char *name,
+void visit_type_uint16(Visitor *v, const char *name, uint16_t *obj,
                        Error **errp)
 {
     uint64_t value = *obj;
@@ -132,7 +134,7 @@  void visit_type_uint16(Visitor *v, uint16_t *obj, const char *name,
     *obj = value;
 }

-void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name,
+void visit_type_uint32(Visitor *v, const char *name, uint32_t *obj,
                        Error **errp)
 {
     uint64_t value = *obj;
@@ -140,7 +142,7 @@  void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name,
     *obj = value;
 }

-void visit_type_uint64(Visitor *v, uint64_t *obj, const char *name,
+void visit_type_uint64(Visitor *v, const char *name, uint64_t *obj,
                        Error **errp)
 {
     v->type_uint64(v, obj, name, errp);
@@ -164,33 +166,37 @@  static void visit_type_intN(Visitor *v, int64_t *obj, const char *name,
     }
 }

-void visit_type_int8(Visitor *v, int8_t *obj, const char *name, Error **errp)
+void visit_type_int8(Visitor *v, const char *name, int8_t *obj, Error **errp)
 {
     int64_t value = *obj;
     visit_type_intN(v, &value, name, INT8_MIN, INT8_MAX, "int8_t", errp);
     *obj = value;
 }

-void visit_type_int16(Visitor *v, int16_t *obj, const char *name, Error **errp)
+void visit_type_int16(Visitor *v, const char *name, int16_t *obj,
+                      Error **errp)
 {
     int64_t value = *obj;
     visit_type_intN(v, &value, name, INT16_MIN, INT16_MAX, "int16_t", errp);
     *obj = value;
 }

-void visit_type_int32(Visitor *v, int32_t *obj, const char *name, Error **errp)
+void visit_type_int32(Visitor *v, const char *name, int32_t *obj,
+                      Error **errp)
 {
     int64_t value = *obj;
     visit_type_intN(v, &value, name, INT32_MIN, INT32_MAX, "int32_t", errp);
     *obj = value;
 }

-void visit_type_int64(Visitor *v, int64_t *obj, const char *name, Error **errp)
+void visit_type_int64(Visitor *v, const char *name, int64_t *obj,
+                      Error **errp)
 {
     v->type_int64(v, obj, name, errp);
 }

-void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp)
+void visit_type_size(Visitor *v, const char *name, uint64_t *obj,
+                     Error **errp)
 {
     if (v->type_size) {
         v->type_size(v, obj, name, errp);
@@ -199,23 +205,23 @@  void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp)
     }
 }

-void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp)
+void visit_type_bool(Visitor *v, const char *name, bool *obj, Error **errp)
 {
     v->type_bool(v, obj, name, errp);
 }

-void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp)
+void visit_type_str(Visitor *v, const char *name, char **obj, Error **errp)
 {
     v->type_str(v, obj, name, errp);
 }

-void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp)
+void visit_type_number(Visitor *v, const char *name, double *obj,
+                       Error **errp)
 {
     v->type_number(v, obj, name, errp);
 }

-void visit_type_any(Visitor *v, QObject **obj, const char *name,
-                    Error **errp)
+void visit_type_any(Visitor *v, const char *name, QObject **obj, Error **errp)
 {
     v->type_any(v, obj, name, errp);
 }
@@ -236,7 +242,7 @@  void output_type_enum(Visitor *v, int *obj, const char * const strings[],
     }

     enum_str = (char *)strings[value];
-    visit_type_str(v, &enum_str, name, errp);
+    visit_type_str(v, name, &enum_str, errp);
 }

 void input_type_enum(Visitor *v, int *obj, const char * const strings[],
@@ -249,7 +255,7 @@  void input_type_enum(Visitor *v, int *obj, const char * const strings[],

     assert(strings);

-    visit_type_str(v, &enum_str, name, &local_err);
+    visit_type_str(v, name, &enum_str, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
diff --git a/qemu-img.c b/qemu-img.c
index a5949e6..5ee7a38 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -376,8 +376,8 @@  static void dump_json_image_check(ImageCheck *check, bool quiet)
     QString *str;
     QmpOutputVisitor *ov = qmp_output_visitor_new();
     QObject *obj;
-    visit_type_ImageCheck(qmp_output_get_visitor(ov),
-                          &check, NULL, &local_err);
+    visit_type_ImageCheck(qmp_output_get_visitor(ov), NULL, &check,
+                          &local_err);
     obj = qmp_output_get_qobject(ov);
     str = qobject_to_json_pretty(obj);
     assert(str != NULL);
@@ -1924,8 +1924,8 @@  static void dump_json_image_info_list(ImageInfoList *list)
     QString *str;
     QmpOutputVisitor *ov = qmp_output_visitor_new();
     QObject *obj;
-    visit_type_ImageInfoList(qmp_output_get_visitor(ov),
-                             &list, NULL, &local_err);
+    visit_type_ImageInfoList(qmp_output_get_visitor(ov), NULL, &list,
+                             &local_err);
     obj = qmp_output_get_qobject(ov);
     str = qobject_to_json_pretty(obj);
     assert(str != NULL);
@@ -1941,8 +1941,7 @@  static void dump_json_image_info(ImageInfo *info)
     QString *str;
     QmpOutputVisitor *ov = qmp_output_visitor_new();
     QObject *obj;
-    visit_type_ImageInfo(qmp_output_get_visitor(ov),
-                         &info, NULL, &local_err);
+    visit_type_ImageInfo(qmp_output_get_visitor(ov), NULL, &info, &local_err);
     obj = qmp_output_get_qobject(ov);
     str = qobject_to_json_pretty(obj);
     assert(str != NULL);
diff --git a/qom/object.c b/qom/object.c
index 4d7d8c8..6a5ad59 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1243,8 +1243,8 @@  int object_property_get_enum(Object *obj, const char *name,
     str = string_output_get_string(sov);
     siv = string_input_visitor_new(str);
     string_output_visitor_cleanup(sov);
-    visit_type_enum(string_input_get_visitor(siv),
-                    &ret, enumprop->strings, NULL, name, errp);
+    visit_type_enum(string_input_get_visitor(siv), name, &ret,
+                    enumprop->strings, NULL, errp);

     g_free(str);
     string_input_visitor_cleanup(siv);
@@ -1269,8 +1269,7 @@  void object_property_get_uint16List(Object *obj, const char *name,
     }
     str = string_output_get_string(ov);
     iv = string_input_visitor_new(str);
-    visit_type_uint16List(string_input_get_visitor(iv),
-                          list, NULL, errp);
+    visit_type_uint16List(string_input_get_visitor(iv), NULL, list, errp);

     g_free(str);
     string_input_visitor_cleanup(iv);
@@ -1342,7 +1341,7 @@  static void object_get_child_property(Object *obj, Visitor *v, void *opaque,
     gchar *path;

     path = object_get_canonical_path(child);
-    visit_type_str(v, &path, name, errp);
+    visit_type_str(v, name, &path, errp);
     g_free(path);
 }

@@ -1413,11 +1412,11 @@  static void object_get_link_property(Object *obj, Visitor *v, void *opaque,

     if (*child) {
         path = object_get_canonical_path(*child);
-        visit_type_str(v, &path, name, errp);
+        visit_type_str(v, name, &path, errp);
         g_free(path);
     } else {
         path = (gchar *)"";
-        visit_type_str(v, &path, name, errp);
+        visit_type_str(v, name, &path, errp);
     }
 }

@@ -1471,7 +1470,7 @@  static void object_set_link_property(Object *obj, Visitor *v, void *opaque,
     Object *new_target = NULL;
     char *path = NULL;

-    visit_type_str(v, &path, name, &local_err);
+    visit_type_str(v, name, &path, &local_err);

     if (!local_err && strcmp(path, "") != 0) {
         new_target = object_resolve_link(obj, name, path, &local_err);
@@ -1738,7 +1737,7 @@  static void property_get_str(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_str(v, &value, name, errp);
+    visit_type_str(v, name, &value, errp);
     g_free(value);
 }

@@ -1749,7 +1748,7 @@  static void property_set_str(Object *obj, Visitor *v, void *opaque,
     char *value;
     Error *local_err = NULL;

-    visit_type_str(v, &value, name, &local_err);
+    visit_type_str(v, name, &value, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
@@ -1830,7 +1829,7 @@  static void property_get_bool(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_bool(v, &value, name, errp);
+    visit_type_bool(v, name, &value, errp);
 }

 static void property_set_bool(Object *obj, Visitor *v, void *opaque,
@@ -1840,7 +1839,7 @@  static void property_set_bool(Object *obj, Visitor *v, void *opaque,
     bool value;
     Error *local_err = NULL;

-    visit_type_bool(v, &value, name, &local_err);
+    visit_type_bool(v, name, &value, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
@@ -1913,7 +1912,7 @@  static void property_get_enum(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_enum(v, &value, prop->strings, NULL, name, errp);
+    visit_type_enum(v, name, &value, prop->strings, NULL, errp);
 }

 static void property_set_enum(Object *obj, Visitor *v, void *opaque,
@@ -1923,7 +1922,7 @@  static void property_set_enum(Object *obj, Visitor *v, void *opaque,
     int value;
     Error *err = NULL;

-    visit_type_enum(v, &value, prop->strings, NULL, name, &err);
+    visit_type_enum(v, name, &value, prop->strings, NULL, &err);
     if (err) {
         error_propagate(errp, err);
         return;
@@ -2004,31 +2003,31 @@  static void property_get_tm(Object *obj, Visitor *v, void *opaque,
         goto out;
     }

-    visit_start_struct(v, NULL, "struct tm", name, 0, &err);
+    visit_start_struct(v, name, NULL, "struct tm", 0, &err);
     if (err) {
         goto out;
     }
-    visit_type_int32(v, &value.tm_year, "tm_year", &err);
+    visit_type_int32(v, "tm_year", &value.tm_year, &err);
     if (err) {
         goto out_end;
     }
-    visit_type_int32(v, &value.tm_mon, "tm_mon", &err);
+    visit_type_int32(v, "tm_mon", &value.tm_mon, &err);
     if (err) {
         goto out_end;
     }
-    visit_type_int32(v, &value.tm_mday, "tm_mday", &err);
+    visit_type_int32(v, "tm_mday", &value.tm_mday, &err);
     if (err) {
         goto out_end;
     }
-    visit_type_int32(v, &value.tm_hour, "tm_hour", &err);
+    visit_type_int32(v, "tm_hour", &value.tm_hour, &err);
     if (err) {
         goto out_end;
     }
-    visit_type_int32(v, &value.tm_min, "tm_min", &err);
+    visit_type_int32(v, "tm_min", &value.tm_min, &err);
     if (err) {
         goto out_end;
     }
-    visit_type_int32(v, &value.tm_sec, "tm_sec", &err);
+    visit_type_int32(v, "tm_sec", &value.tm_sec, &err);
     if (err) {
         goto out_end;
     }
@@ -2096,7 +2095,7 @@  static void property_get_uint8_ptr(Object *obj, Visitor *v,
                                    Error **errp)
 {
     uint8_t value = *(uint8_t *)opaque;
-    visit_type_uint8(v, &value, name, errp);
+    visit_type_uint8(v, name, &value, errp);
 }

 static void property_get_uint16_ptr(Object *obj, Visitor *v,
@@ -2104,7 +2103,7 @@  static void property_get_uint16_ptr(Object *obj, Visitor *v,
                                    Error **errp)
 {
     uint16_t value = *(uint16_t *)opaque;
-    visit_type_uint16(v, &value, name, errp);
+    visit_type_uint16(v, name, &value, errp);
 }

 static void property_get_uint32_ptr(Object *obj, Visitor *v,
@@ -2112,7 +2111,7 @@  static void property_get_uint32_ptr(Object *obj, Visitor *v,
                                    Error **errp)
 {
     uint32_t value = *(uint32_t *)opaque;
-    visit_type_uint32(v, &value, name, errp);
+    visit_type_uint32(v, name, &value, errp);
 }

 static void property_get_uint64_ptr(Object *obj, Visitor *v,
@@ -2120,7 +2119,7 @@  static void property_get_uint64_ptr(Object *obj, Visitor *v,
                                    Error **errp)
 {
     uint64_t value = *(uint64_t *)opaque;
-    visit_type_uint64(v, &value, name, errp);
+    visit_type_uint64(v, name, &value, errp);
 }

 void object_property_add_uint8_ptr(Object *obj, const char *name,
diff --git a/replay/replay-input.c b/replay/replay-input.c
index bc15f59..ade61e4 100644
--- a/replay/replay-input.c
+++ b/replay/replay-input.c
@@ -28,7 +28,7 @@  static InputEvent *qapi_clone_InputEvent(InputEvent *src)

     qov = qmp_output_visitor_new();
     ov = qmp_output_get_visitor(qov);
-    visit_type_InputEvent(ov, &src, NULL, &error_abort);
+    visit_type_InputEvent(ov, NULL, &src, &error_abort);
     obj = qmp_output_get_qobject(qov);
     qmp_output_visitor_cleanup(qov);
     if (!obj) {
@@ -37,7 +37,7 @@  static InputEvent *qapi_clone_InputEvent(InputEvent *src)

     qiv = qmp_input_visitor_new(obj);
     iv = qmp_input_get_visitor(qiv);
-    visit_type_InputEvent(iv, &dst, NULL, &error_abort);
+    visit_type_InputEvent(iv, NULL, &dst, &error_abort);
     qmp_input_visitor_cleanup(qiv);
     qobject_decref(obj);

diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
index 561e47a..91c5a4e 100644
--- a/scripts/qapi-commands.py
+++ b/scripts/qapi-commands.py
@@ -131,7 +131,7 @@  static void qmp_marshal_output_%(c_name)s(%(c_type)s ret_in, QObject **ret_out,
     Visitor *v;

     v = qmp_output_get_visitor(qov);
-    visit_type_%(c_name)s(v, &ret_in, "unused", &err);
+    visit_type_%(c_name)s(v, "unused", &ret_in, &err);
     if (err) {
         goto out;
     }
@@ -142,7 +142,7 @@  out:
     qmp_output_visitor_cleanup(qov);
     qdv = qapi_dealloc_visitor_new();
     v = qapi_dealloc_get_visitor(qdv);
-    visit_type_%(c_name)s(v, &ret_in, "unused", NULL);
+    visit_type_%(c_name)s(v, "unused", &ret_in, NULL);
     qapi_dealloc_visitor_cleanup(qdv);
 }
 ''',
diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py
index 761cda9..fd03e38 100644
--- a/scripts/qapi-event.py
+++ b/scripts/qapi-event.py
@@ -63,7 +63,7 @@  def gen_event_send(name, arg_type):
     qov = qmp_output_visitor_new();
     v = qmp_output_get_visitor(qov);

-    visit_start_struct(v, NULL, NULL, "%(name)s", 0, &err);
+    visit_start_struct(v, "%(name)s", NULL, NULL, 0, &err);
 ''',
                      name=name)
         ret += gen_err_check()
diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
index 0d86269..d3f631a 100644
--- a/scripts/qapi-types.py
+++ b/scripts/qapi-types.py
@@ -155,7 +155,7 @@  void qapi_free_%(c_name)s(%(c_name)s *obj)

     qdv = qapi_dealloc_visitor_new();
     v = qapi_dealloc_get_visitor(qdv);
-    visit_type_%(c_name)s(v, &obj, NULL, NULL);
+    visit_type_%(c_name)s(v, NULL, &obj, NULL);
     qapi_dealloc_visitor_cleanup(qdv);
 }
 ''',
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index 6bd188b..ca28b08 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -29,7 +29,7 @@  def gen_visit_decl(name, scalar=False):
     if not scalar:
         c_type += '*'
     return mcgen('''
-void visit_type_%(c_name)s(Visitor *v, %(c_type)sobj, const char *name, Error **errp);
+void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_type)sobj, Error **errp);
 ''',
                  c_name=c_name(name), c_type=c_type)

@@ -118,11 +118,11 @@  def gen_visit_struct(name, base, members):
     # call qapi_free_FOO() to avoid a memory leak of the partial FOO.
     ret += mcgen('''

-void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error **errp)
+void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error **errp)
 {
     Error *err = NULL;

-    visit_start_struct(v, (void **)obj, "%(name)s", name, sizeof(%(c_name)s), &err);
+    visit_start_struct(v, name, (void **)obj, "%(name)s", sizeof(%(c_name)s), &err);
     if (err) {
         goto out;
     }
@@ -150,7 +150,7 @@  def gen_visit_list(name, element_type):
     # call qapi_free_FOOList() to avoid a memory leak of the partial FOOList.
     return mcgen('''

-void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error **errp)
+void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error **errp)
 {
     Error *err = NULL;
     GenericList *i, **prev;
@@ -164,7 +164,7 @@  void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error
          !err && (i = visit_next_list(v, prev, &err)) != NULL;
          prev = &i) {
         %(c_name)s *native_i = (%(c_name)s *)i;
-        visit_type_%(c_elt_type)s(v, &native_i->value, NULL, &err);
+        visit_type_%(c_elt_type)s(v, NULL, &native_i->value, &err);
     }

     error_propagate(errp, err);
@@ -180,10 +180,10 @@  out:
 def gen_visit_enum(name):
     return mcgen('''

-void visit_type_%(c_name)s(Visitor *v, %(c_name)s *obj, const char *name, Error **errp)
+void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s *obj, Error **errp)
 {
     int tmp = *obj;
-    visit_type_enum(v, &tmp, %(c_name)s_lookup, "%(name)s", name, errp);
+    visit_type_enum(v, name, &tmp, %(c_name)s_lookup, "%(name)s", errp);
     *obj = tmp;
 }
 ''',
@@ -198,7 +198,7 @@  def gen_visit_alternate(name, variants):

     ret = mcgen('''

-void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error **errp)
+void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error **errp)
 {
     Error *err = NULL;

@@ -206,7 +206,7 @@  void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error
     if (err) {
         goto out;
     }
-    visit_get_next_type(v, &(*obj)->type, %(promote_int)s, name, &err);
+    visit_get_next_type(v, name, &(*obj)->type, %(promote_int)s, &err);
     if (err) {
         goto out_obj;
     }
@@ -217,7 +217,7 @@  void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error
     for var in variants.variants:
         ret += mcgen('''
     case %(case)s:
-        visit_type_%(c_type)s(v, &(*obj)->u.%(c_name)s, name, &err);
+        visit_type_%(c_type)s(v, name, &(*obj)->u.%(c_name)s, &err);
         break;
 ''',
                      case=var.type.alternate_qtype(),
@@ -255,11 +255,11 @@  def gen_visit_union(name, base, variants):

     ret += mcgen('''

-void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error **errp)
+void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error **errp)
 {
     Error *err = NULL;

-    visit_start_struct(v, (void **)obj, "%(name)s", name, sizeof(%(c_name)s), &err);
+    visit_start_struct(v, name, (void **)obj, "%(name)s", sizeof(%(c_name)s), &err);
     if (err) {
         goto out;
     }
@@ -276,7 +276,7 @@  void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error
                      c_name=base.c_name())
     else:
         ret += mcgen('''
-    visit_type_%(c_type)s(v, &(*obj)->%(c_name)s, "%(name)s", &err);
+    visit_type_%(c_type)s(v, "%(name)s", &(*obj)->%(c_name)s, &err);
 ''',
                      c_type=variants.tag_member.type.c_name(),
                      c_name=c_name(variants.tag_member.name),
@@ -300,7 +300,7 @@  void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error
                                        var.name))
         if simple_union_type:
             ret += mcgen('''
-        visit_type_%(c_type)s(v, &(*obj)->u.%(c_name)s, "data", &err);
+        visit_type_%(c_type)s(v, "data", &(*obj)->u.%(c_name)s, &err);
 ''',
                          c_type=simple_union_type.c_name(),
                          c_name=c_name(var.name))
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 497eaba..3b4c62e 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1647,7 +1647,7 @@  def gen_visit_fields(members, prefix='', need_cast=False, skiperr=False,
     for memb in members:
         if memb.optional:
             ret += mcgen('''
-    if (visit_optional(v, &%(prefix)shas_%(c_name)s, "%(name)s")) {
+    if (visit_optional(v, "%(name)s", &%(prefix)shas_%(c_name)s)) {
 ''',
                          prefix=prefix, c_name=c_name(memb.name),
                          name=memb.name, errp=errparg)
@@ -1660,7 +1660,7 @@  def gen_visit_fields(members, prefix='', need_cast=False, skiperr=False,
             cast = ''

         ret += mcgen('''
-    visit_type_%(c_type)s(v, %(cast)s&%(prefix)s%(c_name)s, "%(name)s", %(errp)s);
+    visit_type_%(c_type)s(v, "%(name)s", %(cast)s&%(prefix)s%(c_name)s, %(errp)s);
 ''',
                      c_type=memb.type.c_name(), prefix=prefix, cast=cast,
                      c_name=c_name(memb.name), name=memb.name,
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 13c5b69..110fa1c 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1520,7 +1520,7 @@  static void x86_cpuid_version_get_family(Object *obj, Visitor *v, void *opaque,
     if (value == 0xf) {
         value += (env->cpuid_version >> 20) & 0xff;
     }
-    visit_type_int(v, &value, name, errp);
+    visit_type_int(v, name, &value, errp);
 }

 static void x86_cpuid_version_set_family(Object *obj, Visitor *v, void *opaque,
@@ -1533,7 +1533,7 @@  static void x86_cpuid_version_set_family(Object *obj, Visitor *v, void *opaque,
     Error *local_err = NULL;
     int64_t value;

-    visit_type_int(v, &value, name, &local_err);
+    visit_type_int(v, name, &value, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
@@ -1561,7 +1561,7 @@  static void x86_cpuid_version_get_model(Object *obj, Visitor *v, void *opaque,

     value = (env->cpuid_version >> 4) & 0xf;
     value |= ((env->cpuid_version >> 16) & 0xf) << 4;
-    visit_type_int(v, &value, name, errp);
+    visit_type_int(v, name, &value, errp);
 }

 static void x86_cpuid_version_set_model(Object *obj, Visitor *v, void *opaque,
@@ -1574,7 +1574,7 @@  static void x86_cpuid_version_set_model(Object *obj, Visitor *v, void *opaque,
     Error *local_err = NULL;
     int64_t value;

-    visit_type_int(v, &value, name, &local_err);
+    visit_type_int(v, name, &value, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
@@ -1598,7 +1598,7 @@  static void x86_cpuid_version_get_stepping(Object *obj, Visitor *v,
     int64_t value;

     value = env->cpuid_version & 0xf;
-    visit_type_int(v, &value, name, errp);
+    visit_type_int(v, name, &value, errp);
 }

 static void x86_cpuid_version_set_stepping(Object *obj, Visitor *v,
@@ -1612,7 +1612,7 @@  static void x86_cpuid_version_set_stepping(Object *obj, Visitor *v,
     Error *local_err = NULL;
     int64_t value;

-    visit_type_int(v, &value, name, &local_err);
+    visit_type_int(v, name, &value, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
@@ -1705,7 +1705,7 @@  static void x86_cpuid_get_tsc_freq(Object *obj, Visitor *v, void *opaque,
     int64_t value;

     value = cpu->env.tsc_khz * 1000;
-    visit_type_int(v, &value, name, errp);
+    visit_type_int(v, name, &value, errp);
 }

 static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,
@@ -1717,7 +1717,7 @@  static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,
     Error *local_err = NULL;
     int64_t value;

-    visit_type_int(v, &value, name, &local_err);
+    visit_type_int(v, name, &value, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
@@ -1737,7 +1737,7 @@  static void x86_cpuid_get_apic_id(Object *obj, Visitor *v, void *opaque,
     X86CPU *cpu = X86_CPU(obj);
     int64_t value = cpu->apic_id;

-    visit_type_int(v, &value, name, errp);
+    visit_type_int(v, name, &value, errp);
 }

 static void x86_cpuid_set_apic_id(Object *obj, Visitor *v, void *opaque,
@@ -1756,7 +1756,7 @@  static void x86_cpuid_set_apic_id(Object *obj, Visitor *v, void *opaque,
         return;
     }

-    visit_type_int(v, &value, name, &error);
+    visit_type_int(v, name, &value, &error);
     if (error) {
         error_propagate(errp, error);
         return;
@@ -1801,7 +1801,7 @@  static void x86_cpu_get_feature_words(Object *obj, Visitor *v, void *opaque,
         list = &list_entries[w];
     }

-    visit_type_X86CPUFeatureWordInfoList(v, &list, "feature-words", &err);
+    visit_type_X86CPUFeatureWordInfoList(v, "feature-words", &list, &err);
     error_propagate(errp, err);
 }

@@ -1811,7 +1811,7 @@  static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
     X86CPU *cpu = X86_CPU(obj);
     int64_t value = cpu->hyperv_spinlock_attempts;

-    visit_type_int(v, &value, name, errp);
+    visit_type_int(v, name, &value, errp);
 }

 static void x86_set_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
@@ -1823,7 +1823,7 @@  static void x86_set_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
     Error *err = NULL;
     int64_t value;

-    visit_type_int(v, &value, name, &err);
+    visit_type_int(v, name, &value, &err);
     if (err) {
         error_propagate(errp, err);
         return;
@@ -2928,7 +2928,7 @@  static void x86_cpu_get_bit_prop(Object *obj,
 {
     BitProperty *fp = opaque;
     bool value = (*fp->ptr & fp->mask) == fp->mask;
-    visit_type_bool(v, &value, name, errp);
+    visit_type_bool(v, name, &value, errp);
 }

 static void x86_cpu_set_bit_prop(Object *obj,
@@ -2947,7 +2947,7 @@  static void x86_cpu_set_bit_prop(Object *obj,
         return;
     }

-    visit_type_bool(v, &value, name, &local_err);
+    visit_type_bool(v, name, &value, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 4ab2d92..9d7936b 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -8059,7 +8059,7 @@  static void powerpc_get_compat(Object *obj, Visitor *v,
         break;
     }

-    visit_type_str(v, &value, name, errp);
+    visit_type_str(v, name, &value, errp);
 }

 static void powerpc_set_compat(Object *obj, Visitor *v,
@@ -8070,7 +8070,7 @@  static void powerpc_set_compat(Object *obj, Visitor *v,
     Property *prop = opaque;
     uint32_t *max_compat = qdev_get_prop_ptr(DEVICE(obj), prop);

-    visit_type_str(v, &value, name, &error);
+    visit_type_str(v, name, &value, &error);
     if (error) {
         error_propagate(errp, error);
         return;
diff --git a/tests/test-opts-visitor.c b/tests/test-opts-visitor.c
index 1c753d9..9600b97 100644
--- a/tests/test-opts-visitor.c
+++ b/tests/test-opts-visitor.c
@@ -44,7 +44,7 @@  setup_fixture(OptsVisitorFixture *f, gconstpointer test_data)
     g_assert(opts != NULL);

     ov = opts_visitor_new(opts);
-    visit_type_UserDefOptions(opts_get_visitor(ov), &f->userdef, NULL,
+    visit_type_UserDefOptions(opts_get_visitor(ov), NULL, &f->userdef,
                               &f->err);
     opts_visitor_cleanup(ov);
     qemu_opts_del(opts);
@@ -58,8 +58,8 @@  teardown_fixture(OptsVisitorFixture *f, gconstpointer test_data)
         QapiDeallocVisitor *dv;

         dv = qapi_dealloc_visitor_new();
-        visit_type_UserDefOptions(qapi_dealloc_get_visitor(dv), &f->userdef,
-                                  NULL, NULL);
+        visit_type_UserDefOptions(qapi_dealloc_get_visitor(dv), NULL,
+                                  &f->userdef, NULL);
         qapi_dealloc_visitor_cleanup(dv);
     }
     error_free(f->err);
diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c
index 0be9835..e728611 100644
--- a/tests/test-qdev-global-props.c
+++ b/tests/test-qdev-global-props.c
@@ -124,7 +124,7 @@  static void prop1_accessor(Object *obj,
 {
     MyType *mt = DYNAMIC_TYPE(obj);

-    visit_type_uint32(v, &mt->prop1, name, errp);
+    visit_type_uint32(v, name, &mt->prop1, errp);
 }

 static void prop2_accessor(Object *obj,
@@ -135,7 +135,7 @@  static void prop2_accessor(Object *obj,
 {
     MyType *mt = DYNAMIC_TYPE(obj);

-    visit_type_uint32(v, &mt->prop2, name, errp);
+    visit_type_uint32(v, name, &mt->prop2, errp);
 }

 static void dynamic_instance_init(Object *obj)
diff --git a/tests/test-qmp-commands.c b/tests/test-qmp-commands.c
index 9f35b80..4d267b6 100644
--- a/tests/test-qmp-commands.c
+++ b/tests/test-qmp-commands.c
@@ -217,7 +217,7 @@  static void test_dealloc_partial(void)
         qdict_put_obj(ud2_dict, "string0", QOBJECT(qstring_from_str(text)));

         qiv = qmp_input_visitor_new(QOBJECT(ud2_dict));
-        visit_type_UserDefTwo(qmp_input_get_visitor(qiv), &ud2, NULL, &err);
+        visit_type_UserDefTwo(qmp_input_get_visitor(qiv), NULL, &ud2, &err);
         qmp_input_visitor_cleanup(qiv);
         QDECREF(ud2_dict);
     }
diff --git a/tests/test-qmp-input-strict.c b/tests/test-qmp-input-strict.c
index f1c2e3b..775ad39 100644
--- a/tests/test-qmp-input-strict.c
+++ b/tests/test-qmp-input-strict.c
@@ -98,7 +98,7 @@  static void test_validate_struct(TestInputVisitorData *data,

     v = validate_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo' }");

-    visit_type_TestStruct(v, &p, NULL, &error_abort);
+    visit_type_TestStruct(v, NULL, &p, &error_abort);
     g_free(p->string);
     g_free(p);
 }
@@ -114,7 +114,7 @@  static void test_validate_struct_nested(TestInputVisitorData *data,
                            "'dict2': { 'userdef': { 'integer': 42, "
                            "'string': 'string' }, 'string': 'string2'}}}");

-    visit_type_UserDefTwo(v, &udp, NULL, &error_abort);
+    visit_type_UserDefTwo(v, NULL, &udp, &error_abort);
     qapi_free_UserDefTwo(udp);
 }

@@ -126,7 +126,7 @@  static void test_validate_list(TestInputVisitorData *data,

     v = validate_test_init(data, "[ { 'string': 'string0', 'integer': 42 }, { 'string': 'string1', 'integer': 43 }, { 'string': 'string2', 'integer': 44 } ]");

-    visit_type_UserDefOneList(v, &head, NULL, &error_abort);
+    visit_type_UserDefOneList(v, NULL, &head, &error_abort);
     qapi_free_UserDefOneList(head);
 }

@@ -138,7 +138,7 @@  static void test_validate_union_native_list(TestInputVisitorData *data,

     v = validate_test_init(data, "{ 'type': 'integer', 'data' : [ 1, 2 ] }");

-    visit_type_UserDefNativeListUnion(v, &tmp, NULL, &error_abort);
+    visit_type_UserDefNativeListUnion(v, NULL, &tmp, &error_abort);
     qapi_free_UserDefNativeListUnion(tmp);
 }

@@ -154,7 +154,7 @@  static void test_validate_union_flat(TestInputVisitorData *data,
                            "'string': 'str', "
                            "'boolean': true }");

-    visit_type_UserDefFlatUnion(v, &tmp, NULL, &error_abort);
+    visit_type_UserDefFlatUnion(v, NULL, &tmp, &error_abort);
     qapi_free_UserDefFlatUnion(tmp);
 }

@@ -166,7 +166,7 @@  static void test_validate_alternate(TestInputVisitorData *data,

     v = validate_test_init(data, "42");

-    visit_type_UserDefAlternate(v, &tmp, NULL, &error_abort);
+    visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort);
     qapi_free_UserDefAlternate(tmp);
 }

@@ -179,7 +179,7 @@  static void test_validate_fail_struct(TestInputVisitorData *data,

     v = validate_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo', 'extra': 42 }");

-    visit_type_TestStruct(v, &p, NULL, &err);
+    visit_type_TestStruct(v, NULL, &p, &err);
     error_free_or_abort(&err);
     if (p) {
         g_free(p->string);
@@ -196,7 +196,7 @@  static void test_validate_fail_struct_nested(TestInputVisitorData *data,

     v = validate_test_init(data, "{ 'string0': 'string0', 'dict1': { 'string1': 'string1', 'dict2': { 'userdef1': { 'integer': 42, 'string': 'string', 'extra': [42, 23, {'foo':'bar'}] }, 'string2': 'string2'}}}");

-    visit_type_UserDefTwo(v, &udp, NULL, &err);
+    visit_type_UserDefTwo(v, NULL, &udp, &err);
     error_free_or_abort(&err);
     qapi_free_UserDefTwo(udp);
 }
@@ -210,7 +210,7 @@  static void test_validate_fail_list(TestInputVisitorData *data,

     v = validate_test_init(data, "[ { 'string': 'string0', 'integer': 42 }, { 'string': 'string1', 'integer': 43 }, { 'string': 'string2', 'integer': 44, 'extra': 'ggg' } ]");

-    visit_type_UserDefOneList(v, &head, NULL, &err);
+    visit_type_UserDefOneList(v, NULL, &head, &err);
     error_free_or_abort(&err);
     qapi_free_UserDefOneList(head);
 }
@@ -225,7 +225,7 @@  static void test_validate_fail_union_native_list(TestInputVisitorData *data,
     v = validate_test_init(data,
                            "{ 'type': 'integer', 'data' : [ 'string' ] }");

-    visit_type_UserDefNativeListUnion(v, &tmp, NULL, &err);
+    visit_type_UserDefNativeListUnion(v, NULL, &tmp, &err);
     error_free_or_abort(&err);
     qapi_free_UserDefNativeListUnion(tmp);
 }
@@ -239,7 +239,7 @@  static void test_validate_fail_union_flat(TestInputVisitorData *data,

     v = validate_test_init(data, "{ 'string': 'c', 'integer': 41, 'boolean': true }");

-    visit_type_UserDefFlatUnion(v, &tmp, NULL, &err);
+    visit_type_UserDefFlatUnion(v, NULL, &tmp, &err);
     error_free_or_abort(&err);
     qapi_free_UserDefFlatUnion(tmp);
 }
@@ -254,7 +254,7 @@  static void test_validate_fail_union_flat_no_discrim(TestInputVisitorData *data,
     /* test situation where discriminator field ('enum1' here) is missing */
     v = validate_test_init(data, "{ 'integer': 42, 'string': 'c', 'string1': 'd', 'string2': 'e' }");

-    visit_type_UserDefFlatUnion2(v, &tmp, NULL, &err);
+    visit_type_UserDefFlatUnion2(v, NULL, &tmp, &err);
     error_free_or_abort(&err);
     qapi_free_UserDefFlatUnion2(tmp);
 }
@@ -268,7 +268,7 @@  static void test_validate_fail_alternate(TestInputVisitorData *data,

     v = validate_test_init(data, "3.14");

-    visit_type_UserDefAlternate(v, &tmp, NULL, &err);
+    visit_type_UserDefAlternate(v, NULL, &tmp, &err);
     error_free_or_abort(&err);
     qapi_free_UserDefAlternate(tmp);
 }
@@ -281,7 +281,7 @@  static void do_test_validate_qmp_introspect(TestInputVisitorData *data,

     v = validate_test_init_raw(data, schema_json);

-    visit_type_SchemaInfoList(v, &schema, NULL, &error_abort);
+    visit_type_SchemaInfoList(v, NULL, &schema, &error_abort);
     g_assert(schema);

     qapi_free_SchemaInfoList(schema);
diff --git a/tests/test-qmp-input-visitor.c b/tests/test-qmp-input-visitor.c
index b4a5bee..f6bd408 100644
--- a/tests/test-qmp-input-visitor.c
+++ b/tests/test-qmp-input-visitor.c
@@ -93,7 +93,7 @@  static void test_visitor_in_int(TestInputVisitorData *data,

     v = visitor_input_test_init(data, "%" PRId64, value);

-    visit_type_int(v, &res, NULL, &error_abort);
+    visit_type_int(v, NULL, &res, &error_abort);
     g_assert_cmpint(res, ==, value);
 }

@@ -110,7 +110,7 @@  static void test_visitor_in_int_overflow(TestInputVisitorData *data,
      */
     v = visitor_input_test_init(data, "%f", DBL_MAX);

-    visit_type_int(v, &res, NULL, &err);
+    visit_type_int(v, NULL, &res, &err);
     error_free_or_abort(&err);
 }

@@ -122,7 +122,7 @@  static void test_visitor_in_bool(TestInputVisitorData *data,

     v = visitor_input_test_init(data, "true");

-    visit_type_bool(v, &res, NULL, &error_abort);
+    visit_type_bool(v, NULL, &res, &error_abort);
     g_assert_cmpint(res, ==, true);
 }

@@ -134,7 +134,7 @@  static void test_visitor_in_number(TestInputVisitorData *data,

     v = visitor_input_test_init(data, "%f", value);

-    visit_type_number(v, &res, NULL, &error_abort);
+    visit_type_number(v, NULL, &res, &error_abort);
     g_assert_cmpfloat(res, ==, value);
 }

@@ -146,7 +146,7 @@  static void test_visitor_in_string(TestInputVisitorData *data,

     v = visitor_input_test_init(data, "%s", value);

-    visit_type_str(v, &res, NULL, &error_abort);
+    visit_type_str(v, NULL, &res, &error_abort);
     g_assert_cmpstr(res, ==, value);

     g_free(res);
@@ -163,7 +163,7 @@  static void test_visitor_in_enum(TestInputVisitorData *data,

         v = visitor_input_test_init(data, "%s", EnumOne_lookup[i]);

-        visit_type_EnumOne(v, &res, NULL, &error_abort);
+        visit_type_EnumOne(v, NULL, &res, &error_abort);
         g_assert_cmpint(i, ==, res);
     }
 }
@@ -177,7 +177,7 @@  static void test_visitor_in_struct(TestInputVisitorData *data,

     v = visitor_input_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo' }");

-    visit_type_TestStruct(v, &p, NULL, &error_abort);
+    visit_type_TestStruct(v, NULL, &p, &error_abort);
     g_assert_cmpint(p->integer, ==, -42);
     g_assert(p->boolean == true);
     g_assert_cmpstr(p->string, ==, "foo");
@@ -197,7 +197,7 @@  static void test_visitor_in_struct_nested(TestInputVisitorData *data,
                                 "'dict2': { 'userdef': { 'integer': 42, "
                                 "'string': 'string' }, 'string': 'string2'}}}");

-    visit_type_UserDefTwo(v, &udp, NULL, &error_abort);
+    visit_type_UserDefTwo(v, NULL, &udp, &error_abort);

     g_assert_cmpstr(udp->string0, ==, "string0");
     g_assert_cmpstr(udp->dict1->string1, ==, "string1");
@@ -218,7 +218,7 @@  static void test_visitor_in_list(TestInputVisitorData *data,

     v = visitor_input_test_init(data, "[ { 'string': 'string0', 'integer': 42 }, { 'string': 'string1', 'integer': 43 }, { 'string': 'string2', 'integer': 44 } ]");

-    visit_type_UserDefOneList(v, &head, NULL, &error_abort);
+    visit_type_UserDefOneList(v, NULL, &head, &error_abort);
     g_assert(head != NULL);

     for (i = 0, item = head; item; item = item->next, i++) {
@@ -234,7 +234,7 @@  static void test_visitor_in_list(TestInputVisitorData *data,

     /* An empty list is valid */
     v = visitor_input_test_init(data, "[]");
-    visit_type_UserDefOneList(v, &head, NULL, &error_abort);
+    visit_type_UserDefOneList(v, NULL, &head, &error_abort);
     g_assert(!head);
 }

@@ -250,14 +250,14 @@  static void test_visitor_in_any(TestInputVisitorData *data,
     QObject *qobj;

     v = visitor_input_test_init(data, "-42");
-    visit_type_any(v, &res, NULL, &error_abort);
+    visit_type_any(v, NULL, &res, &error_abort);
     qint = qobject_to_qint(res);
     g_assert(qint);
     g_assert_cmpint(qint_get_int(qint), ==, -42);
     qobject_decref(res);

     v = visitor_input_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo' }");
-    visit_type_any(v, &res, NULL, &error_abort);
+    visit_type_any(v, NULL, &res, &error_abort);
     qdict = qobject_to_qdict(res);
     g_assert(qdict && qdict_size(qdict) == 3);
     qobj = qdict_get(qdict, "integer");
@@ -291,7 +291,7 @@  static void test_visitor_in_union_flat(TestInputVisitorData *data,
                                 "'string': 'str', "
                                 "'boolean': true }");

-    visit_type_UserDefFlatUnion(v, &tmp, NULL, &error_abort);
+    visit_type_UserDefFlatUnion(v, NULL, &tmp, &error_abort);
     g_assert_cmpint(tmp->enum1, ==, ENUM_ONE_VALUE1);
     g_assert_cmpstr(tmp->string, ==, "str");
     g_assert_cmpint(tmp->integer, ==, 41);
@@ -311,19 +311,19 @@  static void test_visitor_in_alternate(TestInputVisitorData *data,
     UserDefAlternate *tmp;

     v = visitor_input_test_init(data, "42");
-    visit_type_UserDefAlternate(v, &tmp, NULL, &error_abort);
+    visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort);
     g_assert_cmpint(tmp->type, ==, QTYPE_QINT);
     g_assert_cmpint(tmp->u.i, ==, 42);
     qapi_free_UserDefAlternate(tmp);

     v = visitor_input_test_init(data, "'string'");
-    visit_type_UserDefAlternate(v, &tmp, NULL, &error_abort);
+    visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort);
     g_assert_cmpint(tmp->type, ==, QTYPE_QSTRING);
     g_assert_cmpstr(tmp->u.s, ==, "string");
     qapi_free_UserDefAlternate(tmp);

     v = visitor_input_test_init(data, "false");
-    visit_type_UserDefAlternate(v, &tmp, NULL, &err);
+    visit_type_UserDefAlternate(v, NULL, &tmp, &err);
     error_free_or_abort(&err);
     qapi_free_UserDefAlternate(tmp);
 }
@@ -343,36 +343,36 @@  static void test_visitor_in_alternate_number(TestInputVisitorData *data,
     /* Parsing an int */

     v = visitor_input_test_init(data, "42");
-    visit_type_AltStrBool(v, &asb, NULL, &err);
+    visit_type_AltStrBool(v, NULL, &asb, &err);
     error_free_or_abort(&err);
     qapi_free_AltStrBool(asb);

     v = visitor_input_test_init(data, "42");
-    visit_type_AltStrNum(v, &asn, NULL, &error_abort);
+    visit_type_AltStrNum(v, NULL, &asn, &error_abort);
     g_assert_cmpint(asn->type, ==, QTYPE_QFLOAT);
     g_assert_cmpfloat(asn->u.n, ==, 42);
     qapi_free_AltStrNum(asn);

     v = visitor_input_test_init(data, "42");
-    visit_type_AltNumStr(v, &ans, NULL, &error_abort);
+    visit_type_AltNumStr(v, NULL, &ans, &error_abort);
     g_assert_cmpint(ans->type, ==, QTYPE_QFLOAT);
     g_assert_cmpfloat(ans->u.n, ==, 42);
     qapi_free_AltNumStr(ans);

     v = visitor_input_test_init(data, "42");
-    visit_type_AltStrInt(v, &asi, NULL, &error_abort);
+    visit_type_AltStrInt(v, NULL, &asi, &error_abort);
     g_assert_cmpint(asi->type, ==, QTYPE_QINT);
     g_assert_cmpint(asi->u.i, ==, 42);
     qapi_free_AltStrInt(asi);

     v = visitor_input_test_init(data, "42");
-    visit_type_AltIntNum(v, &ain, NULL, &error_abort);
+    visit_type_AltIntNum(v, NULL, &ain, &error_abort);
     g_assert_cmpint(ain->type, ==, QTYPE_QINT);
     g_assert_cmpint(ain->u.i, ==, 42);
     qapi_free_AltIntNum(ain);

     v = visitor_input_test_init(data, "42");
-    visit_type_AltNumInt(v, &ani, NULL, &error_abort);
+    visit_type_AltNumInt(v, NULL, &ani, &error_abort);
     g_assert_cmpint(ani->type, ==, QTYPE_QINT);
     g_assert_cmpint(ani->u.i, ==, 42);
     qapi_free_AltNumInt(ani);
@@ -380,35 +380,35 @@  static void test_visitor_in_alternate_number(TestInputVisitorData *data,
     /* Parsing a double */

     v = visitor_input_test_init(data, "42.5");
-    visit_type_AltStrBool(v, &asb, NULL, &err);
+    visit_type_AltStrBool(v, NULL, &asb, &err);
     error_free_or_abort(&err);
     qapi_free_AltStrBool(asb);

     v = visitor_input_test_init(data, "42.5");
-    visit_type_AltStrNum(v, &asn, NULL, &error_abort);
+    visit_type_AltStrNum(v, NULL, &asn, &error_abort);
     g_assert_cmpint(asn->type, ==, QTYPE_QFLOAT);
     g_assert_cmpfloat(asn->u.n, ==, 42.5);
     qapi_free_AltStrNum(asn);

     v = visitor_input_test_init(data, "42.5");
-    visit_type_AltNumStr(v, &ans, NULL, &error_abort);
+    visit_type_AltNumStr(v, NULL, &ans, &error_abort);
     g_assert_cmpint(ans->type, ==, QTYPE_QFLOAT);
     g_assert_cmpfloat(ans->u.n, ==, 42.5);
     qapi_free_AltNumStr(ans);

     v = visitor_input_test_init(data, "42.5");
-    visit_type_AltStrInt(v, &asi, NULL, &err);
+    visit_type_AltStrInt(v, NULL, &asi, &err);
     error_free_or_abort(&err);
     qapi_free_AltStrInt(asi);

     v = visitor_input_test_init(data, "42.5");
-    visit_type_AltIntNum(v, &ain, NULL, &error_abort);
+    visit_type_AltIntNum(v, NULL, &ain, &error_abort);
     g_assert_cmpint(ain->type, ==, QTYPE_QFLOAT);
     g_assert_cmpfloat(ain->u.n, ==, 42.5);
     qapi_free_AltIntNum(ain);

     v = visitor_input_test_init(data, "42.5");
-    visit_type_AltNumInt(v, &ani, NULL, &error_abort);
+    visit_type_AltNumInt(v, NULL, &ani, &error_abort);
     g_assert_cmpint(ani->type, ==, QTYPE_QFLOAT);
     g_assert_cmpfloat(ani->u.n, ==, 42.5);
     qapi_free_AltNumInt(ani);
@@ -435,7 +435,7 @@  static void test_native_list_integer_helper(TestInputVisitorData *data,
                            gstr_list->str);
     v = visitor_input_test_init_raw(data,  gstr_union->str);

-    visit_type_UserDefNativeListUnion(v, &cvalue, NULL, &error_abort);
+    visit_type_UserDefNativeListUnion(v, NULL, &cvalue, &error_abort);
     g_assert(cvalue != NULL);
     g_assert_cmpint(cvalue->type, ==, kind);

@@ -596,7 +596,7 @@  static void test_visitor_in_native_list_bool(TestInputVisitorData *data,
                            gstr_list->str);
     v = visitor_input_test_init_raw(data,  gstr_union->str);

-    visit_type_UserDefNativeListUnion(v, &cvalue, NULL, &error_abort);
+    visit_type_UserDefNativeListUnion(v, NULL, &cvalue, &error_abort);
     g_assert(cvalue != NULL);
     g_assert_cmpint(cvalue->type, ==, USER_DEF_NATIVE_LIST_UNION_KIND_BOOLEAN);

@@ -629,7 +629,7 @@  static void test_visitor_in_native_list_string(TestInputVisitorData *data,
                            gstr_list->str);
     v = visitor_input_test_init_raw(data,  gstr_union->str);

-    visit_type_UserDefNativeListUnion(v, &cvalue, NULL, &error_abort);
+    visit_type_UserDefNativeListUnion(v, NULL, &cvalue, &error_abort);
     g_assert(cvalue != NULL);
     g_assert_cmpint(cvalue->type, ==, USER_DEF_NATIVE_LIST_UNION_KIND_STRING);

@@ -666,7 +666,7 @@  static void test_visitor_in_native_list_number(TestInputVisitorData *data,
                            gstr_list->str);
     v = visitor_input_test_init_raw(data,  gstr_union->str);

-    visit_type_UserDefNativeListUnion(v, &cvalue, NULL, &error_abort);
+    visit_type_UserDefNativeListUnion(v, NULL, &cvalue, &error_abort);
     g_assert(cvalue != NULL);
     g_assert_cmpint(cvalue->type, ==, USER_DEF_NATIVE_LIST_UNION_KIND_NUMBER);

@@ -706,7 +706,7 @@  static void test_visitor_in_errors(TestInputVisitorData *data,
     v = visitor_input_test_init(data, "{ 'integer': false, 'boolean': 'foo', "
                                 "'string': -42 }");

-    visit_type_TestStruct(v, &p, NULL, &err);
+    visit_type_TestStruct(v, NULL, &p, &err);
     error_free_or_abort(&err);
     /* FIXME - a failed parse should not leave a partially-allocated p
      * for us to clean up; this could cause callers to leak memory. */
@@ -716,7 +716,7 @@  static void test_visitor_in_errors(TestInputVisitorData *data,
     g_free(p);

     v = visitor_input_test_init(data, "[ '1', '2', false, '3' ]");
-    visit_type_strList(v, &q, NULL, &err);
+    visit_type_strList(v, NULL, &q, &err);
     error_free_or_abort(&err);
     assert(q);
     qapi_free_strList(q);
@@ -734,35 +734,35 @@  static void test_visitor_in_wrong_type(TestInputVisitorData *data,
     /* Make sure arrays and structs cannot be confused */

     v = visitor_input_test_init(data, "[]");
-    visit_type_TestStruct(v, &p, NULL, &err);
+    visit_type_TestStruct(v, NULL, &p, &err);
     error_free_or_abort(&err);
     g_assert(!p);

     v = visitor_input_test_init(data, "{}");
-    visit_type_strList(v, &q, NULL, &err);
+    visit_type_strList(v, NULL, &q, &err);
     error_free_or_abort(&err);
     assert(!q);

     /* Make sure primitives and struct cannot be confused */

     v = visitor_input_test_init(data, "1");
-    visit_type_TestStruct(v, &p, NULL, &err);
+    visit_type_TestStruct(v, NULL, &p, &err);
     error_free_or_abort(&err);
     g_assert(!p);

     v = visitor_input_test_init(data, "{}");
-    visit_type_int(v, &i, NULL, &err);
+    visit_type_int(v, NULL, &i, &err);
     error_free_or_abort(&err);

     /* Make sure primitives and arrays cannot be confused */

     v = visitor_input_test_init(data, "1");
-    visit_type_strList(v, &q, NULL, &err);
+    visit_type_strList(v, NULL, &q, &err);
     error_free_or_abort(&err);
     assert(!q);

     v = visitor_input_test_init(data, "[]");
-    visit_type_int(v, &i, NULL, &err);
+    visit_type_int(v, NULL, &i, &err);
     error_free_or_abort(&err);
 }

diff --git a/tests/test-qmp-output-visitor.c b/tests/test-qmp-output-visitor.c
index 3078442..4df94bc 100644
--- a/tests/test-qmp-output-visitor.c
+++ b/tests/test-qmp-output-visitor.c
@@ -47,7 +47,7 @@  static void test_visitor_out_int(TestOutputVisitorData *data,
     int64_t value = -42;
     QObject *obj;

-    visit_type_int(data->ov, &value, NULL, &error_abort);
+    visit_type_int(data->ov, NULL, &value, &error_abort);

     obj = qmp_output_get_qobject(data->qov);
     g_assert(obj != NULL);
@@ -63,7 +63,7 @@  static void test_visitor_out_bool(TestOutputVisitorData *data,
     bool value = true;
     QObject *obj;

-    visit_type_bool(data->ov, &value, NULL, &error_abort);
+    visit_type_bool(data->ov, NULL, &value, &error_abort);

     obj = qmp_output_get_qobject(data->qov);
     g_assert(obj != NULL);
@@ -79,7 +79,7 @@  static void test_visitor_out_number(TestOutputVisitorData *data,
     double value = 3.14;
     QObject *obj;

-    visit_type_number(data->ov, &value, NULL, &error_abort);
+    visit_type_number(data->ov, NULL, &value, &error_abort);

     obj = qmp_output_get_qobject(data->qov);
     g_assert(obj != NULL);
@@ -95,7 +95,7 @@  static void test_visitor_out_string(TestOutputVisitorData *data,
     char *string = (char *) "Q E M U";
     QObject *obj;

-    visit_type_str(data->ov, &string, NULL, &error_abort);
+    visit_type_str(data->ov, NULL, &string, &error_abort);

     obj = qmp_output_get_qobject(data->qov);
     g_assert(obj != NULL);
@@ -112,7 +112,7 @@  static void test_visitor_out_no_string(TestOutputVisitorData *data,
     QObject *obj;

     /* A null string should return "" */
-    visit_type_str(data->ov, &string, NULL, &error_abort);
+    visit_type_str(data->ov, NULL, &string, &error_abort);

     obj = qmp_output_get_qobject(data->qov);
     g_assert(obj != NULL);
@@ -129,7 +129,7 @@  static void test_visitor_out_enum(TestOutputVisitorData *data,
     EnumOne i;

     for (i = 0; i < ENUM_ONE__MAX; i++) {
-        visit_type_EnumOne(data->ov, &i, "unused", &error_abort);
+        visit_type_EnumOne(data->ov, "unused", &i, &error_abort);

         obj = qmp_output_get_qobject(data->qov);
         g_assert(obj != NULL);
@@ -148,7 +148,7 @@  static void test_visitor_out_enum_errors(TestOutputVisitorData *data,

     for (i = 0; i < ARRAY_SIZE(bad_values) ; i++) {
         err = NULL;
-        visit_type_EnumOne(data->ov, &bad_values[i], "unused", &err);
+        visit_type_EnumOne(data->ov, "unused", &bad_values[i], &err);
         g_assert(err);
         error_free(err);
     }
@@ -165,7 +165,7 @@  static void test_visitor_out_struct(TestOutputVisitorData *data,
     QObject *obj;
     QDict *qdict;

-    visit_type_TestStruct(data->ov, &p, NULL, &error_abort);
+    visit_type_TestStruct(data->ov, NULL, &p, &error_abort);

     obj = qmp_output_get_qobject(data->qov);
     g_assert(obj != NULL);
@@ -210,7 +210,7 @@  static void test_visitor_out_struct_nested(TestOutputVisitorData *data,
     ud2->dict1->dict3->userdef->integer = value;
     ud2->dict1->dict3->string = g_strdup(strings[3]);

-    visit_type_UserDefTwo(data->ov, &ud2, "unused", &error_abort);
+    visit_type_UserDefTwo(data->ov, "unused", &ud2, &error_abort);

     obj = qmp_output_get_qobject(data->qov);
     g_assert(obj != NULL);
@@ -257,7 +257,7 @@  static void test_visitor_out_struct_errors(TestOutputVisitorData *data,
         err = NULL;
         u.has_enum1 = true;
         u.enum1 = bad_values[i];
-        visit_type_UserDefOne(data->ov, &pu, "unused", &err);
+        visit_type_UserDefOne(data->ov, "unused", &pu, &err);
         g_assert(err);
         error_free(err);
     }
@@ -289,7 +289,7 @@  static void test_visitor_out_list(TestOutputVisitorData *data,
         head = p;
     }

-    visit_type_TestStructList(data->ov, &head, NULL, &error_abort);
+    visit_type_TestStructList(data->ov, NULL, &head, &error_abort);

     obj = qmp_output_get_qobject(data->qov);
     g_assert(obj != NULL);
@@ -356,7 +356,7 @@  static void test_visitor_out_any(TestOutputVisitorData *data,
     QObject *obj;

     qobj = QOBJECT(qint_from_int(-42));
-    visit_type_any(data->ov, &qobj, NULL, &error_abort);
+    visit_type_any(data->ov, NULL, &qobj, &error_abort);
     obj = qmp_output_get_qobject(data->qov);
     g_assert(obj != NULL);
     g_assert(qobject_type(obj) == QTYPE_QINT);
@@ -369,7 +369,7 @@  static void test_visitor_out_any(TestOutputVisitorData *data,
     qdict_put(qdict, "boolean", qbool_from_bool(true));
     qdict_put(qdict, "string", qstring_from_str("foo"));
     qobj = QOBJECT(qdict);
-    visit_type_any(data->ov, &qobj, NULL, &error_abort);
+    visit_type_any(data->ov, NULL, &qobj, &error_abort);
     qobject_decref(qobj);
     obj = qmp_output_get_qobject(data->qov);
     g_assert(obj != NULL);
@@ -406,7 +406,7 @@  static void test_visitor_out_union_flat(TestOutputVisitorData *data,
     tmp->integer = 41;
     tmp->u.value1->boolean = true;

-    visit_type_UserDefFlatUnion(data->ov, &tmp, NULL, &error_abort);
+    visit_type_UserDefFlatUnion(data->ov, NULL, &tmp, &error_abort);
     arg = qmp_output_get_qobject(data->qov);

     g_assert(qobject_type(arg) == QTYPE_QDICT);
@@ -431,7 +431,7 @@  static void test_visitor_out_alternate(TestOutputVisitorData *data,
     tmp->type = QTYPE_QINT;
     tmp->u.i = 42;

-    visit_type_UserDefAlternate(data->ov, &tmp, NULL, &error_abort);
+    visit_type_UserDefAlternate(data->ov, NULL, &tmp, &error_abort);
     arg = qmp_output_get_qobject(data->qov);

     g_assert(qobject_type(arg) == QTYPE_QINT);
@@ -444,7 +444,7 @@  static void test_visitor_out_alternate(TestOutputVisitorData *data,
     tmp->type = QTYPE_QSTRING;
     tmp->u.s = g_strdup("hello");

-    visit_type_UserDefAlternate(data->ov, &tmp, NULL, &error_abort);
+    visit_type_UserDefAlternate(data->ov, NULL, &tmp, &error_abort);
     arg = qmp_output_get_qobject(data->qov);

     g_assert(qobject_type(arg) == QTYPE_QSTRING);
@@ -690,7 +690,7 @@  static void test_native_list(TestOutputVisitorData *data,
     cvalue->type = kind;
     init_native_list(cvalue);

-    visit_type_UserDefNativeListUnion(data->ov, &cvalue, NULL, &error_abort);
+    visit_type_UserDefNativeListUnion(data->ov, NULL, &cvalue, &error_abort);

     obj = qmp_output_get_qobject(data->qov);
     check_native_list(obj, cvalue->type);
diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c
index 8e3433e..d99498d 100644
--- a/tests/test-string-input-visitor.c
+++ b/tests/test-string-input-visitor.c
@@ -59,7 +59,7 @@  static void test_visitor_in_int(TestInputVisitorData *data,

     v = visitor_input_test_init(data, "-42");

-    visit_type_int(v, &res, NULL, &err);
+    visit_type_int(v, NULL, &res, &err);
     g_assert(!err);
     g_assert_cmpint(res, ==, value);
 }
@@ -74,7 +74,7 @@  static void test_visitor_in_intList(TestInputVisitorData *data,

     v = visitor_input_test_init(data, "1,2,0,2-4,20,5-9,1-8");

-    visit_type_int16List(v, &res, NULL, &error_abort);
+    visit_type_int16List(v, NULL, &res, &error_abort);
     tmp = res;
     while (i < sizeof(value) / sizeof(value[0])) {
         g_assert(tmp);
@@ -100,42 +100,42 @@  static void test_visitor_in_bool(TestInputVisitorData *data,

     v = visitor_input_test_init(data, "true");

-    visit_type_bool(v, &res, NULL, &err);
+    visit_type_bool(v, NULL, &res, &err);
     g_assert(!err);
     g_assert_cmpint(res, ==, true);
     visitor_input_teardown(data, unused);

     v = visitor_input_test_init(data, "yes");

-    visit_type_bool(v, &res, NULL, &err);
+    visit_type_bool(v, NULL, &res, &err);
     g_assert(!err);
     g_assert_cmpint(res, ==, true);
     visitor_input_teardown(data, unused);

     v = visitor_input_test_init(data, "on");

-    visit_type_bool(v, &res, NULL, &err);
+    visit_type_bool(v, NULL, &res, &err);
     g_assert(!err);
     g_assert_cmpint(res, ==, true);
     visitor_input_teardown(data, unused);

     v = visitor_input_test_init(data, "false");

-    visit_type_bool(v, &res, NULL, &err);
+    visit_type_bool(v, NULL, &res, &err);
     g_assert(!err);
     g_assert_cmpint(res, ==, false);
     visitor_input_teardown(data, unused);

     v = visitor_input_test_init(data, "no");

-    visit_type_bool(v, &res, NULL, &err);
+    visit_type_bool(v, NULL, &res, &err);
     g_assert(!err);
     g_assert_cmpint(res, ==, false);
     visitor_input_teardown(data, unused);

     v = visitor_input_test_init(data, "off");

-    visit_type_bool(v, &res, NULL, &err);
+    visit_type_bool(v, NULL, &res, &err);
     g_assert(!err);
     g_assert_cmpint(res, ==, false);
 }
@@ -149,7 +149,7 @@  static void test_visitor_in_number(TestInputVisitorData *data,

     v = visitor_input_test_init(data, "3.14");

-    visit_type_number(v, &res, NULL, &err);
+    visit_type_number(v, NULL, &res, &err);
     g_assert(!err);
     g_assert_cmpfloat(res, ==, value);
 }
@@ -163,7 +163,7 @@  static void test_visitor_in_string(TestInputVisitorData *data,

     v = visitor_input_test_init(data, value);

-    visit_type_str(v, &res, NULL, &err);
+    visit_type_str(v, NULL, &res, &err);
     g_assert(!err);
     g_assert_cmpstr(res, ==, value);

@@ -182,7 +182,7 @@  static void test_visitor_in_enum(TestInputVisitorData *data,

         v = visitor_input_test_init(data, EnumOne_lookup[i]);

-        visit_type_EnumOne(v, &res, NULL, &err);
+        visit_type_EnumOne(v, NULL, &res, &err);
         g_assert(!err);
         g_assert_cmpint(i, ==, res);

@@ -220,29 +220,29 @@  static void test_visitor_in_fuzz(TestInputVisitorData *data,
         }

         v = visitor_input_test_init(data, buf);
-        visit_type_int(v, &ires, NULL, NULL);
+        visit_type_int(v, NULL, &ires, NULL);
         visitor_input_teardown(data, NULL);

         v = visitor_input_test_init(data, buf);
-        visit_type_intList(v, &ilres, NULL, NULL);
+        visit_type_intList(v, NULL, &ilres, NULL);
         visitor_input_teardown(data, NULL);

         v = visitor_input_test_init(data, buf);
-        visit_type_bool(v, &bres, NULL, NULL);
+        visit_type_bool(v, NULL, &bres, NULL);
         visitor_input_teardown(data, NULL);

         v = visitor_input_test_init(data, buf);
-        visit_type_number(v, &nres, NULL, NULL);
+        visit_type_number(v, NULL, &nres, NULL);
         visitor_input_teardown(data, NULL);

         v = visitor_input_test_init(data, buf);
         sres = NULL;
-        visit_type_str(v, &sres, NULL, NULL);
+        visit_type_str(v, NULL, &sres, NULL);
         g_free(sres);
         visitor_input_teardown(data, NULL);

         v = visitor_input_test_init(data, buf);
-        visit_type_EnumOne(v, &eres, NULL, NULL);
+        visit_type_EnumOne(v, NULL, &eres, NULL);
         visitor_input_teardown(data, NULL);
     }
 }
diff --git a/tests/test-string-output-visitor.c b/tests/test-string-output-visitor.c
index 7aecdfc..4f4450f 100644
--- a/tests/test-string-output-visitor.c
+++ b/tests/test-string-output-visitor.c
@@ -61,7 +61,7 @@  static void test_visitor_out_int(TestOutputVisitorData *data,
     Error *err = NULL;
     char *str;

-    visit_type_int(data->ov, &value, NULL, &err);
+    visit_type_int(data->ov, NULL, &value, &err);
     g_assert(!err);

     str = string_output_get_string(data->sov);
@@ -90,7 +90,7 @@  static void test_visitor_out_intList(TestOutputVisitorData *data,
         tmp = &(*tmp)->next;
     }

-    visit_type_intList(data->ov, &list, NULL, &err);
+    visit_type_intList(data->ov, NULL, &list, &err);
     g_assert(err == NULL);

     str = string_output_get_string(data->sov);
@@ -120,7 +120,7 @@  static void test_visitor_out_bool(TestOutputVisitorData *data,
     bool value = true;
     char *str;

-    visit_type_bool(data->ov, &value, NULL, &err);
+    visit_type_bool(data->ov, NULL, &value, &err);
     g_assert(!err);

     str = string_output_get_string(data->sov);
@@ -136,7 +136,7 @@  static void test_visitor_out_number(TestOutputVisitorData *data,
     Error *err = NULL;
     char *str;

-    visit_type_number(data->ov, &value, NULL, &err);
+    visit_type_number(data->ov, NULL, &value, &err);
     g_assert(!err);

     str = string_output_get_string(data->sov);
@@ -153,7 +153,7 @@  static void test_visitor_out_string(TestOutputVisitorData *data,
     Error *err = NULL;
     char *str;

-    visit_type_str(data->ov, &string, NULL, &err);
+    visit_type_str(data->ov, NULL, &string, &err);
     g_assert(!err);

     str = string_output_get_string(data->sov);
@@ -174,7 +174,7 @@  static void test_visitor_out_no_string(TestOutputVisitorData *data,
     char *str;

     /* A null string should return "" */
-    visit_type_str(data->ov, &string, NULL, &err);
+    visit_type_str(data->ov, NULL, &string, &err);
     g_assert(!err);

     str = string_output_get_string(data->sov);
@@ -197,7 +197,7 @@  static void test_visitor_out_enum(TestOutputVisitorData *data,
     for (i = 0; i < ENUM_ONE__MAX; i++) {
         char *str_human;

-        visit_type_EnumOne(data->ov, &i, "unused", &err);
+        visit_type_EnumOne(data->ov, "unused", &i, &err);
         g_assert(!err);

         str_human = g_strdup_printf("\"%s\"", EnumOne_lookup[i]);
@@ -222,7 +222,7 @@  static void test_visitor_out_enum_errors(TestOutputVisitorData *data,

     for (i = 0; i < ARRAY_SIZE(bad_values) ; i++) {
         err = NULL;
-        visit_type_EnumOne(data->ov, &bad_values[i], "unused", &err);
+        visit_type_EnumOne(data->ov, "unused", &bad_values[i], &err);
         g_assert(err);
         error_free(err);
     }
diff --git a/tests/test-visitor-serialization.c b/tests/test-visitor-serialization.c
index 9f67f9e..f74a6df 100644
--- a/tests/test-visitor-serialization.c
+++ b/tests/test-visitor-serialization.c
@@ -101,40 +101,40 @@  static void visit_primitive_type(Visitor *v, void **native, Error **errp)
     PrimitiveType *pt = *native;
     switch(pt->type) {
     case PTYPE_STRING:
-        visit_type_str(v, (char **)&pt->value.string, NULL, errp);
+        visit_type_str(v, NULL, (char **)&pt->value.string, errp);
         break;
     case PTYPE_BOOLEAN:
-        visit_type_bool(v, &pt->value.boolean, NULL, errp);
+        visit_type_bool(v, NULL, &pt->value.boolean, errp);
         break;
     case PTYPE_NUMBER:
-        visit_type_number(v, &pt->value.number, NULL, errp);
+        visit_type_number(v, NULL, &pt->value.number, errp);
         break;
     case PTYPE_INTEGER:
-        visit_type_int(v, &pt->value.integer, NULL, errp);
+        visit_type_int(v, NULL, &pt->value.integer, errp);
         break;
     case PTYPE_U8:
-        visit_type_uint8(v, &pt->value.u8, NULL, errp);
+        visit_type_uint8(v, NULL, &pt->value.u8, errp);
         break;
     case PTYPE_U16:
-        visit_type_uint16(v, &pt->value.u16, NULL, errp);
+        visit_type_uint16(v, NULL, &pt->value.u16, errp);
         break;
     case PTYPE_U32:
-        visit_type_uint32(v, &pt->value.u32, NULL, errp);
+        visit_type_uint32(v, NULL, &pt->value.u32, errp);
         break;
     case PTYPE_U64:
-        visit_type_uint64(v, &pt->value.u64, NULL, errp);
+        visit_type_uint64(v, NULL, &pt->value.u64, errp);
         break;
     case PTYPE_S8:
-        visit_type_int8(v, &pt->value.s8, NULL, errp);
+        visit_type_int8(v, NULL, &pt->value.s8, errp);
         break;
     case PTYPE_S16:
-        visit_type_int16(v, &pt->value.s16, NULL, errp);
+        visit_type_int16(v, NULL, &pt->value.s16, errp);
         break;
     case PTYPE_S32:
-        visit_type_int32(v, &pt->value.s32, NULL, errp);
+        visit_type_int32(v, NULL, &pt->value.s32, errp);
         break;
     case PTYPE_S64:
-        visit_type_int64(v, &pt->value.s64, NULL, errp);
+        visit_type_int64(v, NULL, &pt->value.s64, errp);
         break;
     case PTYPE_EOL:
         g_assert_not_reached();
@@ -146,40 +146,40 @@  static void visit_primitive_list(Visitor *v, void **native, Error **errp)
     PrimitiveList *pl = *native;
     switch (pl->type) {
     case PTYPE_STRING:
-        visit_type_strList(v, &pl->value.strings, NULL, errp);
+        visit_type_strList(v, NULL, &pl->value.strings, errp);
         break;
     case PTYPE_BOOLEAN:
-        visit_type_boolList(v, &pl->value.booleans, NULL, errp);
+        visit_type_boolList(v, NULL, &pl->value.booleans, errp);
         break;
     case PTYPE_NUMBER:
-        visit_type_numberList(v, &pl->value.numbers, NULL, errp);
+        visit_type_numberList(v, NULL, &pl->value.numbers, errp);
         break;
     case PTYPE_INTEGER:
-        visit_type_intList(v, &pl->value.integers, NULL, errp);
+        visit_type_intList(v, NULL, &pl->value.integers, errp);
         break;
     case PTYPE_S8:
-        visit_type_int8List(v, &pl->value.s8_integers, NULL, errp);
+        visit_type_int8List(v, NULL, &pl->value.s8_integers, errp);
         break;
     case PTYPE_S16:
-        visit_type_int16List(v, &pl->value.s16_integers, NULL, errp);
+        visit_type_int16List(v, NULL, &pl->value.s16_integers, errp);
         break;
     case PTYPE_S32:
-        visit_type_int32List(v, &pl->value.s32_integers, NULL, errp);
+        visit_type_int32List(v, NULL, &pl->value.s32_integers, errp);
         break;
     case PTYPE_S64:
-        visit_type_int64List(v, &pl->value.s64_integers, NULL, errp);
+        visit_type_int64List(v, NULL, &pl->value.s64_integers, errp);
         break;
     case PTYPE_U8:
-        visit_type_uint8List(v, &pl->value.u8_integers, NULL, errp);
+        visit_type_uint8List(v, NULL, &pl->value.u8_integers, errp);
         break;
     case PTYPE_U16:
-        visit_type_uint16List(v, &pl->value.u16_integers, NULL, errp);
+        visit_type_uint16List(v, NULL, &pl->value.u16_integers, errp);
         break;
     case PTYPE_U32:
-        visit_type_uint32List(v, &pl->value.u32_integers, NULL, errp);
+        visit_type_uint32List(v, NULL, &pl->value.u32_integers, errp);
         break;
     case PTYPE_U64:
-        visit_type_uint64List(v, &pl->value.u64_integers, NULL, errp);
+        visit_type_uint64List(v, NULL, &pl->value.u64_integers, errp);
         break;
     default:
         g_assert_not_reached();
@@ -213,7 +213,7 @@  static void struct_cleanup(TestStruct *ts)

 static void visit_struct(Visitor *v, void **native, Error **errp)
 {
-    visit_type_TestStruct(v, (TestStruct **)native, NULL, errp);
+    visit_type_TestStruct(v, NULL, (TestStruct **)native, errp);
 }

 static UserDefTwo *nested_struct_create(void)
@@ -264,12 +264,12 @@  static void nested_struct_cleanup(UserDefTwo *udnp)

 static void visit_nested_struct(Visitor *v, void **native, Error **errp)
 {
-    visit_type_UserDefTwo(v, (UserDefTwo **)native, NULL, errp);
+    visit_type_UserDefTwo(v, NULL, (UserDefTwo **)native, errp);
 }

 static void visit_nested_struct_list(Visitor *v, void **native, Error **errp)
 {
-    visit_type_UserDefTwoList(v, (UserDefTwoList **)native, NULL, errp);
+    visit_type_UserDefTwoList(v, NULL, (UserDefTwoList **)native, errp);
 }

 /* test cases */
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 922efb3..96b7ae7 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -1152,7 +1152,7 @@  void qapi_copy_SocketAddress(SocketAddress **p_dest,

     qov = qmp_output_visitor_new();
     ov = qmp_output_get_visitor(qov);
-    visit_type_SocketAddress(ov, &src, NULL, &error_abort);
+    visit_type_SocketAddress(ov, NULL, &src, &error_abort);
     obj = qmp_output_get_qobject(qov);
     qmp_output_visitor_cleanup(qov);
     if (!obj) {
@@ -1161,7 +1161,7 @@  void qapi_copy_SocketAddress(SocketAddress **p_dest,

     qiv = qmp_input_visitor_new(obj);
     iv = qmp_input_get_visitor(qiv);
-    visit_type_SocketAddress(iv, p_dest, NULL, &error_abort);
+    visit_type_SocketAddress(iv, NULL, p_dest, &error_abort);
     qmp_input_visitor_cleanup(qiv);
     qobject_decref(obj);
 }
diff --git a/vl.c b/vl.c
index aaa5403..49ec0de 100644
--- a/vl.c
+++ b/vl.c
@@ -2840,7 +2840,7 @@  static int object_create(void *opaque, QemuOpts *opts, Error **errp)
     }

     qdict_del(pdict, "qom-type");
-    visit_type_str(v, &type, "qom-type", &err);
+    visit_type_str(v, "qom-type", &type, &err);
     if (err) {
         goto out;
     }
@@ -2850,7 +2850,7 @@  static int object_create(void *opaque, QemuOpts *opts, Error **errp)
     }

     qdict_del(pdict, "id");
-    visit_type_str(v, &id, "id", &err);
+    visit_type_str(v, "id", &id, &err);
     if (err) {
         goto out_end;
     }