public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "José Roberto de Souza" <jose.souza@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 3/3] lib: Use newly added igt_get_module_param() in igt_save_module_param()
Date: Wed,  5 Sep 2018 14:05:05 -0700	[thread overview]
Message-ID: <20180905210505.28867-3-jose.souza@intel.com> (raw)
In-Reply-To: <20180905210505.28867-1-jose.souza@intel.com>

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@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

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

  parent reply	other threads:[~2018-09-05 21:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-05 21:05 [igt-dev] [PATCH i-g-t 1/3] lib: Add functions to read parameters José Roberto de Souza
2018-09-05 21:05 ` [igt-dev] [PATCH i-g-t 2/3] lib/psr: Read enable_psr instead of relly in a value assumption José Roberto de Souza
2018-09-05 21:05 ` José Roberto de Souza [this message]
2018-09-05 21:36 ` [igt-dev] [PATCH i-g-t 1/3] lib: Add functions to read parameters Chris Wilson
2018-09-05 22:42 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] " Patchwork
2018-09-06  7:29 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=20180905210505.28867-3-jose.souza@intel.com \
    --to=jose.souza@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox