diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2020-05-19 07:34:10 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2020-05-20 10:39:45 +0100 |
commit | 775e49c9388836e9bd93816854f57f68b9088d20 (patch) | |
tree | b499bf3d1432c3f07e4bc4c6ace118859f232379 /lib | |
parent | 299081df606d21a25978df401a1a57661b0836f8 (diff) |
Always pass device to igt_params_set
Don't second guess, require the user to provide the device that wish to
set the module parameter for.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/igt_params.c | 8 | ||||
-rw-r--r-- | lib/igt_params.h | 4 | ||||
-rw-r--r-- | lib/igt_psr.c | 18 | ||||
-rw-r--r-- | lib/igt_psr.h | 6 |
4 files changed, 18 insertions, 18 deletions
diff --git a/lib/igt_params.c b/lib/igt_params.c index d8649dfd9..3decc5b2a 100644 --- a/lib/igt_params.c +++ b/lib/igt_params.c @@ -343,9 +343,9 @@ bool igt_params_save_and_set(int device, const char *parameter, const char *fmt, * Please consider using igt_set_module_param_int() for the integer and bool * parameters. */ -void igt_set_module_param(const char *name, const char *val) +void igt_set_module_param(int device, const char *name, const char *val) { - igt_assert(igt_params_save_and_set(-1, name, "%s", val)); + igt_assert(igt_params_save_and_set(device, name, "%s", val)); } /** @@ -356,7 +356,7 @@ void igt_set_module_param(const char *name, const char *val) * This is a wrapper for igt_set_module_param() that takes an integer instead of * a string. Please see igt_set_module_param(). */ -void igt_set_module_param_int(const char *name, int val) +void igt_set_module_param_int(int device, const char *name, int val) { - igt_assert(igt_params_save_and_set(-1, name, "%d", val)); + igt_assert(igt_params_save_and_set(device, name, "%d", val)); } diff --git a/lib/igt_params.h b/lib/igt_params.h index ed17f34a5..bbd6f3ee6 100644 --- a/lib/igt_params.h +++ b/lib/igt_params.h @@ -34,7 +34,7 @@ bool igt_params_set(int device, const char *parameter, const char *fmt, ...); __attribute__((format(printf, 3, 4))) bool igt_params_save_and_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); +void igt_set_module_param(int device, const char *name, const char *val); +void igt_set_module_param_int(int device, const char *name, int val); #endif /* __IGT_PARAMS_H__ */ diff --git a/lib/igt_psr.c b/lib/igt_psr.c index c2a8d0e11..4109b5295 100644 --- a/lib/igt_psr.c +++ b/lib/igt_psr.c @@ -94,11 +94,11 @@ static int has_psr_debugfs(int debugfs_fd) return -EINVAL; } -static bool psr_modparam_set(int val) +static bool psr_modparam_set(int device, int val) { static int oldval = -1; - igt_set_module_param_int("enable_psr", val); + igt_set_module_param_int(device, "enable_psr", val); if (val == oldval) return false; @@ -114,7 +114,7 @@ static void restore_psr_debugfs(int sig) psr_write(psr_restore_debugfs_fd, "0"); } -static bool psr_set(int debugfs_fd, int mode) +static bool psr_set(int device, int debugfs_fd, int mode) { int ret; @@ -131,7 +131,7 @@ static bool psr_set(int debugfs_fd, int mode) * version enabled and the PSR version of the test, it will * fail in the first psr_wait_entry() of the test. */ - ret = psr_modparam_set(mode >= PSR_MODE_1); + ret = psr_modparam_set(device, mode >= PSR_MODE_1); } else { const char *debug_val; @@ -161,18 +161,18 @@ static bool psr_set(int debugfs_fd, int mode) return ret; } -bool psr_enable(int debugfs_fd, enum psr_mode mode) +bool psr_enable(int device, int debugfs_fd, enum psr_mode mode) { - return psr_set(debugfs_fd, mode); + return psr_set(device, debugfs_fd, mode); } -bool psr_disable(int debugfs_fd) +bool psr_disable(int device, int debugfs_fd) { /* Any mode different than PSR_MODE_1/2 will disable PSR */ - return psr_set(debugfs_fd, -1); + return psr_set(device, debugfs_fd, -1); } -bool psr_sink_support(int debugfs_fd, enum psr_mode mode) +bool psr_sink_support(int device, int debugfs_fd, enum psr_mode mode) { char buf[PSR_STATUS_MAX_LEN]; int ret; diff --git a/lib/igt_psr.h b/lib/igt_psr.h index 02ce760b2..b2afb6119 100644 --- a/lib/igt_psr.h +++ b/lib/igt_psr.h @@ -39,9 +39,9 @@ bool psr_disabled_check(int debugfs_fd); bool psr_wait_entry(int debugfs_fd, enum psr_mode mode); bool psr_wait_update(int debugfs_fd, enum psr_mode mode); bool psr_long_wait_update(int debugfs_fd, enum psr_mode mode); -bool psr_enable(int debugfs_fd, enum psr_mode); -bool psr_disable(int debugfs_fd); -bool psr_sink_support(int debugfs_fd, enum psr_mode); +bool psr_enable(int device, int debugfs_fd, enum psr_mode); +bool psr_disable(int device, int debugfs_fd); +bool psr_sink_support(int device, int debugfs_fd, enum psr_mode mode); bool psr2_wait_su(int debugfs_fd, uint16_t *num_su_blocks); #endif |