From 8ae86621d6fff60b6e20c6b0f9b336785c935b0f Mon Sep 17 00:00:00 2001 From: Michał Winiarski Date: Tue, 12 Mar 2019 13:48:13 +0100 Subject: lib/igt_device: Move intel_get_pci_device under igt_device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It allows us to make things a little bit more generic. Also, we now require fd rather than doing guesswork when it comes to pci address. v2: Use readlinkat rather than string concat, move stuff around, provide a version that does not assert. (Chris) v3: Print addr on failure, avoid assignment in conditionals. (Chris) Signed-off-by: Michał Winiarski Cc: Chris Wilson Reviewed-by: Chris Wilson --- lib/ioctl_wrappers.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/ioctl_wrappers.c') diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 39920f87..a66eb4bc 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -53,6 +53,7 @@ #include "intel_chipset.h" #include "intel_io.h" #include "igt_debugfs.h" +#include "igt_device.h" #include "igt_sysfs.h" #include "config.h" @@ -1096,9 +1097,9 @@ uint64_t gem_aperture_size(int fd) * * Returns: The mappable gtt address space size. */ -uint64_t gem_mappable_aperture_size(void) +uint64_t gem_mappable_aperture_size(int fd) { - struct pci_device *pci_dev = intel_get_pci_device(); + struct pci_device *pci_dev = igt_device_get_pci_device(fd); int bar; if (intel_gen(pci_dev->device_id) < 3) -- cgit v1.2.3