Skip to content

Commit

Permalink
vfio: platform: determine reset capability
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sinan Kaya authored and Alex Williamson committed Jul 19, 2016
1 parent f084aa7 commit dc5542f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/vfio/platform/vfio_platform_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit dc5542f

Please sign in to comment.