Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/dev/onewire



On Sun Sep 02 2007 at 13:16:18 +0200, Juan RP wrote:
> On Sun, 2 Sep 2007 12:33:18 +0300
> Antti Kantee <pooka%cs.hut.fi@localhost> wrote:
> 
> > You changed the return value of onewire_lock, now 0 is both for success
> > and failure.
> 
> But rw_enter() will always succeed, isn't it? I'm returning the
> value of rw_tryenter() when ONEWIRE_NOWAIT is specified in flags.
> 
> The only thing I can suggest is to change this func to return void and
> don't use rw_tryenter(). owtemp(4) is using onewire_lock() without
> paying attention to the return value anyway...

Anything is good as long as you don't make the interpretation of the
return value (if it exists) depend on the parameters.

> > Also, is there some reason for using a reader/writer lock when it's
> > always locked exclusively?
> 
> I used an exclusive rwlock to respect previous behavior.
> Are you suggesting to change it?

That can be debated (but let's not).  IMHO you changed the "behaviour"
when you made it a rwlock from something which used only LK_EXCLUSIVE.
Not that it matters much ... Still, I'd expect a mutex to be cheaper.

-- 
Antti Kantee <pooka%iki.fi@localhost>                     Of course he runs 
NetBSD
http://www.iki.fi/pooka/                          http://www.NetBSD.org/
    "la qualité la plus indispensable du cuisinier est l'exactitude"



Home | Main Index | Thread Index | Old Index