From: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
To: igt-dev@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>
Subject: [igt-dev] [PATCH i-g-t 2/8] lib/params: start renaming functions igt_params_*
Date: Mon, 20 Apr 2020 15:17:41 +0300 [thread overview]
Message-ID: <20200420121747.23816-3-juhapekka.heikkila@gmail.com> (raw)
In-Reply-To: <20200420121747.23816-1-juhapekka.heikkila@gmail.com>
From: Jani Nikula <jani.nikula@intel.com>
based on patch from Jani Nikula.
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
lib/drmtest.c | 2 +-
lib/i915/gem_submission.c | 2 +-
lib/igt_aux.c | 3 +--
lib/igt_gt.c | 2 +-
lib/igt_params.c | 12 +++++-------
lib/igt_params.h | 5 ++---
tests/i915/gem_ctx_exec.c | 2 +-
tests/i915/gem_ctx_persistence.c | 9 ++++-----
tests/i915/gem_mmap_gtt.c | 2 +-
tests/i915/gem_reset_stats.c | 6 ++----
tests/i915/sysfs_heartbeat_interval.c | 3 ++-
tests/i915/sysfs_preempt_timeout.c | 3 ++-
tests/i915/sysfs_timeslice_duration.c | 3 ++-
13 files changed, 25 insertions(+), 29 deletions(-)
diff --git a/lib/drmtest.c b/lib/drmtest.c
index 1fc39925..17067843 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -393,7 +393,7 @@ static void __cancel_work_at_exit(int fd)
{
igt_terminate_spins(); /* for older kernels */
- igt_sysfs_set_parameter(fd, "reset", "%x", -1u /* any method */);
+ igt_params_set(fd, "reset", "%x", -1u /* any method */);
igt_drop_caches_set(fd,
/* cancel everything */
DROP_RESET_ACTIVE | DROP_RESET_SEQNO |
diff --git a/lib/i915/gem_submission.c b/lib/i915/gem_submission.c
index bb58a207..4d80eb6a 100644
--- a/lib/i915/gem_submission.c
+++ b/lib/i915/gem_submission.c
@@ -78,7 +78,7 @@ unsigned gem_submission_method(int fd)
int dir;
- dir = igt_sysfs_open_parameters(fd);
+ dir = igt_params_open(fd);
if (dir < 0)
return 0;
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index c55b2916..fba34933 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -514,8 +514,7 @@ void igt_fork_hang_detector(int fd)
* they are a test failure!) and so the loss of per-engine reset
* functionality is not an issue.
*/
- igt_assert(igt_sysfs_set_parameter
- (fd, "reset", "%d", 1 /* only global reset */));
+ igt_assert(igt_params_set(fd, "reset", "%d", 1 /* only global reset */));
signal(SIGIO, sig_abort);
igt_fork_helper(&hang_detector)
diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index 22340a3d..cedb142d 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -188,7 +188,7 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)
__gem_context_set_param(fd, ¶m);
allow_reset = INT_MAX; /* any reset method */
}
- igt_require(igt_sysfs_set_parameter(fd, "reset", "%d", allow_reset));
+ igt_require(igt_params_set(fd, "reset", "%d", allow_reset));
if (!igt_check_boolean_env_var("IGT_HANG_WITHOUT_RESET", false))
igt_require(has_gpu_reset(fd));
diff --git a/lib/igt_params.c b/lib/igt_params.c
index 4bd2b1f2..f220e73b 100644
--- a/lib/igt_params.c
+++ b/lib/igt_params.c
@@ -126,7 +126,7 @@ static void igt_save_module_param(const char *name, const char *file_path)
}
/**
- * igt_sysfs_open_parameters:
+ * igt_params_open:
* @device: fd of the device
*
* This opens the module parameters directory (under sysfs) corresponding
@@ -135,7 +135,7 @@ static void igt_save_module_param(const char *name, const char *file_path)
* Returns:
* The directory fd, or -1 on failure.
*/
-int igt_sysfs_open_parameters(int device)
+int igt_params_open(int device)
{
int dir, params = -1;
@@ -165,22 +165,20 @@ int igt_sysfs_open_parameters(int device)
}
/**
- * igt_sysfs_set_parameters:
+ * igt_params_set:
* @device: fd of the device
* @parameter: the name of the parameter to set
* @fmt: printf-esque format string
*
* Returns true on success
*/
-bool igt_sysfs_set_parameter(int device,
- const char *parameter,
- const char *fmt, ...)
+bool igt_params_set(int device, const char *parameter, const char *fmt, ...)
{
va_list ap;
int dir;
int ret;
- dir = igt_sysfs_open_parameters(device);
+ dir = igt_params_open(device);
if (dir < 0)
return false;
diff --git a/lib/igt_params.h b/lib/igt_params.h
index cf0fd18f..52eed77f 100644
--- a/lib/igt_params.h
+++ b/lib/igt_params.h
@@ -26,11 +26,10 @@
#include <stdbool.h>
-int igt_sysfs_open_parameters(int device);
+int igt_params_open(int device);
__attribute__((format(printf, 3, 4)))
-bool igt_sysfs_set_parameter(int device, const char *parameter,
- const char *fmt, ...);
+bool igt_params_set(int device, const char *parameter, const char *fmt, ...);
void igt_set_module_param(const char *name, const char *val);
void igt_set_module_param_int(const char *name, int val);
diff --git a/tests/i915/gem_ctx_exec.c b/tests/i915/gem_ctx_exec.c
index ad2f9e54..bc2a352c 100644
--- a/tests/i915/gem_ctx_exec.c
+++ b/tests/i915/gem_ctx_exec.c
@@ -276,7 +276,7 @@ static void nohangcheck_hostile(int i915)
i915 = gem_reopen_driver(i915);
- dir = igt_sysfs_open_parameters(i915);
+ dir = igt_params_open(i915);
igt_require(dir != -1);
ctx = gem_context_create(i915);
diff --git a/tests/i915/gem_ctx_persistence.c b/tests/i915/gem_ctx_persistence.c
index 965b788b..cdaa87aa 100644
--- a/tests/i915/gem_ctx_persistence.c
+++ b/tests/i915/gem_ctx_persistence.c
@@ -95,7 +95,7 @@ static void enable_hangcheck(int i915)
{
int dir;
- dir = igt_sysfs_open_parameters(i915);
+ dir = igt_params_open(i915);
if (dir < 0) /* no parameters, must be default! */
return;
@@ -361,7 +361,7 @@ static void test_nohangcheck_hostile(int i915)
* we forcibly terminate that context.
*/
- dir = igt_sysfs_open_parameters(i915);
+ dir = igt_params_open(i915);
igt_require(dir != -1);
igt_require(__enable_hangcheck(dir, false));
@@ -398,7 +398,7 @@ static void test_nohangcheck_hang(int i915)
igt_require(!gem_has_cmdparser(i915, ALL_ENGINES));
- dir = igt_sysfs_open_parameters(i915);
+ dir = igt_params_open(i915);
igt_require(dir != -1);
igt_require(__enable_hangcheck(dir, false));
@@ -1090,8 +1090,7 @@ igt_main
igt_require_gem(i915);
/* Restore the reset modparam if left clobbered */
- igt_assert(igt_sysfs_set_parameter
- (i915, "reset", "%d", -1 /* any [default] reset */));
+ igt_assert(igt_params_set(i915, "reset", "%d", -1));
enable_hangcheck(i915);
igt_install_exit_handler(exit_handler);
diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c
index 1f4655af..32c92287 100644
--- a/tests/i915/gem_mmap_gtt.c
+++ b/tests/i915/gem_mmap_gtt.c
@@ -580,7 +580,7 @@ test_hang(int fd)
int dir;
hang = igt_allow_hang(fd, 0, 0);
- igt_require(igt_sysfs_set_parameter(fd, "reset", "1")); /* global */
+ igt_require(igt_params_set(fd, "reset", "1")); /* global */
control = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
igt_assert(control != MAP_FAILED);
diff --git a/tests/i915/gem_reset_stats.c b/tests/i915/gem_reset_stats.c
index 9c7b6645..8ea090d8 100644
--- a/tests/i915/gem_reset_stats.c
+++ b/tests/i915/gem_reset_stats.c
@@ -784,8 +784,7 @@ igt_main
has_reset_stats = gem_has_reset_stats(fd);
- igt_assert(igt_sysfs_set_parameter
- (fd, "reset", "%d", 1 /* only global reset */));
+ igt_assert(igt_params_set(fd, "reset", "%d", 1 /* only global reset */));
using_full_reset = !gem_engine_reset_enabled(fd) &&
gem_gpu_reset_enabled(fd);
@@ -846,8 +845,7 @@ igt_main
int fd;
fd = drm_open_driver(DRIVER_INTEL);
- igt_assert(igt_sysfs_set_parameter
- (fd, "reset", "%d", INT_MAX /* any reset method */));
+ igt_assert(igt_params_set(fd, "reset", "%d", INT_MAX /* any reset method */));
close(fd);
}
}
diff --git a/tests/i915/sysfs_heartbeat_interval.c b/tests/i915/sysfs_heartbeat_interval.c
index 662f4865..d1924f95 100644
--- a/tests/i915/sysfs_heartbeat_interval.c
+++ b/tests/i915/sysfs_heartbeat_interval.c
@@ -31,6 +31,7 @@
#include <sys/wait.h>
#include <unistd.h>
+#include "igt_params.h"
#include "drmtest.h" /* gem_quiescent_gpu()! */
#include "i915/gem_engine_topology.h"
#include "igt_dummyload.h"
@@ -52,7 +53,7 @@ static void enable_hangcheck(int i915, bool state)
{
int dir;
- dir = igt_sysfs_open_parameters(i915);
+ dir = igt_params_open(i915);
if (dir < 0) /* no parameters, must be default! */
return;
diff --git a/tests/i915/sysfs_preempt_timeout.c b/tests/i915/sysfs_preempt_timeout.c
index a7e93a4d..8a52dfb9 100644
--- a/tests/i915/sysfs_preempt_timeout.c
+++ b/tests/i915/sysfs_preempt_timeout.c
@@ -29,6 +29,7 @@
#include <sys/types.h>
#include <unistd.h>
+#include "igt_params.h"
#include "drmtest.h" /* gem_quiescent_gpu()! */
#include "i915/gem_engine_topology.h"
#include "igt_dummyload.h"
@@ -51,7 +52,7 @@ static bool enable_hangcheck(int i915, bool state)
bool success;
int dir;
- dir = igt_sysfs_open_parameters(i915);
+ dir = igt_params_open(i915);
if (dir < 0) /* no parameters, must be default! */
return false;
diff --git a/tests/i915/sysfs_timeslice_duration.c b/tests/i915/sysfs_timeslice_duration.c
index b983df43..123b9e19 100644
--- a/tests/i915/sysfs_timeslice_duration.c
+++ b/tests/i915/sysfs_timeslice_duration.c
@@ -29,6 +29,7 @@
#include <sys/types.h>
#include <unistd.h>
+#include "igt_params.h"
#include "drmtest.h" /* gem_quiescent_gpu()! */
#include "i915/gem_engine_topology.h"
#include "i915/gem_mman.h"
@@ -61,7 +62,7 @@ static bool enable_hangcheck(int i915, bool state)
bool success;
int dir;
- dir = igt_sysfs_open_parameters(i915);
+ dir = igt_params_open(i915);
if (dir < 0) /* no parameters, must be default! */
return false;
--
2.26.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2020-04-20 12:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-20 12:17 [igt-dev] [PATCH i-g-t 0/8] Use device dependant module parameters Juha-Pekka Heikkila
2020-04-20 12:17 ` [igt-dev] [PATCH i-g-t 1/8] lib/params: add igt_params.c for module parameter access Juha-Pekka Heikkila
2020-04-20 12:17 ` Juha-Pekka Heikkila [this message]
2020-04-20 12:17 ` [igt-dev] [PATCH i-g-t 3/8] lib/params: overhaul param saving Juha-Pekka Heikkila
2020-04-20 12:17 ` [igt-dev] [PATCH i-g-t 4/8] params open with path return Juha-Pekka Heikkila
2020-04-20 12:17 ` [igt-dev] [PATCH i-g-t 5/8] igt/params: add generic saving module parameter set Juha-Pekka Heikkila
2020-04-20 12:17 ` [igt-dev] [PATCH i-g-t 6/8] igt/params: use igt_params_set_save for igt_set_module_param* Juha-Pekka Heikkila
2020-04-20 12:17 ` [igt-dev] [PATCH i-g-t 7/8] lib/debugfs: use regular module param functions for prefault_disable Juha-Pekka Heikkila
2020-04-20 12:17 ` [igt-dev] [PATCH i-g-t 8/8] tests/gem_eio: switch to using igt_params_set() Juha-Pekka Heikkila
2020-04-20 13:10 ` [igt-dev] ✗ Fi.CI.BAT: failure for Use device dependant module parameters (rev2) Patchwork
-- strict thread matches above, loose matches on Subject: below --
2020-04-21 16:17 [igt-dev] [PATCH i-g-t 0/8] Use device dependant module parameters Juha-Pekka Heikkila
2020-04-21 16:17 ` [igt-dev] [PATCH i-g-t 2/8] lib/params: start renaming functions igt_params_* Juha-Pekka Heikkila
2020-04-22 8:28 ` Petri Latvala
2020-04-22 8:34 ` Jani Nikula
2020-04-22 8:43 ` Petri Latvala
2020-04-22 8:48 ` Jani Nikula
2020-04-22 9:04 ` Arkadiusz Hiler
2020-04-19 15:17 [igt-dev] [PATCH i-g-t 0/8] Use device dependant module parameters Juha-Pekka Heikkila
2020-04-19 15:17 ` [igt-dev] [PATCH i-g-t 2/8] lib/params: start renaming functions igt_params_* Juha-Pekka Heikkila
2020-04-20 9:33 ` Petri Latvala
2020-04-21 7:38 ` Juha-Pekka Heikkila
2020-04-21 8:07 ` Jani Nikula
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=20200420121747.23816-3-juhapekka.heikkila@gmail.com \
--to=juhapekka.heikkila@gmail.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
/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