Commit dc5542fb authored by Sinan Kaya's avatar Sinan Kaya Committed by Alex Williamson

vfio: platform: determine reset capability

Creating a new function to determine if this driver supports reset
function or not. This is an attempt to abstract device tree calls
from the rest of the code.
Signed-off-by: default avatarSinan Kaya <okaya@codeaurora.org>
Reviewed-by: default avatarEric Auger <eric.auger@linaro.org>
Reviewed-by: default avatarBaptiste Reynal <b.reynal@virtualopensystems.com>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent f084aa74
...@@ -49,6 +49,11 @@ static vfio_platform_reset_fn_t vfio_platform_lookup_reset(const char *compat, ...@@ -49,6 +49,11 @@ static vfio_platform_reset_fn_t vfio_platform_lookup_reset(const char *compat,
return reset_fn; return reset_fn;
} }
static bool vfio_platform_has_reset(struct vfio_platform_device *vdev)
{
return vdev->of_reset ? true : false;
}
static void vfio_platform_get_reset(struct vfio_platform_device *vdev) static void vfio_platform_get_reset(struct vfio_platform_device *vdev)
{ {
vdev->of_reset = vfio_platform_lookup_reset(vdev->compat, vdev->of_reset = vfio_platform_lookup_reset(vdev->compat,
...@@ -214,7 +219,7 @@ static long vfio_platform_ioctl(void *device_data, ...@@ -214,7 +219,7 @@ static long vfio_platform_ioctl(void *device_data,
if (info.argsz < minsz) if (info.argsz < minsz)
return -EINVAL; return -EINVAL;
if (vdev->of_reset) if (vfio_platform_has_reset(vdev))
vdev->flags |= VFIO_DEVICE_FLAGS_RESET; vdev->flags |= VFIO_DEVICE_FLAGS_RESET;
info.flags = vdev->flags; info.flags = vdev->flags;
info.num_regions = vdev->num_regions; info.num_regions = vdev->num_regions;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment