Skip to content

Commit

Permalink
vfio/platform: Move VFIODevice initializations in vfio_platform_insta…
Browse files Browse the repository at this point in the history
…nce_init

Some of the VFIODevice initializations is in vfio_platform_realize,
move all of them in vfio_platform_instance_init.

No functional change intended.

Suggested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
  • Loading branch information
duanzhenzhong authored and legoater committed Dec 19, 2023
1 parent dd2fcb1 commit a0cf44c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions hw/vfio/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,10 +581,6 @@ static void vfio_platform_realize(DeviceState *dev, Error **errp)
VFIODevice *vbasedev = &vdev->vbasedev;
int i, ret;

vbasedev->type = VFIO_DEVICE_TYPE_PLATFORM;
vbasedev->dev = dev;
vbasedev->ops = &vfio_platform_ops;

qemu_mutex_init(&vdev->intp_mutex);

trace_vfio_platform_realize(vbasedev->sysfsdev ?
Expand Down Expand Up @@ -659,8 +655,12 @@ static Property vfio_platform_dev_properties[] = {
static void vfio_platform_instance_init(Object *obj)
{
VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(obj);
VFIODevice *vbasedev = &vdev->vbasedev;

vdev->vbasedev.fd = -1;
vbasedev->type = VFIO_DEVICE_TYPE_PLATFORM;
vbasedev->ops = &vfio_platform_ops;
vbasedev->dev = DEVICE(vdev);
vbasedev->fd = -1;
}

#ifdef CONFIG_IOMMUFD
Expand Down

0 comments on commit a0cf44c

Please sign in to comment.