onewire_lock: remove the flags argument and change the return type to void.

This function is not expected to return an int, because rw_enter() will
always succeed.
This commit is contained in:
xtraeme 2007-09-05 15:24:07 +00:00
parent c5c7ad7f7c
commit f5ad59004f
3 changed files with 12 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: onewire.c,v 1.6 2007/09/02 00:55:33 xtraeme Exp $ */
/* $NetBSD: onewire.c,v 1.7 2007/09/05 15:24:07 xtraeme Exp $ */
/* $OpenBSD: onewire.c,v 1.1 2006/03/04 16:27:03 grange Exp $ */
/*
@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: onewire.c,v 1.6 2007/09/02 00:55:33 xtraeme Exp $");
__KERNEL_RCSID(0, "$NetBSD: onewire.c,v 1.7 2007/09/05 15:24:07 xtraeme Exp $");
/*
* 1-Wire bus driver.
@ -122,7 +122,7 @@ onewire_detach(struct device *self, int flags)
tsleep(&sc->sc_dying, PWAIT, "owdt", 0);
}
onewire_lock(sc, 0);
onewire_lock(sc);
//rv = config_detach_children(self, flags);
rv = 0; /* XXX riz */
onewire_unlock(sc);
@ -182,16 +182,12 @@ onewirebus_print(void *aux, const char *pnp)
return UNCONF;
}
int
onewire_lock(void *arg, int flags)
void
onewire_lock(void *arg)
{
struct onewire_softc *sc = arg;
if (flags & ONEWIRE_NOWAIT)
return rw_tryenter(&sc->sc_rwlock, RW_WRITER);
rw_enter(&sc->sc_rwlock, RW_WRITER);
return 0;
}
void
@ -344,7 +340,7 @@ onewire_scan(struct onewire_softc *sc)
* Reset the bus. If there's no presence pulse
* don't search for any devices.
*/
onewire_lock(sc, 0);
onewire_lock(sc);
if (onewire_reset(sc) != 0) {
DPRINTF(("%s: scan: no presence pulse\n",
sc->sc_dev.dv_xname));
@ -441,7 +437,7 @@ onewire_scan(struct onewire_softc *sc)
}
/* Detach disappeared devices */
onewire_lock(sc, 0);
onewire_lock(sc);
for (d = TAILQ_FIRST(&sc->sc_devs);
d != NULL; d = next) {
next = TAILQ_NEXT(d, d_list);

View File

@ -1,4 +1,4 @@
/* $NetBSD: onewirevar.h,v 1.3 2006/04/14 18:38:50 riz Exp $ */
/* $NetBSD: onewirevar.h,v 1.4 2007/09/05 15:24:07 xtraeme Exp $ */
/* $OpenBSD: onewirevar.h,v 1.1 2006/03/04 16:27:03 grange Exp $ */
/*
@ -36,7 +36,7 @@ struct onewire_bus {
};
/* Bus methods */
int onewire_lock(void *, int);
void onewire_lock(void *);
void onewire_unlock(void *);
int onewire_reset(void *);
int onewire_bit(void *, int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: owtemp.c,v 1.10 2007/07/13 00:27:47 xtraeme Exp $ */
/* $NetBSD: owtemp.c,v 1.11 2007/09/05 15:24:07 xtraeme Exp $ */
/* $OpenBSD: owtemp.c,v 1.1 2006/03/04 16:27:03 grange Exp $ */
/*
@ -22,7 +22,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: owtemp.c,v 1.10 2007/07/13 00:27:47 xtraeme Exp $");
__KERNEL_RCSID(0, "$NetBSD: owtemp.c,v 1.11 2007/09/05 15:24:07 xtraeme Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -155,7 +155,7 @@ owtemp_update(void *arg)
struct owtemp_softc *sc = arg;
u_int8_t data[9];
onewire_lock(sc->sc_onewire, 0);
onewire_lock(sc->sc_onewire);
if (onewire_reset(sc->sc_onewire) != 0)
goto done;
onewire_matchrom(sc->sc_onewire, sc->sc_rom);