summaryrefslogtreecommitdiffstats
path: root/drivers/vfio
diff options
context:
space:
mode:
authorSinan Kaya <okaya@codeaurora.org>2016-07-19 09:01:43 -0400
committerAlex Williamson <alex.williamson@redhat.com>2016-07-19 10:26:40 -0600
commitdc5542fb115a9576493831160e31d355b58541d7 (patch)
tree280cb0d20bfff27c45ef577322213e4baedde115 /drivers/vfio
parentf084aa749537b818d5b234448e960a59836b39e3 (diff)
downloadlinux-dc5542fb115a9576493831160e31d355b58541d7.tar.gz
linux-dc5542fb115a9576493831160e31d355b58541d7.tar.bz2
linux-dc5542fb115a9576493831160e31d355b58541d7.zip
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: Sinan Kaya <okaya@codeaurora.org> Reviewed-by: Eric Auger <eric.auger@linaro.org> Reviewed-by: Baptiste Reynal <b.reynal@virtualopensystems.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio')
-rw-r--r--drivers/vfio/platform/vfio_platform_common.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c
index de419df768e1..307d61d2aea2 100644
--- a/drivers/vfio/platform/vfio_platform_common.c
+++ b/drivers/vfio/platform/vfio_platform_common.c
@@ -49,6 +49,11 @@ static vfio_platform_reset_fn_t vfio_platform_lookup_reset(const char *compat,
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)
{
vdev->of_reset = vfio_platform_lookup_reset(vdev->compat,
@@ -214,7 +219,7 @@ static long vfio_platform_ioctl(void *device_data,
if (info.argsz < minsz)
return -EINVAL;
- if (vdev->of_reset)
+ if (vfio_platform_has_reset(vdev))
vdev->flags |= VFIO_DEVICE_FLAGS_RESET;
info.flags = vdev->flags;
info.num_regions = vdev->num_regions;