public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Laurent Vivier <laurent@vivier.eu>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>,
	linux1394-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] firewire: firewire is a big-endian bus
Date: Mon, 20 Apr 2015 18:04:57 -0700	[thread overview]
Message-ID: <1429578297.4216.43.camel@perches.com> (raw)
In-Reply-To: <1429576576-1637-2-git-send-email-laurent@vivier.eu>

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?



  reply	other threads:[~2015-04-21  1:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21  0:36 [PATCH 0/2] Some firewire minor patches Laurent Vivier
2015-04-21  0:36 ` [PATCH 1/2] firewire: firewire is a big-endian bus Laurent Vivier
2015-04-21  1:04   ` Joe Perches [this message]
2015-04-21 14:13     ` Stefan Richter
2015-04-21 13:13   ` Stefan Richter
2015-04-21 16:04     ` Laurent Vivier
2015-04-21  0:36 ` [PATCH 2/2] firewire: add a parameter to force the speed of the devices Laurent Vivier
2015-04-21 14:03   ` Clemens Ladisch
2015-04-21 14:16     ` Stefan Richter
2015-04-21 14:33   ` Stefan Richter
2015-04-21 16:55     ` Laurent Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1429578297.4216.43.camel@perches.com \
    --to=joe@perches.com \
    --cc=laurent@vivier.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=stefanr@s5r6.in-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox