Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753194AbbDUAgj (ORCPT ); Mon, 20 Apr 2015 20:36:39 -0400 Received: from smtpfb2-g21.free.fr ([212.27.42.10]:49860 "EHLO smtpfb2-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752549AbbDUAgg (ORCPT ); Mon, 20 Apr 2015 20:36:36 -0400 From: Laurent Vivier To: Stefan Richter Cc: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Laurent Vivier Subject: [PATCH 1/2] firewire: firewire is a big-endian bus Date: Tue, 21 Apr 2015 02:36:15 +0200 Message-Id: <1429576576-1637-2-git-send-email-laurent@vivier.eu> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429576576-1637-1-git-send-email-laurent@vivier.eu> References: <1429576576-1637-1-git-send-email-laurent@vivier.eu> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2330 Lines: 62 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 --- 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/