hw/ppc/spapr.c: cleaning up qdev_get_machine() calls
commitc86c1affaec4bfa82eac226965e4be21fc44d538
authorDaniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Wed, 6 Sep 2017 18:43:05 +0000 (6 15:43 -0300)
committerDavid Gibson <david@gibson.dropbear.id.au>
Fri, 15 Sep 2017 00:29:48 +0000 (15 10:29 +1000)
treee629687b3ad67589afcf0f815533518a2473d854
parentf85504b23a59f769f36f7c4d4e0ce8fd08c78749
hw/ppc/spapr.c: cleaning up qdev_get_machine() calls

This patch removes the qdev_get_machine() calls that are made in
spapr.c in situations where we can get an existing pointer for
the MachineState by either passing it as an argument to the function
or by using other already available pointers.

The following changes were made:

- spapr_node0_size: static function that is called two times:
at spapr_setup_hpt_and_vrma and ppc_spapr_init. In both cases we can
pass an existing MachineState pointer to it.

- spapr_build_fdt: MachineState pointer can be retrieved from
the existing sPAPRMachineState pointer.

- spapr_boot_set: the opaque in the first arg is a sPAPRMachineState
pointer as we can see inside ppc_spapr_init:

    qemu_register_boot_set(spapr_boot_set, spapr);

We can get a MachineState pointer from it.

- spapr_machine_device_plug and spapr_machine_device_unplug_request: the
MachineState, sPAPRMachineState, MachineClass and sPAPRMachineClass pointers
can all be retrieved from the HotplugHandler pointer.

Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr.c