diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-01-02 05:27:13 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-01-02 05:27:13 +0000 |
commit | 3d0befc022847e3380a0cca5a2e5af5a3758ed83 (patch) | |
tree | 36fe64a702de96fb074e908589eb2f3e64a6aca7 /sys/dev/onewire | |
parent | 5b37de33cc86ef68c740c43e807bb02de820f715 (diff) |
Remember the id of all devices found, not only those for which a driver
has attached. Prevents spurious "not configured" messages at every bus
rescan.
Prodded by and ok fries@
Diffstat (limited to 'sys/dev/onewire')
-rw-r--r-- | sys/dev/onewire/onewire.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/dev/onewire/onewire.c b/sys/dev/onewire/onewire.c index fee3c266e83..7b35c9f357c 100644 --- a/sys/dev/onewire/onewire.c +++ b/sys/dev/onewire/onewire.c @@ -1,4 +1,4 @@ -/* $OpenBSD: onewire.c,v 1.9 2008/04/07 22:50:41 miod Exp $ */ +/* $OpenBSD: onewire.c,v 1.10 2009/01/02 05:27:12 miod Exp $ */ /* * Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org> @@ -57,7 +57,7 @@ struct onewire_softc { struct onewire_device { TAILQ_ENTRY(onewire_device) d_list; - struct device * d_dev; + struct device * d_dev; /* may be NULL */ u_int64_t d_rom; int d_present; }; @@ -472,17 +472,16 @@ onewire_scan(struct onewire_softc *sc) } } if (!present) { - bzero(&oa, sizeof(oa)); - oa.oa_onewire = sc; - oa.oa_rom = rom; - if ((dev = config_found(&sc->sc_dev, &oa, - onewire_print)) == NULL) - continue; - nd = malloc(sizeof(struct onewire_device), M_DEVBUF, M_NOWAIT); if (nd == NULL) continue; + + bzero(&oa, sizeof(oa)); + oa.oa_onewire = sc; + oa.oa_rom = rom; + dev = config_found(&sc->sc_dev, &oa, onewire_print); + nd->d_dev = dev; nd->d_rom = rom; nd->d_present = 1; @@ -496,7 +495,8 @@ out: d != TAILQ_END(&sc->sc_dev); d = next) { next = TAILQ_NEXT(d, d_list); if (!d->d_present) { - config_detach(d->d_dev, DETACH_FORCE); + if (d->d_dev != NULL) + config_detach(d->d_dev, DETACH_FORCE); TAILQ_REMOVE(&sc->sc_devs, d, d_list); free(d, M_DEVBUF); } |