diff options
author | Sinan Kaya <okaya@codeaurora.org> | 2016-07-19 09:01:43 -0400 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2016-07-19 12:26:40 -0400 |
commit | dc5542fb115a9576493831160e31d355b58541d7 (patch) | |
tree | 280cb0d20bfff27c45ef577322213e4baedde115 | |
parent | f084aa749537b818d5b234448e960a59836b39e3 (diff) |
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>
-rw-r--r-- | drivers/vfio/platform/vfio_platform_common.c | 7 |
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, | |||
49 | return reset_fn; | 49 | return reset_fn; |
50 | } | 50 | } |
51 | 51 | ||
52 | static bool vfio_platform_has_reset(struct vfio_platform_device *vdev) | ||
53 | { | ||
54 | return vdev->of_reset ? true : false; | ||
55 | } | ||
56 | |||
52 | static void vfio_platform_get_reset(struct vfio_platform_device *vdev) | 57 | static void vfio_platform_get_reset(struct vfio_platform_device *vdev) |
53 | { | 58 | { |
54 | vdev->of_reset = vfio_platform_lookup_reset(vdev->compat, | 59 | vdev->of_reset = vfio_platform_lookup_reset(vdev->compat, |
@@ -214,7 +219,7 @@ static long vfio_platform_ioctl(void *device_data, | |||
214 | if (info.argsz < minsz) | 219 | if (info.argsz < minsz) |
215 | return -EINVAL; | 220 | return -EINVAL; |
216 | 221 | ||
217 | if (vdev->of_reset) | 222 | if (vfio_platform_has_reset(vdev)) |
218 | vdev->flags |= VFIO_DEVICE_FLAGS_RESET; | 223 | vdev->flags |= VFIO_DEVICE_FLAGS_RESET; |
219 | info.flags = vdev->flags; | 224 | info.flags = vdev->flags; |
220 | info.num_regions = vdev->num_regions; | 225 | info.num_regions = vdev->num_regions; |