From: James Kosin <james.kosin.04@cnu.edu>
To: 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: Mon, 25 Jan 2010 20:26:53 -0500 [thread overview]
Message-ID: <4B5E44DD.9090305@cnu.edu> (raw)
In-Reply-To: <1264279618.30778.34.camel@Joe-Laptop.home>
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:
>>
>>> Used a couple of times, might simplify the code a bit.
>>>
>>> Signed-off-by: Joe Perches<joe@perches.com>
>>> ---
>>> drivers/block/floppy.c | 19 +++++++++++++++----
>>> 1 files changed, 15 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
>>> index 2f6ed78..fd56b26 100644
>>> --- a/drivers/block/floppy.c
>>> +++ b/drivers/block/floppy.c
>>> @@ -782,6 +782,12 @@ static inline int is_selected(int dor, int unit)
>>> return ((dor& (0x10<< unit))&& (dor& 3) == unit);
>>> }
>>>
>>> +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.
James
next prev parent reply other threads:[~2010-01-26 1:26 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 ` [PATCH 23/24] drivers/block/floppy.c: Add function is_ready_state James Kosin
[not found] ` <1264279618.30778.34.camel@Joe-Laptop.home>
2010-01-26 1:26 ` James Kosin [this message]
2010-01-26 15:06 ` Nick Bowler
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=4B5E44DD.9090305@cnu.edu \
--to=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