Skip to content

Commit

Permalink
vfio/ap: Remove pointless apdev variable
Browse files Browse the repository at this point in the history
No need to double-cast, call VFIO_AP_DEVICE() on DeviceState.

No functional changes.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
  • Loading branch information
duanzhenzhong authored and legoater committed Oct 18, 2023
1 parent fde4dbb commit 88ceb67
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions hw/vfio/ap.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ static void vfio_ap_realize(DeviceState *dev, Error **errp)
{
int ret;
Error *err = NULL;
APDevice *apdev = AP_DEVICE(dev);
VFIOAPDevice *vapdev = VFIO_AP_DEVICE(apdev);
VFIOAPDevice *vapdev = VFIO_AP_DEVICE(dev);
VFIODevice *vbasedev = &vapdev->vdev;

vbasedev->name = g_path_get_basename(vbasedev->sysfsdev);
Expand Down Expand Up @@ -197,8 +196,7 @@ static void vfio_ap_realize(DeviceState *dev, Error **errp)

static void vfio_ap_unrealize(DeviceState *dev)
{
APDevice *apdev = AP_DEVICE(dev);
VFIOAPDevice *vapdev = VFIO_AP_DEVICE(apdev);
VFIOAPDevice *vapdev = VFIO_AP_DEVICE(dev);

vfio_ap_unregister_irq_notifier(vapdev, VFIO_AP_REQ_IRQ_INDEX);
vfio_detach_device(&vapdev->vdev);
Expand All @@ -213,8 +211,7 @@ static Property vfio_ap_properties[] = {
static void vfio_ap_reset(DeviceState *dev)
{
int ret;
APDevice *apdev = AP_DEVICE(dev);
VFIOAPDevice *vapdev = VFIO_AP_DEVICE(apdev);
VFIOAPDevice *vapdev = VFIO_AP_DEVICE(dev);

ret = ioctl(vapdev->vdev.fd, VFIO_DEVICE_RESET);
if (ret) {
Expand Down

0 comments on commit 88ceb67

Please sign in to comment.