linux-firmware.lore.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] check_whence: Check link targets are valid
@ 2023-02-16  0:56 Adam Sampson
  2023-02-16  0:56 ` [PATCH 2/2] intel: Fix broken links Adam Sampson
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Sampson @ 2023-02-16  0:56 UTC (permalink / raw)
  To: linux-firmware; +Cc: Adam Sampson

This should catch a couple of common errors: reversing the two
arguments, and not making the second argument relative to the first.

Signed-off-by: Adam Sampson <ats@offog.org>
---
 check_whence.py | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/check_whence.py b/check_whence.py
index 8805e99..654ff59 100755
--- a/check_whence.py
+++ b/check_whence.py
@@ -28,6 +28,24 @@ def list_whence():
                         yield match.group(2)
                         continue
 
+def list_whence_links():
+    with open('WHENCE', encoding='utf-8') as whence:
+        for line in whence:
+            fields = line.rstrip()
+            match = re.match(r'Link:\s*(.*)', line)
+            if match:
+                linkname, target = match.group(1).split("->")
+
+                linkname = linkname.strip().replace('\\ ', ' ')
+                target = target.strip().replace('\\ ', ' ')
+
+                # Link target is relative to the link
+                target = os.path.join(os.path.dirname(linkname), target)
+                target = os.path.normpath(target)
+
+                yield (linkname, target)
+                continue
+
 def list_git():
     with os.popen('git ls-files') as git_files:
         for line in git_files:
@@ -36,6 +54,7 @@ def list_git():
 def main():
     ret = 0
     whence_list = list(list_whence())
+    links_list = list(list_whence_links())
     known_files = set(name for name in whence_list if not name.endswith('/')) | \
                   set(['check_whence.py', 'configure', 'Makefile',
                        'README', 'copy-firmware.sh', 'WHENCE'])
@@ -46,6 +65,24 @@ def main():
         sys.stderr.write('E: %s listed in WHENCE does not exist\n' % name)
         ret = 1
 
+    # A link can point to another link, or to a file...
+    valid_targets = set(link[0] for link in links_list) | git_files
+
+    # ... or to a directory
+    for target in set(valid_targets):
+        dirname = target
+        while True:
+            dirname = os.path.dirname(dirname)
+            if dirname == '':
+                break
+            valid_targets.add(dirname)
+
+    for name, target in sorted(links_list):
+        if target not in valid_targets:
+            sys.stderr.write('E: target %s of link %s in WHENCE'
+                             ' does not exist\n' % (target, name))
+            ret = 1
+
     for name in sorted(list(git_files - known_files)):
         # Ignore subdirectory changelogs and GPG detached signatures
         if (name.endswith('/ChangeLog') or
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] intel: Fix broken links
  2023-02-16  0:56 [PATCH 1/2] check_whence: Check link targets are valid Adam Sampson
@ 2023-02-16  0:56 ` Adam Sampson
  2023-03-07 14:50   ` Josh Boyer
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Sampson @ 2023-02-16  0:56 UTC (permalink / raw)
  To: linux-firmware; +Cc: Adam Sampson, Cezary Rojewski

The target is relative to the link name.

Fixes: 23afbfe8 ("intel: avs: Add AudioDSP base firmware for CNL-based platforms")
Fixes: 284e55d9 ("intel: avs: Add AudioDSP base firmware for APL-based platforms")
Fixes: 289e3a97 ("intel: avs: Add AudioDSP base firmware for SKL-based platforms")
Fixes: 4296b7af ("intel: catpt: Add AudioDSP base firmware for BDW platforms")
Signed-off-by: Adam Sampson <ats@offog.org>
---
 WHENCE | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/WHENCE b/WHENCE
index b6199d6..e37fa73 100644
--- a/WHENCE
+++ b/WHENCE
@@ -4070,7 +4070,7 @@ Driver: snd_soc_catpt -- Intel AudioDSP driver for HSW/BDW platforms
 
 File: intel/catpt/bdw/dsp_basefw.bin
 Version: 44b81c4d5397a63108356f58f036953d9b288c4e
-Link: intel/IntcSST2.bin -> intel/catpt/bdw/dsp_basefw.bin
+Link: intel/IntcSST2.bin -> catpt/bdw/dsp_basefw.bin
 
 License: Redistributable. See LICENCE.IntcSST2 for details
 
@@ -4081,15 +4081,15 @@ Driver: snd_soc_avs -- Intel AudioDSP driver for cAVS platforms
 File: intel/avs/skl/dsp_basefw.bin
 File: intel/avs/skl/dsp_mod_7CAD0808-AB10-CD23-EF45-12AB34CD56EF.bin
 Version: 9.21.00.4899
-Link: intel/dsp_fw_release.bin -> intel/avs/skl/dsp_basefw.bin
-Link: intel/dsp_fw_kbl.bin -> intel/avs/skl/dsp_basefw.bin
+Link: intel/dsp_fw_release.bin -> avs/skl/dsp_basefw.bin
+Link: intel/dsp_fw_kbl.bin -> avs/skl/dsp_basefw.bin
 File: intel/avs/apl/dsp_basefw.bin
 Version: 9.22.01.4908
-Link: intel/dsp_fw_bxtn.bin -> intel/avs/apl/dsp_basefw.bin
-Link: intel/dsp_fw_glk.bin -> intel/avs/apl/dsp_basefw.bin
+Link: intel/dsp_fw_bxtn.bin -> avs/apl/dsp_basefw.bin
+Link: intel/dsp_fw_glk.bin -> avs/apl/dsp_basefw.bin
 File: intel/avs/cnl/dsp_basefw.bin
 Version: 10.23.00.8551
-Link: intel/dsp_fw_cnl.bin -> intel/avs/cnl/dsp_basefw.bin
+Link: intel/dsp_fw_cnl.bin -> avs/cnl/dsp_basefw.bin
 
 License: Redistributable. See LICENCE.adsp_sst for details
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] intel: Fix broken links
  2023-02-16  0:56 ` [PATCH 2/2] intel: Fix broken links Adam Sampson
@ 2023-03-07 14:50   ` Josh Boyer
  0 siblings, 0 replies; 3+ messages in thread
From: Josh Boyer @ 2023-03-07 14:50 UTC (permalink / raw)
  To: Adam Sampson; +Cc: linux-firmware, Cezary Rojewski

I got to your patch after a similar report and fixed it via a similar
commit.  My apologies for not using your patch directly.

josh

On Wed, Feb 15, 2023 at 7:56 PM Adam Sampson <ats@offog.org> wrote:
>
> The target is relative to the link name.
>
> Fixes: 23afbfe8 ("intel: avs: Add AudioDSP base firmware for CNL-based platforms")
> Fixes: 284e55d9 ("intel: avs: Add AudioDSP base firmware for APL-based platforms")
> Fixes: 289e3a97 ("intel: avs: Add AudioDSP base firmware for SKL-based platforms")
> Fixes: 4296b7af ("intel: catpt: Add AudioDSP base firmware for BDW platforms")
> Signed-off-by: Adam Sampson <ats@offog.org>
> ---
>  WHENCE | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/WHENCE b/WHENCE
> index b6199d6..e37fa73 100644
> --- a/WHENCE
> +++ b/WHENCE
> @@ -4070,7 +4070,7 @@ Driver: snd_soc_catpt -- Intel AudioDSP driver for HSW/BDW platforms
>
>  File: intel/catpt/bdw/dsp_basefw.bin
>  Version: 44b81c4d5397a63108356f58f036953d9b288c4e
> -Link: intel/IntcSST2.bin -> intel/catpt/bdw/dsp_basefw.bin
> +Link: intel/IntcSST2.bin -> catpt/bdw/dsp_basefw.bin
>
>  License: Redistributable. See LICENCE.IntcSST2 for details
>
> @@ -4081,15 +4081,15 @@ Driver: snd_soc_avs -- Intel AudioDSP driver for cAVS platforms
>  File: intel/avs/skl/dsp_basefw.bin
>  File: intel/avs/skl/dsp_mod_7CAD0808-AB10-CD23-EF45-12AB34CD56EF.bin
>  Version: 9.21.00.4899
> -Link: intel/dsp_fw_release.bin -> intel/avs/skl/dsp_basefw.bin
> -Link: intel/dsp_fw_kbl.bin -> intel/avs/skl/dsp_basefw.bin
> +Link: intel/dsp_fw_release.bin -> avs/skl/dsp_basefw.bin
> +Link: intel/dsp_fw_kbl.bin -> avs/skl/dsp_basefw.bin
>  File: intel/avs/apl/dsp_basefw.bin
>  Version: 9.22.01.4908
> -Link: intel/dsp_fw_bxtn.bin -> intel/avs/apl/dsp_basefw.bin
> -Link: intel/dsp_fw_glk.bin -> intel/avs/apl/dsp_basefw.bin
> +Link: intel/dsp_fw_bxtn.bin -> avs/apl/dsp_basefw.bin
> +Link: intel/dsp_fw_glk.bin -> avs/apl/dsp_basefw.bin
>  File: intel/avs/cnl/dsp_basefw.bin
>  Version: 10.23.00.8551
> -Link: intel/dsp_fw_cnl.bin -> intel/avs/cnl/dsp_basefw.bin
> +Link: intel/dsp_fw_cnl.bin -> avs/cnl/dsp_basefw.bin
>
>  License: Redistributable. See LICENCE.adsp_sst for details
>
> --
> 2.30.2
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-07 14:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-16  0:56 [PATCH 1/2] check_whence: Check link targets are valid Adam Sampson
2023-02-16  0:56 ` [PATCH 2/2] intel: Fix broken links Adam Sampson
2023-03-07 14:50   ` Josh Boyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).