Skip to contentSkip to conversation

tests: fix acpi to work on bigendian host

PATCH Applied Alexey Kardashevskiy 2 participants 2 messages Jan 13, 2014 – Jan 14, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: fix acpi to work on bigendian host

Double endianness convertion make this test failing on POWERPC machine running in big-endian.

This fixes the test to success on big-endian host.

---
 tests/acpi-test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/acpi-test.c +3 -3
index df1af83..30a5e3e 100644
@@ -51,13 +51,13 @@ typedef struct {
             field = readb(addr);               \
             break;                             \
         case 2:                                \
-            field = le16_to_cpu(readw(addr));  \
+            field = readw(addr);               \
             break;                             \
         case 4:                                \
-            field = le32_to_cpu(readl(addr));  \
+            field = readl(addr);               \
             break;                             \
         case 8:                                \
-            field = le64_to_cpu(readq(addr));  \
+            field = readq(addr);               \
             break;                             \
         default:                               \
             g_assert(false);                   \
Signature · 1 line
1.8.4.rc4
#1 lore raw
Quoted 6 lines · Alexey Kardashevskiy

Double endianness convertion make this test failing on POWERPC machine running in big-endian.

This fixes the test to success on big-endian host.

Yes, readl etc already convert from guest endian-ness to host endian-ness, and guest is LE.

Applied, thanks.

Quoted 28 lines
---
 tests/acpi-test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/acpi-test.c +3 -3
index df1af83..30a5e3e 100644
@@ -51,13 +51,13 @@ typedef struct {
             field = readb(addr);               \
             break;                             \
         case 2:                                \
-            field = le16_to_cpu(readw(addr));  \
+            field = readw(addr);               \
             break;                             \
         case 4:                                \
-            field = le32_to_cpu(readl(addr));  \
+            field = readl(addr);               \
             break;                             \
         case 8:                                \
-            field = le64_to_cpu(readq(addr));  \
+            field = readq(addr);               \
             break;                             \
         default:                               \
             g_assert(false);                   \
Signature · 1 line
1.8.4.rc4