diff options
-rw-r--r-- | sys/dev/rd.c | 4 | ||||
-rw-r--r-- | sys/kern/subr_autoconf.c | 8 | ||||
-rw-r--r-- | sys/sys/device.h | 5 |
3 files changed, 8 insertions, 9 deletions
diff --git a/sys/dev/rd.c b/sys/dev/rd.c index 4d50a123196..8ddd5ff0264 100644 --- a/sys/dev/rd.c +++ b/sys/dev/rd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rd.c,v 1.11 2015/09/11 20:25:32 dlg Exp $ */ +/* $OpenBSD: rd.c,v 1.12 2015/09/11 20:43:23 dlg Exp $ */ /* * Copyright (c) 2011 Matthew Dempsky <matthew@dempsky.org> @@ -104,7 +104,7 @@ rdattach(int num) if (snprintf(sc->sc_dev.dv_xname, sizeof(sc->sc_dev.dv_xname), "rd%d", i) >= sizeof(sc->sc_dev.dv_xname)) panic("rdattach: device name too long"); - refcnt_init(&sc->sc_dev.dv_ref); + sc->sc_dev.dv_ref = 1; /* Attach it to the device tree. */ rd_cd.cd_devs[i] = sc; 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); } diff --git a/sys/sys/device.h b/sys/sys/device.h index 4605c7ff060..00af29f9ed1 100644 --- a/sys/sys/device.h +++ b/sys/sys/device.h @@ -1,4 +1,4 @@ -/* $OpenBSD: device.h,v 1.52 2015/09/11 19:14:51 dlg Exp $ */ +/* $OpenBSD: device.h,v 1.53 2015/09/11 20:43:23 dlg Exp $ */ /* $NetBSD: device.h,v 1.15 1996/04/09 20:55:24 cgd Exp $ */ /* @@ -45,7 +45,6 @@ #define _SYS_DEVICE_H_ #include <sys/queue.h> -#include <sys/refcnt.h> /* * Minimal device structures. @@ -78,7 +77,7 @@ struct device { char dv_xname[16]; /* external name (name + unit) */ struct device *dv_parent; /* pointer to parent device */ int dv_flags; /* misc. flags; see below */ - struct refcnt dv_ref; /* ref count */ + int dv_ref; /* ref count */ }; /* dv_flags */ |