[igt-dev] [PATCH i-g-t 3/3] lib: Use newly added igt_get_module_param() in igt_save_module_param()
José Roberto de Souza
jose.souza at intel.com
Wed Sep 5 21:05:05 UTC 2018
igt_get_module_param() is doing the same thing as part of
igt_save_module_param() so lets share code here.
Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
---
lib/igt_aux.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 5451f51c..7bb0b2d1 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1169,8 +1169,6 @@ static void igt_module_param_exit_handler(int sig)
static void igt_save_module_param(const char *name, const char *file_path)
{
struct module_param_data *data;
- size_t n;
- int fd;
/* Check if this parameter is already saved. */
for (data = module_params; data != NULL; data = data->next)
@@ -1185,14 +1183,7 @@ static void igt_save_module_param(const char *name, const char *file_path)
strncpy(data->name, name, PARAM_NAME_MAX_SZ - 1);
- fd = open(file_path, O_RDONLY);
- igt_assert(fd >= 0);
-
- n = read(fd, data->original_value, PARAM_VALUE_MAX_SZ);
- igt_assert_f(n > 0 && n < PARAM_VALUE_MAX_SZ,
- "Need to increase PARAM_VALUE_MAX_SZ\n");
-
- igt_assert(close(fd) == 0);
+ igt_get_module_param(name, data->original_value, PARAM_VALUE_MAX_SZ);
data->next = module_params;
module_params = data;
--
2.18.0
More information about the igt-dev
mailing list