[Accel-config] [PATCH v1 6/7] accel-config: Remove redundant check of wq state

ramesh.thomas at intel.com
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
From: Ramesh Thomas <ramesh.thomas(a)intel.com>

Functions that enable and disable wqs already verify state post
operation and return error if does not match the requested state.
Checking here again when success is returned will miss incrementing the
fail count.

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/enable.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/accfg/enable.c b/accfg/enable.c
index 8abbaca..642e30a 100644
--- a/accfg/enable.c
+++ b/accfg/enable.c
@@ -247,7 +247,6 @@ static int wq_action(int argc, const char **argv, const char *usage,
 	unsigned long dev_id, wq_id;
 	int i, rc = 0, success = 0, fail = 0, fail_reason = 0;
 	const char *all = "all";
-	enum accfg_wq_state state;
 
 	argc = parse_options(argc, argv, options, u, 0);
 
@@ -293,17 +292,9 @@ static int wq_action(int argc, const char **argv, const char *usage,
 				found++;
 				rc = wq_action_switch(wq, action, wq_name);
 				if (rc == 0) {
-					/*
-					 * Double check if the state of the
-					 * wq matches with the enable/disable
-					 */
-					state = accfg_wq_get_state(wq);
-					if (((state == 1) && (action == WQ_ACTION_ENABLE))
-					    ||((state == 0) && (action == WQ_ACTION_DISABLE)))
-						success++;
-					else
-						fail++;
-				} else if (!fail) {
+					success++;
+				} else {
+					fail++;
 					fail_reason = rc;
 					fprintf(stderr, "failed in %s\n", wq_name);
 
-- 
2.26.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.