From 9453ba85ac547904606060e42f9d41d54bbeac73 Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Fri, 11 Sep 2015 20:43:24 +0000 Subject: back out refcnt for dv_ref, there's too many hand crafted devices all over the tree. much encouragement from l2k15 --- sys/kern/subr_autoconf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/kern/subr_autoconf.c') 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); } -- cgit v1.2.3