diff mbox

[v2,1/2] early set current_machine

Message ID 1275414976-18258-2-git-send-email-glommer@redhat.com
State New
Headers show

Commit Message

Glauber Costa June 1, 2010, 5:56 p.m. UTC
this way, the machine_init function itself can know which machine is current
in use, not only the late init code.
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
 vl.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Comments

Anthony Liguori June 3, 2010, 1:14 p.m. UTC | #1
On 06/01/2010 12:56 PM, Glauber Costa wrote:
> this way, the machine_init function itself can know which machine is current
> in use, not only the late init code.
>    

While your touching it...

We only use current_machine in hw/device-hotplug.c.  I think it would be 
better to introduce an accessor function (get_current_machine()) and 
then make this global static.

Regards,

Anthony Liguori

> Signed-off-by: Glauber Costa<glommer@redhat.com>
> ---
>   vl.c |    5 +++--
>   1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 96838f8..7a8b20b 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -5824,6 +5824,9 @@ int main(int argc, char **argv, char **envp)
>       if (machine->compat_props) {
>           qdev_prop_register_compat(machine->compat_props);
>       }
> +
> +    current_machine = machine;
> +
>       machine->init(ram_size, boot_devices,
>                     kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
>
> @@ -5841,8 +5844,6 @@ int main(int argc, char **argv, char **envp)
>           }
>       }
>
> -    current_machine = machine;
> -
>       /* init USB devices */
>       if (usb_enabled) {
>           if (foreach_device_config(DEV_USB, usb_parse)<  0)
>
diff mbox

Patch

diff --git a/vl.c b/vl.c
index 96838f8..7a8b20b 100644
--- a/vl.c
+++ b/vl.c
@@ -5824,6 +5824,9 @@  int main(int argc, char **argv, char **envp)
     if (machine->compat_props) {
         qdev_prop_register_compat(machine->compat_props);
     }
+
+    current_machine = machine;
+
     machine->init(ram_size, boot_devices,
                   kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
 
@@ -5841,8 +5844,6 @@  int main(int argc, char **argv, char **envp)
         }
     }
 
-    current_machine = machine;
-
     /* init USB devices */
     if (usb_enabled) {
         if (foreach_device_config(DEV_USB, usb_parse) < 0)