[PATCH i-g-t] lib/igt_device_scan: Skip attributes in subdirectories
Marcin Bernatowicz
marcin.bernatowicz at linux.intel.com
Thu Jul 4 16:44:37 UTC 2024
Skip attributes in subdirectories as they are not used for filtering.
This change improves speed and reduces the impact of non-DRM related
component bugs on testing, such as ASPM issues.
Rename function is_on_blacklist to is_on_blocklist to promote more
inclusive language.
Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz at linux.intel.com>
---
lib/igt_device_scan.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
index 9a2da3d62..6473ca7ad 100644
--- a/lib/igt_device_scan.c
+++ b/lib/igt_device_scan.c
@@ -433,7 +433,7 @@ static enum dev_type __pci_devtype(uint16_t vendor, uint16_t device, const char
/* Reading sysattr values can take time (even seconds),
* we want to avoid reading such keys.
*/
-static bool is_on_blacklist(const char *what)
+static bool is_on_blocklist(const char *what)
{
static const char *keys[] = { "config", "modalias", "modes",
"resource",
@@ -442,16 +442,18 @@ static bool is_on_blacklist(const char *what)
"resource0_wc", "resource1_wc", "resource2_wc",
"resource3_wc", "resource4_wc", "resource5_wc",
"uevent", NULL};
- const char *key;
- int i = 0;
+ const char **key;
if (what == NULL)
return false;
- while ((key = keys[i++])) {
- if (strcmp(key, what) == 0)
+ /* Skip attributes in subdirectories */
+ if (strchr(what, '/') != NULL)
+ return true;
+
+ for (key = keys; *key; key++)
+ if (strcmp(*key, what) == 0)
return true;
- }
return false;
@@ -553,7 +555,7 @@ static void get_attrs(struct udev_device *dev, struct igt_device *idev)
const char *key = udev_list_entry_get_name(entry);
const char *value;
- if (is_on_blacklist(key)) {
+ if (is_on_blocklist(key)) {
entry = udev_list_entry_get_next(entry);
continue;
}
--
2.31.1
More information about the igt-dev
mailing list