<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="moz-cite-prefix">On 3/13/2024 12:59, Marcin Bernatowicz
wrote:<br>
</div>
<blockquote type="cite" cite="mid:20240313115911.22870-1-marcin.bernatowicz@linux.intel.com">
<pre class="moz-quote-pre" wrap="">Be consistent with other drm_open_xxx functions.
Signed-off-by: Marcin Bernatowicz <a class="moz-txt-link-rfc2396E" href="mailto:marcin.bernatowicz@linux.intel.com"><marcin.bernatowicz@linux.intel.com></a></pre>
</blockquote>
<p><br>
</p>
<p><span lang="en-US">Reviewed-by: </span><span lang="pl">L</span><span lang="en-US">ukasz </span><span lang="pl">L</span><span lang="en-US">aguna <</span><a href="mailto:lukasz.laguna@intel.com"><span lang="en-US">lukasz.laguna@intel.com</span></a><span lang="en-US">></span></p>
<p><br>
</p>
<blockquote type="cite" cite="mid:20240313115911.22870-1-marcin.bernatowicz@linux.intel.com">
<pre class="moz-quote-pre" wrap="">
---
lib/igt_sriov_device.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/igt_sriov_device.c b/lib/igt_sriov_device.c
index f20761669..f425a5ecf 100644
--- a/lib/igt_sriov_device.c
+++ b/lib/igt_sriov_device.c
@@ -12,6 +12,7 @@
#include "igt_device.h"
#include "igt_sriov_device.h"
#include "igt_sysfs.h"
+#include "xe/xe_query.h"
/**
* igt_sriov_is_pf - Check if device is PF
@@ -232,6 +233,7 @@ int igt_sriov_open_vf_drm_device(int pf, unsigned int vf_num)
DIR *dir;
struct dirent *de;
bool found = false;
+ int fd;
if (!vf_num)
return -1;
@@ -258,7 +260,11 @@ int igt_sriov_open_vf_drm_device(int pf, unsigned int vf_num)
if (!found)
return -1;
- return __drm_open_device(dev_name, DRIVER_ANY);
+ fd = __drm_open_device(dev_name, DRIVER_ANY);
+ if (fd >= 0 && is_xe_device(fd))
+ xe_device_get(fd);
+
+ return fd;
}
/**
</pre>
</blockquote>
</body>
</html>