diff mbox series

[ImageBuilder,v2,1/2] Refactor sanity_check_partial_dts

Message ID 20220913120918.31162-2-michal.orzel@amd.com (mailing list archive)
State Accepted
Headers show
Series Use lopper to generate partial dts | expand

Commit Message

Michal Orzel Sept. 13, 2022, 12:09 p.m. UTC
Currently function sanity_check_partial_dts from scripts/common takes
three arguments where the last two (repo, dir) are used always in
conjuction to form a path to a directory storing partial dts. Modify the
function to take only two arguments where the second one is to be a path
to a directory storing partial dts. This will help reusing this function
in the future to perform sanity checks on partial dts that do not
originate from a repository.

Modify compile_merge_partial_dts to take this change into account.

Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Reviewed-by: Ayan Kumar Halder <ayankuma@amd.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
Changes in v2:
- none
---
 scripts/common | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/scripts/common b/scripts/common
index 25c041270c29..ccad03d82b30 100644
--- a/scripts/common
+++ b/scripts/common
@@ -40,8 +40,7 @@  function get_next_phandle()
 function sanity_check_partial_dts()
 {
     local domU_passthrough_path="$1"
-    local repo="$2"
-    local dir="$3"
+    local partial_dts_dir="$2"
     local address_cells_val
     local size_cells_val
     local tmpdtb
@@ -51,7 +50,7 @@  function sanity_check_partial_dts()
     for devpath in $domU_passthrough_path
     do
         file=${devpath##*/}
-        file="$repo"/"$dir"/"$file".dts
+        file="$partial_dts_dir"/"$file".dts
 
         if ! test -f "$file"
         then
@@ -96,6 +95,7 @@  function compile_merge_partial_dts()
     local dtb_dir=$1
     local repo=$(echo "$2" | awk '{print $1}')
     local dir=$(echo "$2" | awk '{print $2}')
+    local partial_dts_dir
     local tmp
     local tmpdts
     local file
@@ -123,6 +123,7 @@  function compile_merge_partial_dts()
         dir="."
     fi
 
+    partial_dts_dir="$repo"/"$dir"
     i=0
     while test $i -lt $NUM_DOMUS
     do
@@ -132,7 +133,7 @@  function compile_merge_partial_dts()
             return 1
         fi
 
-        sanity_check_partial_dts "${DOMU_PASSTHROUGH_PATHS[$i]}" "$repo" "$dir"
+        sanity_check_partial_dts "${DOMU_PASSTHROUGH_PATHS[$i]}" "$partial_dts_dir"
         if test $? -ne 0
         then
             return 1
@@ -146,7 +147,7 @@  function compile_merge_partial_dts()
         for devpath in ${DOMU_PASSTHROUGH_PATHS[$i]}
         do
             file=${devpath##*/}
-            file="$repo"/"$dir"/"$file".dts
+            file="$partial_dts_dir"/"$file".dts
 
             # All the subsequent dts files should not have dts version mentioned
             if test $j -gt 1