lkml.org 
[lkml]   [2015]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/2] firewire: firewire is a big-endian bus
From
Date
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?




\
 
 \ /
  Last update: 2015-04-21 03:41    [W:0.073 / U:6.196 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site