linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison@gmail.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	linux-ide <linux-ide@vger.kernel.org>
Subject: Re: [PATCH] ide: endian annotations in ide-floppy.c
Date: Wed, 18 Jun 2008 17:01:29 -0700	[thread overview]
Message-ID: <1213833689.2125.31.camel@brick> (raw)
In-Reply-To: <20080618233437.GO28946@ZenIV.linux.org.uk>

On Thu, 2008-06-19 at 00:34 +0100, Al Viro wrote:
> On Wed, Jun 18, 2008 at 03:57:35PM -0700, Harvey Harrison wrote:
> > Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> > ---
> >  drivers/ide/ide-floppy.c |   16 ++++++++--------
> >  1 files changed, 8 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
> > index f05fbc2..cba39fa 100644
> > --- a/drivers/ide/ide-floppy.c
> > +++ b/drivers/ide/ide-floppy.c
> > @@ -921,10 +921,10 @@ static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive)
> >  	set_disk_ro(floppy->disk, floppy->wp);
> >  	page = &pc.buf[8];
> >  
> > -	transfer_rate = be16_to_cpu(*(u16 *)&pc.buf[8 + 2]);
> > -	sector_size   = be16_to_cpu(*(u16 *)&pc.buf[8 + 6]);
> > -	cyls          = be16_to_cpu(*(u16 *)&pc.buf[8 + 8]);
> > -	rpm           = be16_to_cpu(*(u16 *)&pc.buf[8 + 28]);
> > +	transfer_rate = be16_to_cpup((__be16 *)&pc.buf[8 + 2]);
> > +	sector_size   = be16_to_cpup((__be16 *)&pc.buf[8 + 6]);
> > +	cyls          = be16_to_cpup((__be16 *)&pc.buf[8 + 8]);
> > +	rpm           = be16_to_cpup((__be16 *)&pc.buf[8 + 28]);
> 
> Pointless, IMO - just s/u16/__be16/ in the above.

The (admittedly) small reason I did it this way is that some arches do
have a more efficient pointer version.  Not that they use this code, but
in principle that's why I used the pointer version.

Cheers,

Harvey



  reply	other threads:[~2008-06-19  0:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-18 22:57 [PATCH] ide: endian annotations in ide-floppy.c Harvey Harrison
2008-06-18 23:34 ` Al Viro
2008-06-19  0:01   ` Harvey Harrison [this message]
2008-06-19 19:49     ` 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=1213833689.2125.31.camel@brick \
    --to=harvey.harrison@gmail.com \
    --cc=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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).