Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Clark <robdclark@gmail.com>
To: igt-dev@lists.freedesktop.org
Cc: Rob Clark <robdclark@chromium.org>,
	Helen Koike <helen.koike@collabora.com>,
	Emma Anholt <emma@anholt.net>
Subject: [igt-dev] [PATCH 2/3] lib/drmtest: Add drm_find_chipset()
Date: Tue, 26 Sep 2023 11:47:46 -0700	[thread overview]
Message-ID: <20230926184748.199187-2-robdclark@gmail.com> (raw)
In-Reply-To: <20230926184748.199187-1-robdclark@gmail.com>

From: Rob Clark <robdclark@chromium.org>

Add helper to map driver name to chipset.

Signed-off-by: Rob Clark <robdclark@chromium.org>
---
 lib/drmtest.c | 14 ++++++++++++++
 lib/drmtest.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 2cfa8a899d53..4d826df744ae 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -608,6 +608,20 @@ static const char *chipset_to_str(int chipset)
 	return (chipset == DRIVER_ANY) ? "any" : "other";
 }
 
+/**
+ * drm_find_chipset:
+ * @name: The driver name
+ *
+ * Map the driver name to DRIVER_xyz value.
+ */
+int drm_find_chipset(const char *name)
+{
+	for (const struct module *m = modules; m->module; m++)
+		if (!strcmp(name, m->module))
+			return m->bit;
+	return 0;
+}
+
 /**
  * drm_open_driver:
  * @chipset: OR'd flags for each chipset to search, eg. #DRIVER_INTEL
diff --git a/lib/drmtest.h b/lib/drmtest.h
index 97ab6e759edf..9a71e1041ce8 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -99,6 +99,7 @@ void __set_forced_driver(const char *name);
 #define ALIGN_DOWN(x, a)	ALIGN((x) - ((a) - 1), (a))
 
 void drm_load_module(unsigned int chipset);
+int drm_find_chipset(const char *name);
 int drm_open_driver(int chipset);
 int drm_open_driver_master(int chipset);
 int drm_open_driver_render(int chipset);
-- 
2.41.0

  reply	other threads:[~2023-09-26 18:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26 18:47 [igt-dev] [PATCH 1/3] lib/drmtest: Use module table for chipset_to_str() Rob Clark
2023-09-26 18:47 ` Rob Clark [this message]
2023-09-27 14:20   ` [igt-dev] [PATCH 2/3] lib/drmtest: Add drm_find_chipset() Zbigniew Kempczyński
2023-09-27 17:41     ` Rob Clark
2023-09-27 16:21   ` Kamil Konieczny
2023-09-26 18:47 ` [igt-dev] [PATCH v3 3/3] core_getversion: Test for desired device Rob Clark
2023-09-27 14:26   ` Zbigniew Kempczyński
2023-09-27 17:42     ` Rob Clark
2023-09-27 16:42   ` Kamil Konieczny
2023-09-27 17:46     ` Rob Clark
2023-09-27 22:24   ` Helen Koike
2023-09-27 22:30     ` Rob Clark
2023-09-28  7:41     ` Kamil Konieczny
2023-09-26 19:39 ` [igt-dev] ✗ CI.xeBAT: failure for series starting with [1/3] lib/drmtest: Use module table for chipset_to_str() Patchwork
2023-09-26 19:46 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-09-27  7:43 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-09-27 14:01 ` [igt-dev] [PATCH 1/3] " Zbigniew Kempczyński
2023-09-27 16:09 ` Kamil Konieczny
2023-09-27 17:32   ` Rob Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230926184748.199187-2-robdclark@gmail.com \
    --to=robdclark@gmail.com \
    --cc=emma@anholt.net \
    --cc=helen.koike@collabora.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=robdclark@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox