Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752276AbbDUBFF (ORCPT ); Mon, 20 Apr 2015 21:05:05 -0400 Received: from smtprelay0018.hostedemail.com ([216.40.44.18]:50438 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751273AbbDUBFA (ORCPT ); Mon, 20 Apr 2015 21:05:00 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:599:960:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3867:3871:4321:4605:5007:6261:7903:10004:10400:10848:11026:11232:11658:11914:12043:12296:12517:12519:12740:13069:13311:13357:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: alley10_2b71ae050021e X-Filterd-Recvd-Size: 1810 Message-ID: <1429578297.4216.43.camel@perches.com> Subject: Re: [PATCH 1/2] firewire: firewire is a big-endian bus From: Joe Perches To: Laurent Vivier Cc: Stefan Richter , linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Date: Mon, 20 Apr 2015 18:04:57 -0700 In-Reply-To: <1429576576-1637-2-git-send-email-laurent@vivier.eu> References: <1429576576-1637-1-git-send-email-laurent@vivier.eu> <1429576576-1637-2-git-send-email-laurent@vivier.eu> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1116 Lines: 30 On Tue, 2015-04-21 at 02:36 +0200, Laurent Vivier wrote: > 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: [] > diff --git 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]); Is buf guaranteed to be appropriately aligned on a u32? -- 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/