lkml.org 
[lkml]   [2008]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH try#2] [MTD/MAPS] Blackfin BF5xx Maps: Handle the case where flash memory and ethernet mac/phy are mapped onto the same async bank
    On Mon, May 12, 2008 at 8:26 AM, Jörn Engel <joern@logfs.org> wrote:
    > On Sun, 3 February 2008 14:32:35 +0800, Bryan Wu wrote:
    >> +static void bf5xx_copy_from(struct map_info *map, void *to,
    unsigned long from, ssize_t len)
    >> +{
    >> + unsigned long i;
    >> + map_word test;
    >> +
    >> + if ((unsigned long)to & 0x1) {
    >> + for (i = 0; i < len / 2 * 2; i += 2) {
    >> + test = bf5xx_read(map, from + i);
    >> + put_unaligned(test.x[0], (__le16 *)(to + i));
    >> + }
    >> + } else {
    >> + for (i = 0; i < len / 2 * 2; i += 2) {
    >> + test = bf5xx_read(map, from + i);
    >> + *((u16*)(to + i)) = test.x[0];
    > ^^^^^^^^^^^^^^^^^
    >
    > I'm not particularly fond of such constructs, maybe because I have such
    > a hard time understanding what the code actually does.
    >
    > How about:
    > u16 *foo = to;
    >
    > for (i = 0; i < (len & ~1); i++) {
    > test = bf5xx_read(map, from + 2 * i);
    > foo[i] = test.x[0];
    > }
    >
    > With perhaps a better name than "foo" and the same conversion in the
    > rest of the function as well?

    indeed. Bryan: i can take care of this as there's a few other pieces
    i want to fiddle first (like getting rid of "bf5xx")
    -mike
    --
    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/

    \
     
     \ /
      Last update: 2008-05-12 14:51    [W:0.022 / U:70.972 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site