mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
hw/qdev: introduce qdev_is_realized() helper
Add a helper function to check whether the device is realized without requiring the Big QEMU Lock. The next patch adds a second caller. The goal is to avoid spreading DeviceState field accesses throughout the code. Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20230516190238.8401-3-stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
2d19629581
commit
26462a700c
2 changed files with 15 additions and 5 deletions
|
@ -60,8 +60,7 @@ static SCSIDevice *do_scsi_device_find(SCSIBus *bus,
|
|||
* the user access the device.
|
||||
*/
|
||||
|
||||
if (retval && !include_unrealized &&
|
||||
!qatomic_load_acquire(&retval->qdev.realized)) {
|
||||
if (retval && !include_unrealized && !qdev_is_realized(&retval->qdev)) {
|
||||
retval = NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue