[Pdbg] [PATCH 2/3] istep: Use the first sbefifo to run isteps

Amitay Isaacs amitay at ozlabs.org
Thu Jul 4 18:11:32 AEST 2019


Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 src/istep.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/istep.c b/src/istep.c
index a9acbe7..a141a31 100644
--- a/src/istep.c
+++ b/src/istep.c
@@ -34,8 +34,18 @@ struct istep_data {
 
 static int istep(uint32_t major, uint32_t minor)
 {
-	struct pdbg_target *target;
-	int count = 0, i;
+	struct pdbg_target *sbefifo;
+	int count = 0, i, rc;
+
+	for_each_path_target_class("sbefifo", sbefifo) {
+		if (pdbg_target_status(sbefifo) == PDBG_TARGET_ENABLED)
+			break;
+	}
+
+	if (sbefifo == NULL) {
+		fprintf(stderr, "No sbefifo found to run isteps\n");
+		return 0;
+	}
 
 	if (major < 2 || major > 5) {
 		fprintf(stderr, "Istep major should be 2 to 5\n");
@@ -56,16 +66,9 @@ static int istep(uint32_t major, uint32_t minor)
 		}
 	}
 
-	for_each_path_target_class("sbefifo", target) {
-		int rc;
-
-		if (pdbg_target_status(target) != PDBG_TARGET_ENABLED)
-			continue;
-
-		rc = sbe_istep(target, major, minor);
-		if (!rc)
-			count++;
-	}
+	rc = sbe_istep(sbefifo, major, minor);
+	if (!rc)
+		count++;
 
 	return count;
 }
-- 
2.21.0



More information about the Pdbg mailing list