From: Ben Dooks <ben-linux@fluff.org>
To: David Miller <davem@davemloft.net>
Cc: ben-linux@fluff.org, bzolnier@gmail.com,
harvey.harrison@gmail.com, linux-ide@kernel.org,
linux-kernel@vger.kernel.org, torvalds@linux-foundation.org
Subject: Re: recent IDE regression
Date: Fri, 25 Jul 2008 09:46:07 +0100 [thread overview]
Message-ID: <20080725084607.GQ26938@trinity.fluff.org> (raw)
In-Reply-To: <20080725.014252.193706389.davem@davemloft.net>
On Fri, Jul 25, 2008 at 01:42:52AM -0700, David Miller wrote:
> From: Ben Dooks <ben-linux@fluff.org>
> Date: Fri, 25 Jul 2008 09:34:48 +0100
>
> > On Thu, Jul 24, 2008 at 11:38:31PM -0700, David Miller wrote:
> > > diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
> > > index 07da5fb..8aae917 100644
> > > --- a/drivers/ide/ide-iops.c
> > > +++ b/drivers/ide/ide-iops.c
> > > @@ -510,10 +510,8 @@ void ide_fixstring (u8 *s, const int bytecount, const int byteswap)
> > >
> > > if (byteswap) {
> > > /* convert from big-endian to host byte order */
> > > - for (p = end ; p != s;) {
> > > - unsigned short *pp = (unsigned short *) (p -= 2);
> > > - *pp = ntohs(*pp);
> > > - }
> > > + for (p = end ; p != s;)
> > > + be16_to_cpus((u16 *)(p -= 2));
> >
> > 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);
> >
> > is there an architecture/compiler combo which really makes this
> > evil worthwile? on arm (gcc 4.2), both evaluate to the same number of
> > instructions.
>
> Regardless of what we want to do with this ugly loop, the endianness
> macros should be fixed to consistently evaluate their arguments
> once just like real function calls do.
Yes, I wasn't saying the macro fixes are not worthwile. I would also
like to see the loop being fixed to not perpetrate this nasty code
any further.
--
Ben
Q: What's a light-year?
A: One-third less calories than a regular year.
next prev parent reply other threads:[~2008-07-25 8:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-25 6:38 recent IDE regression David Miller
2008-07-25 8:34 ` Ben Dooks
2008-07-25 8:42 ` David Miller
2008-07-25 8:46 ` Ben Dooks [this message]
2008-07-25 16:37 ` Linus Torvalds
2008-07-25 22:17 ` Ben Dooks
2008-07-26 12:13 ` Bartlomiej Zolnierkiewicz
2008-07-26 12:04 ` Bartlomiej Zolnierkiewicz
2008-07-27 0:31 ` David Miller
2008-07-27 13:48 ` Bartlomiej Zolnierkiewicz
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=20080725084607.GQ26938@trinity.fluff.org \
--to=ben-linux@fluff.org \
--cc=bzolnier@gmail.com \
--cc=davem@davemloft.net \
--cc=harvey.harrison@gmail.com \
--cc=linux-ide@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).