From: Mark Lord <liml@rtr.ca>
To: Ben Collins <ben.collins@ubuntu.com>
Cc: linux-kernel@vger.kernel.org, alan@lxorguk.ukuu.org.uk,
Kyle McMartin <kyle@ubuntu.com>,
linux-ide@vger.kernel.org
Subject: Re: [PATCH] Cleanup libata HPA support
Date: Tue, 08 May 2007 09:44:52 -0400 [thread overview]
Message-ID: <46407ED4.9090301@rtr.ca> (raw)
In-Reply-To: <1178621978.6962.75.camel@cunning>
Ben Collins wrote:
..
> static u64 ata_tf_to_lba48(struct ata_taskfile *tf)
> {
> - u64 sectors = 0;
> + u64 sectors;
> + u32 high, low;
>
> - sectors |= ((u64)(tf->hob_lbah & 0xff)) << 40;
> - sectors |= ((u64)(tf->hob_lbam & 0xff)) << 32;
> - sectors |= (tf->hob_lbal & 0xff) << 24;
> - sectors |= (tf->lbah & 0xff) << 16;
> - sectors |= (tf->lbam & 0xff) << 8;
> - sectors |= (tf->lbal & 0xff);
> + high = (tf->hob_lbah << 16) |
> + (tf->hob_lbam << 8) |
> + tf->hob_lbal;
> + low = (tf->lbah << 16) |
> + (tf->lbam << 8) |
> + tf->lbal;
>
> - return ++sectors;
> + sectors = ((u64)high << 24) | low;
> +
> + return sectors + 1;
> }
Ben, I very much prefer the fixed version of this function
as implemented by the patch above.
But.. is the original code actually broken, or just messy?
Cheers
next prev parent reply other threads:[~2007-05-08 13:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-08 10:59 [PATCH] Cleanup libata HPA support Ben Collins
2007-05-08 13:44 ` Mark Lord [this message]
2007-05-08 14:43 ` Ben Collins
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=46407ED4.9090301@rtr.ca \
--to=liml@rtr.ca \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=ben.collins@ubuntu.com \
--cc=kyle@ubuntu.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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).