ppc/pnv: consolidate pnv_parent_*_fixup() helpers
commit3466bb50ec7c49a63b4a146c82d4030742451f40
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Fri, 19 Aug 2022 09:47:47 +0000 (19 06:47 -0300)
committerDaniel Henrique Barboza <danielhb413@gmail.com>
Wed, 31 Aug 2022 17:08:06 +0000 (31 14:08 -0300)
treeb6fdc1ef1bb07748f7848b7346fe5c7f5ff62203
parentf1327fde3556aeea17f721f4fa2bb8bcf13b2038
ppc/pnv: consolidate pnv_parent_*_fixup() helpers

We have 2 helpers that amends the QOM and parent bus of a given object,
repectively. These 2 helpers are called together, and not by accident.
Due to QOM internals, doing an object_unparent() will result in the
device being removed from its parent bus. This means that changing the
QOM parent requires reassigning the parent bus again.

Create a single helper called pnv_parent_fixup(), documenting some of
the QOM specifics that we're dealing with the unparenting/parenting
mechanics, and handle both the QOM and the parent bus assignment.

Next patch will make use of this function to handle a case where we need
to change the QOM parent while keeping the same parent bus assigned
beforehand.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220819094748.400578-2-danielhb413@gmail.com>
hw/pci-host/pnv_phb.c