From: Nick Bowler <nbowler@elliptictech.com>
To: James Kosin <james.kosin.04@cnu.edu>
Cc: Joe Perches <joe@perches.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 23/24] drivers/block/floppy.c: Add function is_ready_state
Date: Tue, 26 Jan 2010 10:06:09 -0500 [thread overview]
Message-ID: <20100126150609.GA24349@emergent.ellipticsemi.com> (raw)
In-Reply-To: <4B5E44DD.9090305@cnu.edu>
On 20:26 Mon 25 Jan , James Kosin wrote:
> On 1/23/2010 3:46 PM, Joe Perches wrote:
> > On Sat, 2010-01-23 at 12:32 -0500, James Kosin wrote:
> >
> >> On 1/22/2010 12:00 AM, Joe Perches wrote:
> >>
> >>> +static bool is_ready_state(int status)
> >>> +{
> >>> + int state = status& (STATUS_READY | STATUS_DIR | STATUS_DMA);
> >>> + return state == STATUS_READY;
> >>> +}
> >>> +
> >>>
> >> This should probably be simplified to:
> >>
> >> static bool is_ready_state(int status)
> >> {
> >> return ((state& STATUS_READY) == STATUS_READY);
> >> }
> >>
> > Certainly not.
> > That wouldn't be the same code.
> >
> > include/linux/fdreg.h:#define STATUS_DMA 0x20 /* 0- DMA mode */
> > include/linux/fdreg.h:#define STATUS_DIR 0x40 /* 0- cpu->fdc */
> > include/linux/fdreg.h:#define STATUS_READY 0x80 /* Data reg ready */
> >
> Read the code....
>
> It simplifies what is already there. The two other status flags make no
> difference in the test for equality with STATUS_READY.
Sure they do: the old code tests that the STATUS_READY is set and
both STATUS_DMA and STATUS_DIR bits are clear. So, for example, if
STATUS_READY and STATUS_DMA are both set, then the old test will return
false.
Your "simplification" has removed the check for those clear bits, and
will return true even if all three bits are set.
--
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)
next prev parent reply other threads:[~2010-01-26 15:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <e5jMK-25X-3@gated-at.bofh.it>
[not found] ` <e5jMM-25X-51@gated-at.bofh.it>
2010-01-23 17:32 ` James Kosin
[not found] ` <1264279618.30778.34.camel@Joe-Laptop.home>
2010-01-26 1:26 ` James Kosin
2010-01-26 15:06 ` Nick Bowler [this message]
2010-01-26 1:34 ` James Kosin
2010-01-22 4:52 [PATCH 00/24] drivers/block/floppy.c cleanups Joe Perches
2010-01-22 4:52 ` [PATCH 23/24] drivers/block/floppy.c: Add function is_ready_state Joe Perches
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=20100126150609.GA24349@emergent.ellipticsemi.com \
--to=nbowler@elliptictech.com \
--cc=james.kosin.04@cnu.edu \
--cc=joe@perches.com \
--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
all inboxes | Powered by JetHome®