lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Mon, 25 Jan 2010 20:34:40 -0500
From:	James Kosin <james.kosin.04@....edu>
To:	Joe Perches <joe@...ches.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 23/24] drivers/block/floppy.c: Add function is_ready_state

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@...ches.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 */
>
>
>    
   Sorry,

That probably should have been:
         return ((status & STATUS_READY) == STATUS_READY);

James
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ