[PATCH 3/6] thunderbolt: property: Make format_dwdata() work on big-endian systems
From: Thomas Weißschuh
Date: Sun May 24 2026 - 09:07:33 EST
The data also needs to be swapped on big-endian systems.
Use swab32() which works independently from the host byte order.
Fixes: cdae7c07e3e3 ("thunderbolt: Add support for XDomain properties")
Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
drivers/thunderbolt/property.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/thunderbolt/property.c b/drivers/thunderbolt/property.c
index fb96608ca471..94314fa07d23 100644
--- a/drivers/thunderbolt/property.c
+++ b/drivers/thunderbolt/property.c
@@ -43,7 +43,8 @@ static struct tb_property_dir *__tb_property_parse_dir(const u32 *block,
static inline void parse_dwdata(void *dst, const void *src, size_t dwords)
{
- be32_to_cpu_array(dst, src, dwords);
+ for (size_t i = 0; i < dwords; i++)
+ ((u32 *)dst)[i] = swab32(((u32 *)src)[i]);
}
static inline void format_dwdata(void *dst, const void *src, size_t dwords)
--
2.54.0