@@ -300,11 +300,9 @@ static int vfio_pci_runtime_pm_entry(struct vfio_pci_core_device *vdev,
300300 return 0 ;
301301}
302302
303- static int vfio_pci_core_pm_entry (struct vfio_device * device , u32 flags ,
303+ static int vfio_pci_core_pm_entry (struct vfio_pci_core_device * vdev , u32 flags ,
304304 void __user * arg , size_t argsz )
305305{
306- struct vfio_pci_core_device * vdev =
307- container_of (device , struct vfio_pci_core_device , vdev );
308306 int ret ;
309307
310308 ret = vfio_check_feature (flags , argsz , VFIO_DEVICE_FEATURE_SET , 0 );
@@ -321,12 +319,10 @@ static int vfio_pci_core_pm_entry(struct vfio_device *device, u32 flags,
321319}
322320
323321static int vfio_pci_core_pm_entry_with_wakeup (
324- struct vfio_device * device , u32 flags ,
322+ struct vfio_pci_core_device * vdev , u32 flags ,
325323 struct vfio_device_low_power_entry_with_wakeup __user * arg ,
326324 size_t argsz )
327325{
328- struct vfio_pci_core_device * vdev =
329- container_of (device , struct vfio_pci_core_device , vdev );
330326 struct vfio_device_low_power_entry_with_wakeup entry ;
331327 struct eventfd_ctx * efdctx ;
332328 int ret ;
@@ -377,11 +373,9 @@ static void vfio_pci_runtime_pm_exit(struct vfio_pci_core_device *vdev)
377373 up_write (& vdev -> memory_lock );
378374}
379375
380- static int vfio_pci_core_pm_exit (struct vfio_device * device , u32 flags ,
376+ static int vfio_pci_core_pm_exit (struct vfio_pci_core_device * vdev , u32 flags ,
381377 void __user * arg , size_t argsz )
382378{
383- struct vfio_pci_core_device * vdev =
384- container_of (device , struct vfio_pci_core_device , vdev );
385379 int ret ;
386380
387381 ret = vfio_check_feature (flags , argsz , VFIO_DEVICE_FEATURE_SET , 0 );
@@ -1474,11 +1468,10 @@ long vfio_pci_core_ioctl(struct vfio_device *core_vdev, unsigned int cmd,
14741468}
14751469EXPORT_SYMBOL_GPL (vfio_pci_core_ioctl );
14761470
1477- static int vfio_pci_core_feature_token (struct vfio_device * device , u32 flags ,
1478- uuid_t __user * arg , size_t argsz )
1471+ static int vfio_pci_core_feature_token (struct vfio_pci_core_device * vdev ,
1472+ u32 flags , uuid_t __user * arg ,
1473+ size_t argsz )
14791474{
1480- struct vfio_pci_core_device * vdev =
1481- container_of (device , struct vfio_pci_core_device , vdev );
14821475 uuid_t uuid ;
14831476 int ret ;
14841477
@@ -1505,16 +1498,19 @@ static int vfio_pci_core_feature_token(struct vfio_device *device, u32 flags,
15051498int vfio_pci_core_ioctl_feature (struct vfio_device * device , u32 flags ,
15061499 void __user * arg , size_t argsz )
15071500{
1501+ struct vfio_pci_core_device * vdev =
1502+ container_of (device , struct vfio_pci_core_device , vdev );
1503+
15081504 switch (flags & VFIO_DEVICE_FEATURE_MASK ) {
15091505 case VFIO_DEVICE_FEATURE_LOW_POWER_ENTRY :
1510- return vfio_pci_core_pm_entry (device , flags , arg , argsz );
1506+ return vfio_pci_core_pm_entry (vdev , flags , arg , argsz );
15111507 case VFIO_DEVICE_FEATURE_LOW_POWER_ENTRY_WITH_WAKEUP :
1512- return vfio_pci_core_pm_entry_with_wakeup (device , flags ,
1508+ return vfio_pci_core_pm_entry_with_wakeup (vdev , flags ,
15131509 arg , argsz );
15141510 case VFIO_DEVICE_FEATURE_LOW_POWER_EXIT :
1515- return vfio_pci_core_pm_exit (device , flags , arg , argsz );
1511+ return vfio_pci_core_pm_exit (vdev , flags , arg , argsz );
15161512 case VFIO_DEVICE_FEATURE_PCI_VF_TOKEN :
1517- return vfio_pci_core_feature_token (device , flags , arg , argsz );
1513+ return vfio_pci_core_feature_token (vdev , flags , arg , argsz );
15181514 default :
15191515 return - ENOTTY ;
15201516 }
0 commit comments