Current device sorting algorithm positions PCIe bridge upstream ports between DRM and PCI devices of their GPU children. Listing those two not interleaved with bridge ports, and the ports following their PCI GPU devices, seems more clear. Go for it.
Signed-off-by: Janusz Krzysztofik <[email protected]> --- lib/igt_device_scan.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c index 34c7a8131b..61f507a06d 100644 --- a/lib/igt_device_scan.c +++ b/lib/igt_device_scan.c @@ -23,6 +23,7 @@ */ #include "drmtest.h" +#include "igt_aux.h" #include "igt_core.h" #include "igt_device_scan.h" #include "igt_list.h" @@ -1061,6 +1062,7 @@ static struct igt_device *duplicate_device(struct igt_device *dev) { static int devs_compare(const void *a, const void *b) { struct igt_device *dev1, *dev2; + unsigned int len1, len2; int ret; dev1 = *(struct igt_device **) a; @@ -1069,6 +1071,12 @@ static int devs_compare(const void *a, const void *b) if (ret) return ret; + len1 = strlen(dev1->syspath); + len2 = strlen(dev2->syspath); + + if (len1 != len2 && !strncmp(dev1->syspath, dev2->syspath, min(len1, len2))) + return len2 - len1; + return strcmp(dev1->syspath, dev2->syspath); } -- 2.52.0
