Skip to content
  • Andreas Färber's avatar
    qdev: Fix QOM unrealize behavior · fe6c2117
    Andreas Färber authored
    Since commit 249d4172
    
     (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: qemu-stable@nongnu.org
    Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
    Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
    Message-id: 1366043650-9719-1-git-send-email-afaerber@suse.de
    Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
    fe6c2117