]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commit
ide: re-code ide_fixstring() loop to be less evil
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 10 Oct 2008 20:39:22 +0000 (22:39 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 10 Oct 2008 20:39:22 +0000 (22:39 +0200)
commit1a7809e3499921a016d203b9ee51a77d3cc1dc98
tree5b9186f201cb85565f9f85c0bd1e8679bb204645
parent3c619ffd48d7fdb3b17f0df67c4eb4b0bd80e253
ide: re-code ide_fixstring() loop to be less evil

On Friday 25 July 2008, Linus Torvalds wrote:
>
> On Fri, 25 Jul 2008, Ben Dooks wrote:
> >
> > personally, i would much prefer to see the loop being less evil
> > like:
> >
> >  for (p = s; p < end; p += 2)
> >  be16_to_cpus((u16 *)p);
>
> Well, in this case, the code actually depends on 'p' being back at the
> start of the buffer by the end of it all, so it would need some more
> changes than that.
>
> But yes, I applied David's patch, but I _also_ suspect that we would be
> better off without code that does horrid things like casts and assignments
> inside the function arguments.
>
> So it would be nice to re-code that loop to be more readable. But due to
> the reliance of 'p' being 's' after the loop, the minimal patch would be
> something like the appended.
>
> Bartlomiej - take this or not, I'm not going to commit it - I haven't
> tested it, nor do I even have any machines that would trigger it. So this
> is more a "maybe something like this" than anything else.

From: Linus Torvalds <torvalds@linux-foundation.org>
CC: Ben Dooks <ben-linux@fluff.org>
Cc: David Miller <davem@davemloft.net>
Cc: harvey.harrison@gmail.com
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-iops.c