lkml.org 
[lkml]   [2008]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] usb: file-storage.c use unaligned access helpers
On Thu, 15 May 2008, Harvey Harrison wrote:

> Replace the put_be16/32 and get_be16/32 helpers with the
> common unaligned access routines. Note that these put_ helpers
> had the pointer/value parameter in the opposite order from the
> common version.

This is fine and it's what I requested. Still, it's not really the
best solution.

In many of the places where these helpers are used, we _know_ that the
buffers are in fact aligned properly. For example, in code like this:

> - put_be16(&buf[4], 0xffff);
> + put_unaligned_be16(0xffff, &buf[4]);

we know that buf is aligned. It would be great if there were helpers
which would allow us to do

put_be16(&buf[4], 0xffff);

instead of

* (__be16 *) &buf[4] = cpu_to_be16(0xffff);

They could also be used to clean up the disputed HCD code. Is this a
reasonable thing to ask for? A few simple, arch-independent macros
would be sufficient.

Alan Stern



\
 
 \ /
  Last update: 2008-05-16 16:35    [W:0.056 / U:0.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site