So, dump config_rom data as big-endian values.

The value given by /sys/bus/firewire/devices/fw0 were correctly
given on a big-endian host (like powermac) not on a little-endian host
(like PC), for instance:

00000000  87 a4 04 04 34 39 33 31  22 a2 00 f0 33 22 11 00  |....4931"...3"..|
00000010  66 66 66 33 0b dd 05 00  c0 83 00 0c 1e 0d d0 03  |fff3............|
00000020  03 00 00 81 01 00 00 17  08 00 00 81 b7 4c 06 00  |.............L..|
00000030  00 00 00 00 00 00 00 00  75 6e 69 4c 69 46 20 78  |........uniLiF x|
00000040  69 77 65 72 00 00 65 72  1c ff 03 00 00 00 00 00  |iwer..er........|
00000050  00 00 00 00 75 6a 75 4a                           |....ujuJ|
00000058

instead of:

00000000  04 04 a4 87 31 33 39 34  f0 00 a2 22 00 11 22 33  |....1394...".."3|
00000010  33 66 66 66 00 05 dd 0b  0c 00 83 c0 03 d0 0d 1e  |3fff............|
00000020  81 00 00 03 17 00 00 01  81 00 00 08 00 06 4c b7  |..............L.|
00000030  00 00 00 00 00 00 00 00  4c 69 6e 75 78 20 46 69  |........Linux Fi|
00000040  72 65 77 69 72 65 00 00  00 03 ff 1c 00 00 00 00  |rewire..........|
00000050  00 00 00 00 4a 75 6a 75                           |....Juju|
00000058

This patch corrects this.

Signed-off-by: Laurent Vivier <laur...@vivier.eu>
---
 drivers/firewire/core-device.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
index f9e3aee..5245567 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -399,14 +399,14 @@ static ssize_t config_rom_show(struct device *dev,
                               struct device_attribute *attr, char *buf)
 {
        struct fw_device *device = fw_device(dev);
-       size_t length;
+       size_t i;
 
        down_read(&fw_device_rwsem);
-       length = device->config_rom_length * 4;
-       memcpy(buf, device->config_rom, length);
+       for (i = 0; i < device->config_rom_length; i++)
+               ((u32 *)buf)[i] = be32_to_cpu(device->config_rom[i]);
        up_read(&fw_device_rwsem);
 
-       return length;
+       return i * 4;
 }
 
 static ssize_t guid_show(struct device *dev,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to