summaryrefslogtreecommitdiff
path: root/sys/kern/subr_autoconf.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2015-09-11 20:43:24 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2015-09-11 20:43:24 +0000
commit9453ba85ac547904606060e42f9d41d54bbeac73 (patch)
treee18a05b4bd2fab51a05b5d22f9fd774acb6ec13a /sys/kern/subr_autoconf.c
parentc8c3b896f7ff45f8a3f93fe3c4fd1621656b3278 (diff)
back out refcnt for dv_ref, there's too many hand crafted devices all
over the tree. much encouragement from l2k15
Diffstat (limited to 'sys/kern/subr_autoconf.c')
-rw-r--r--sys/kern/subr_autoconf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c
index 3e81f93c94e..bb6041b34b3 100644
--- a/sys/kern/subr_autoconf.c
+++ b/sys/kern/subr_autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_autoconf.c,v 1.88 2015/09/11 19:14:51 dlg Exp $ */
+/* $OpenBSD: subr_autoconf.c,v 1.89 2015/09/11 20:43:23 dlg Exp $ */
/* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */
/*
@@ -475,7 +475,7 @@ config_make_softc(struct device *parent, struct cfdata *cf)
if (cd->cd_devs[dev->dv_unit])
panic("config_make_softc: duplicate %s", dev->dv_xname);
- refcnt_init(&dev->dv_ref);
+ dev->dv_ref = 1;
return (dev);
}
@@ -922,7 +922,7 @@ device_mpath(void)
void
device_ref(struct device *dv)
{
- refcnt_take(&dv->dv_ref);
+ atomic_inc_int(&dv->dv_ref);
}
/*
@@ -937,7 +937,7 @@ device_unref(struct device *dv)
{
struct cfattach *ca;
- if (refcnt_rele(&dv->dv_ref)) {
+ if (atomic_dec_int_nv(&dv->dv_ref) == 0) {
ca = dv->dv_cfdata->cf_attach;
free(dv, M_DEVBUF, ca->ca_devsize);
}