From 775e49c9388836e9bd93816854f57f68b9088d20 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 19 May 2020 07:34:10 +0100 Subject: 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 Reviewed-by: Juha-Pekka Heikkila --- lib/igt_params.c | 8 ++++---- lib/igt_params.h | 4 ++-- lib/igt_psr.c | 18 +++++++++--------- lib/igt_psr.h | 6 +++--- 4 files changed, 18 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/igt_params.c b/lib/igt_params.c index d8649dfd..3decc5b2 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 ed17f34a..bbd6f3ee 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 c2a8d0e1..4109b529 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 02ce760b..b2afb611 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 -- cgit v1.2.3