Re: [PATCH for-11.2 v3 09/15] hw/vfio: Use qdev_is_realized()

Philippe Mathieu-Daudé <[email protected]>
Newsgroups org.nongnu.qemu-arm,org.nongnu.qemu-devel
Message-ID <[email protected]>
On 21/7/26 10:16, Akihiko Odaki wrote:
> DeviceState fields should be accessed through qdev helpers rather than
> directly. Use qdev_is_realized() instead of reading
> DeviceState::realized directly.
> 
> Signed-off-by: Akihiko Odaki <[email protected]>
> ---
>   hw/vfio/container-legacy.c | 4 ++--
>   hw/vfio/device.c           | 4 ++--
>   hw/vfio/iommufd.c          | 2 +-
>   3 files changed, 5 insertions(+), 5 deletions(-)


> diff --git a/hw/vfio/device.c b/hw/vfio/device.c
> index 1a7f8088aad9..4f119596336f 100644
> --- a/hw/vfio/device.c
> +++ b/hw/vfio/device.c
> @@ -59,13 +59,13 @@ void vfio_device_reset_handler(void *opaque)
>   
>       trace_vfio_device_reset_handler();
>       QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) {
> -        if (vbasedev->dev->realized) {
> +        if (qdev_is_realized(vbasedev->dev)) {
>               vbasedev->ops->vfio_compute_needs_reset(vbasedev);
>           }
>       }
>   
>       QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) {
> -        if (vbasedev->dev->realized && vbasedev->needs_reset) {
> +        if (qdev_is_realized(vbasedev->dev) && vbasedev->needs_reset) {
>               vbasedev->ops->vfio_hot_reset_multi(vbasedev);
>           }
>       }

Interesting.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.