[PATCH i-g-t v5 1/8] lib/igt_device_scan: Introduce filtering out non-PCI devices
Janusz Krzysztofik
janusz.krzysztofik at linux.intel.com
Thu Feb 1 11:11:56 UTC 2024
Hi Kamil, Dominik,
On Tuesday, 30 January 2024 18:07:15 CET Kamil Konieczny wrote:
> From: Dominik Karol Piątkowski <dominik.karol.piatkowski at intel.com>
>
> Introduced igt_device_filter_pci function that filters out non-PCI
> devices from IGT devices.
For me, an important "why" part of commit description is missing.
Thanks,
Janusz
>
> Cc: Chris Wilson <chris.p.wilson at linux.intel.com>
> Cc: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
> Signed-off-by: Dominik Karol Piątkowski <dominik.karol.piatkowski at intel.com>
> Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> ---
> lib/igt_device_scan.c | 21 +++++++++++++++++++++
> lib/igt_device_scan.h | 2 ++
> 2 files changed, 23 insertions(+)
>
> diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
> index fbf3fa482..37ebe1964 100644
> --- a/lib/igt_device_scan.c
> +++ b/lib/igt_device_scan.c
> @@ -1908,6 +1908,27 @@ const char *igt_device_filter_get(int num)
> return NULL;
> }
>
> +/**
> + * igt_device_filter_pci
> + *
> + * Filter devices to PCI only.
> + *
> + * Returns PCI devices count.
> + */
> +int igt_device_filter_pci(void)
> +{
> + int count = 0;
> + struct igt_device *dev, *tmp;
> +
> + igt_list_for_each_entry_safe(dev, tmp, &igt_devs.filtered, link)
> + if (strcmp(dev->subsystem, "pci") != 0)
> + igt_list_del(&dev->link);
> + else
> + count++;
> +
> + return count;
> +}
> +
> static bool igt_device_filter_apply(const char *fstr)
> {
> struct igt_device *dev, *tmp;
> diff --git a/lib/igt_device_scan.h b/lib/igt_device_scan.h
> index 48690e236..908733745 100644
> --- a/lib/igt_device_scan.h
> +++ b/lib/igt_device_scan.h
> @@ -81,6 +81,8 @@ int igt_device_filter_add(const char *filter);
> void igt_device_filter_free_all(void);
> const char *igt_device_filter_get(int num);
>
> +int igt_device_filter_pci(void);
> +
> /* Use filter to match the device and fill card structure */
> bool igt_device_card_match(const char *filter, struct igt_device_card *card);
> bool igt_device_card_match_pci(const char *filter,
>
More information about the igt-dev
mailing list