All of lore.kernel.org
 help / color / mirror / Atom feed
From: D Scott Phillips <d.scott.phillips@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 16/29] lib/igt_kmod: add null implementation
Date: Tue, 10 Dec 2019 16:52:22 -0800	[thread overview]
Message-ID: <20191211005235.67897-17-d.scott.phillips@intel.com> (raw)
In-Reply-To: <20191211005235.67897-1-d.scott.phillips@intel.com>

igt_kmod depends on libkmod, which is only available on Linux. Add
a do-nothing implementation of the same API for inclusion on other
platforms.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/igt_kmod.h      |  2 ++
 lib/igt_kmod_null.c | 84 +++++++++++++++++++++++++++++++++++++++++++++
 lib/meson.build     |  3 +-
 3 files changed, 88 insertions(+), 1 deletion(-)
 create mode 100644 lib/igt_kmod_null.c

diff --git a/lib/igt_kmod.h b/lib/igt_kmod.h
index c71ec147..cd374609 100644
--- a/lib/igt_kmod.h
+++ b/lib/igt_kmod.h
@@ -24,7 +24,9 @@
 #ifndef IGT_KMOD_H
 #define IGT_KMOD_H
 
+#if defined(__linux__)
 #include <libkmod.h>
+#endif
 
 #include "igt_list.h"
 
diff --git a/lib/igt_kmod_null.c b/lib/igt_kmod_null.c
new file mode 100644
index 00000000..9df64e8f
--- /dev/null
+++ b/lib/igt_kmod_null.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright © 2019 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "igt_kmod.h"
+
+bool igt_kmod_is_loaded(const char *mod_name) {
+	return true;
+}
+
+void igt_kmod_list_loaded(void) {
+}
+
+bool igt_kmod_has_param(const char *mod_name, const char *param) {
+	return true;
+}
+
+int igt_kmod_load(const char *mod_name, const char *opts) {
+	return 0;
+}
+
+int igt_kmod_unload(const char *mod_name, unsigned int flags) {
+	return 0;
+}
+
+int igt_i915_driver_load(const char *opts) {
+	return 0;
+}
+
+int igt_i915_driver_unload(void) {
+	return 0;
+}
+
+void igt_kselftests(const char *module_name,
+		    const char *module_options,
+		    const char *result_option,
+		    const char *filter) {
+}
+
+int igt_kselftest_init(struct igt_kselftest *tst,
+		       const char *module_name) {
+	return 0;
+}
+
+int igt_kselftest_begin(struct igt_kselftest *tst) {
+	return 0;
+}
+
+void igt_kselftest_get_tests(struct kmod_module *kmod,
+			     const char *filter,
+			     struct igt_list_head *tests) {
+}
+
+int igt_kselftest_execute(struct igt_kselftest *tst,
+			  struct igt_kselftest_list *tl,
+			  const char *module_options,
+			  const char *result) {
+	return 0;
+}
+
+void igt_kselftest_end(struct igt_kselftest *tst) {
+}
+
+void igt_kselftest_fini(struct igt_kselftest *tst) {
+}
diff --git a/lib/meson.build b/lib/meson.build
index 6a56fff0..4a58d9cf 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -54,7 +54,6 @@ lib_sources = [
 	'igt_pm.c',
 	'igt_dummyload.c',
 	'uwildmat/uwildmat.c',
-	'igt_kmod.c',
 	'igt_panfrost.c',
 	'igt_v3d.c',
 	'igt_vc4.c',
@@ -69,10 +68,12 @@ lib_sources = [
 if host_machine.system() == 'linux'
 	lib_sources += [
 		'igt_aux.c',
+		'igt_kmod.c',
 	]
 else
 	lib_sources += [
 		'igt_aux_null.c',
+		'igt_kmod_null.c',
 	]
 endif
 
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-12-11  0:59 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 01/29] Remove unused includes D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 02/29] lib/igt_chipset: Add missing libdrm dependency D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 03/29] lib/igt_core: update longjmp buffers to type sigjmp_buf D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 04/29] Include <sys/wait.h>, <limits.h>, and <signal.h> where appropriate D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 05/29] Use /bin/sh for shell scripts D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 06/29] tools/intel_gpu_top: Use POSIX signal handler type definition D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 07/29] kms_atomic: change `PAGE_SIZE` to `page_size` D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 08/29] lib: remove open-coded card index fetching D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 09/29] igt: replace mmap64() with mmap() D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 10/29] drm-uapi: patch sync_file.h to depend on drm.h D Scott Phillips
2019-12-12 11:01   ` Jani Nikula
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 11/29] i915/pm_backlight: use POSIX basename D Scott Phillips
2019-12-16 13:31   ` Petri Latvala
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 12/29] Include Linux specific headers only on Linux D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 13/29] lib/igt_core: skip oom_adjustments on non-Linux platforms D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 14/29] i915/gem: Omit Linux-specific madvise, mmap, and sched flags on non-Linux D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 15/29] lib/igt_aux: add null implementation D Scott Phillips
2019-12-11  0:52 ` D Scott Phillips [this message]
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 17/29] lib/igt_perf: " D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 18/29] runner: Add support for non-Linux operating systems D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 19/29] Use ETIMEDOUT in place of ETIME on FreeBSD D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 20/29] ilog2: Use libc provided fls() " D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 21/29] lib: undefine FreeBSD libc's ALIGN macro D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 22/29] lib: Add FreeBSD-specific pthread logic D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 23/29] lib/igt_kms: Add FreeBSD support D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 24/29] lib/ioctl_wrappers: Support FreeBSD in igt_require_gem D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 25/29] lib/intel_os: Implement get_avail_ram and get_total_swap for FreeBSD D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 26/29] lib/igt_device: Implement get_card_index " D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 27/29] lib/igt_debugfs: Implement mount() " D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 28/29] build: Add support for building on non-Linux D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 29/29] lib/igt_device_scan: add null implementation D Scott Phillips
2019-12-11  8:11 ` [igt-dev] ✗ GitLab.Pipeline: warning for Add FreeBSD Support Patchwork
2019-12-12 11:14 ` [igt-dev] [PATCH i-g-t 00/30] " Jani Nikula
2019-12-12 18:20   ` D Scott Phillips
2019-12-16 13:55     ` Petri Latvala
2019-12-27  9:38       ` Arkadiusz Hiler

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=20191211005235.67897-17-d.scott.phillips@intel.com \
    --to=d.scott.phillips@intel.com \
    --cc=igt-dev@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.