]> Git Repo - qemu.git/commit - hw/core/qdev.c
qdev: Fix QOM unrealize behavior
authorAndreas Färber <[email protected]>
Mon, 15 Apr 2013 16:34:10 +0000 (18:34 +0200)
committerAnthony Liguori <[email protected]>
Mon, 15 Apr 2013 22:05:34 +0000 (17:05 -0500)
commitfe6c211781f80ef4fc246269cecbbc21981089f0
tree02247fb8f95b6d0b87415d981a23424ce9dda73a
parente0e367bad7170e264916cdcba4306f79f47bb95c
qdev: Fix QOM unrealize behavior

Since commit 249d41720b7dfbb5951b430b9eefdbee7464f515 (qdev: Prepare
"realized" property) setting realized = true would register the device's
VMStateDescription, but realized = false would not unregister it. Fix that.

Moving the code from unparenting also revealed that we were calling
DeviceClass::init through DeviceClass::realize as interim solution but
DeviceClass::exit still at unparenting time with a realized check.
Make this symmetrical by implementing DeviceClass::unrealize to call it,
while we're setting realized = false in the unparenting path.
The only other unrealize user is mac_nvram, which can safely override it.

Thus, mark DeviceClass::exit as obsolete, new devices should implement
DeviceClass::unrealize instead.

Cc: [email protected]
Signed-off-by: Andreas Färber <[email protected]>
Signed-off-by: Andreas Färber <[email protected]>
Message-id: 1366043650[email protected]
Signed-off-by: Anthony Liguori <[email protected]>
hw/core/qdev.c
include/hw/qdev-core.h
This page took 0.028027 seconds and 4 git commands to generate.