[PATCH 09/15] device_tree: Replace current_machine by qdev_get_machine()

Philippe Mathieu-Daudé posted 15 patches 6 years, 1 month ago
Maintainers: Alistair Francis <alistair.francis@wdc.com>, Juan Quintela <quintela@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Richard Henderson <rth@twiddle.net>, David Gibson <david@gibson.dropbear.id.au>, Peter Maydell <peter.maydell@linaro.org>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>
There is a newer version of this series
[PATCH 09/15] device_tree: Replace current_machine by qdev_get_machine()
Posted by Philippe Mathieu-Daudé 6 years, 1 month ago
As we want to remove the global current_machine,
replace 'current_machine' by MACHINE(qdev_get_machine()).

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 device_tree.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/device_tree.c b/device_tree.c
index f8b46b3c73..665ea2f586 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -466,7 +466,9 @@ uint32_t qemu_fdt_alloc_phandle(void *fdt)
      * which phandle id to start allocating phandles.
      */
     if (!phandle) {
-        phandle = machine_phandle_start(current_machine);
+        MachineState *ms = MACHINE(qdev_get_machine());
+
+        phandle = machine_phandle_start(ms);
     }
 
     if (!phandle) {
-- 
2.21.1


Re: [PATCH 09/15] device_tree: Replace current_machine by qdev_get_machine()
Posted by Alistair Francis 6 years ago
On Thu, Jan 9, 2020 at 11:34 PM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> As we want to remove the global current_machine,
> replace 'current_machine' by MACHINE(qdev_get_machine()).
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  device_tree.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/device_tree.c b/device_tree.c
> index f8b46b3c73..665ea2f586 100644
> --- a/device_tree.c
> +++ b/device_tree.c
> @@ -466,7 +466,9 @@ uint32_t qemu_fdt_alloc_phandle(void *fdt)
>       * which phandle id to start allocating phandles.
>       */
>      if (!phandle) {
> -        phandle = machine_phandle_start(current_machine);
> +        MachineState *ms = MACHINE(qdev_get_machine());
> +
> +        phandle = machine_phandle_start(ms);
>      }
>
>      if (!phandle) {
> --
> 2.21.1
>
>