Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/prg-localcount2]: src/sys At suggestion of chuq@, modify config_attach_p...
details: https://anonhg.NetBSD.org/src/rev/290b605235af
branches: prg-localcount2
changeset: 823545:290b605235af
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Wed May 17 01:44:16 2017 +0000
description:
At suggestion of chuq@, modify config_attach_pseudo() to return with a
reference held on the device.
Adapt callers to expect the reference to exist, and to ensure that the
reference is released.
diffstat:
sys/arch/atari/atari/autoconf.c | 9 ++++++---
sys/dev/ata/ata_raid.c | 8 +++++---
sys/dev/bluetooth/bcsp.c | 5 +++--
sys/dev/bluetooth/btuart.c | 5 +++--
sys/dev/cgd.c | 9 +++------
sys/dev/dkwedge/dk.c | 5 +++--
sys/dev/dm/dm_ioctl.c | 7 +++++--
sys/dev/fss.c | 5 ++---
sys/dev/gpio/gpiosim.c | 10 +++++++---
sys/dev/hpc/hpf1275a_tty.c | 5 +++--
sys/dev/ir/irframe_tty.c | 5 +++--
sys/dev/iscsi/iscsi_main.c | 8 ++++++--
sys/dev/md.c | 9 +++------
sys/dev/nand/nandemulator.c | 12 ++++++++----
sys/dev/pad/pad.c | 12 ++++++++----
sys/dev/raidframe/rf_netbsdkintf.c | 5 +++--
sys/dev/sysmon/swwdog.c | 5 +++--
sys/dev/vnd.c | 6 ++----
sys/kern/subr_autoconf.c | 11 +++++++++--
sys/modules/lua/lua.c | 6 ++++--
sys/net/if_etherip.c | 8 +++++---
sys/net/if_tap.c | 17 +++++++++++++----
sys/opencrypto/cryptodev.c | 8 +++++---
sys/opencrypto/cryptosoft.c | 8 +++++---
24 files changed, 117 insertions(+), 71 deletions(-)
diffs (truncated from 847 to 300 lines):
diff -r dca8bfb383cc -r 290b605235af sys/arch/atari/atari/autoconf.c
--- a/sys/arch/atari/atari/autoconf.c Wed May 17 01:42:17 2017 +0000
+++ b/sys/arch/atari/atari/autoconf.c Wed May 17 01:44:16 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.65.20.1 2017/04/27 05:36:32 pgoyette Exp $ */
+/* $NetBSD: autoconf.c,v 1.65.20.2 2017/05/17 01:44:16 pgoyette Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.65.20.1 2017/04/27 05:36:32 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.65.20.2 2017/05/17 01:44:16 pgoyette Exp $");
#include "opt_md.h"
@@ -82,6 +82,7 @@
void
cpu_rootconf(void)
{
+ device_t root;
findroot();
#if defined(MEMORY_DISK_HOOKS)
@@ -110,7 +111,9 @@
cf->cf_unit = i;
cf->cf_fstate = FSTATE_STAR;
/* XXX mutex */
- sc = device_private(config_attach_pseudo(cf));
+ root = config_attach_pseudo(cf));
+ sc = device_private(root);
+ device_release(root);
if (sc == NULL)
break; /* XXX */
}
diff -r dca8bfb383cc -r 290b605235af sys/dev/ata/ata_raid.c
--- a/sys/dev/ata/ata_raid.c Wed May 17 01:42:17 2017 +0000
+++ b/sys/dev/ata/ata_raid.c Wed May 17 01:44:16 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ata_raid.c,v 1.39 2016/09/27 08:05:34 pgoyette Exp $ */
+/* $NetBSD: ata_raid.c,v 1.39.6.1 2017/05/17 01:44:17 pgoyette Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata_raid.c,v 1.39 2016/09/27 08:05:34 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_raid.c,v 1.39.6.1 2017/05/17 01:44:17 pgoyette Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -155,6 +155,7 @@
static int
ata_raid_finalize(device_t self)
{
+ stgruct device_t dev;
static struct cfdata ataraid_cfdata = {
.cf_name = "ataraid",
.cf_atname = "ataraid",
@@ -172,9 +173,10 @@
if (TAILQ_EMPTY(&ataraid_array_info_list))
goto out;
- if (config_attach_pseudo(&ataraid_cfdata) == NULL)
+ if ((dev = config_attach_pseudo(&ataraid_cfdata)) == NULL)
printf("%s: unable to attach an instance\n",
ataraid_cd.cd_name);
+ device_release(dev);
out:
return (1);
diff -r dca8bfb383cc -r 290b605235af sys/dev/bluetooth/bcsp.c
--- a/sys/dev/bluetooth/bcsp.c Wed May 17 01:42:17 2017 +0000
+++ b/sys/dev/bluetooth/bcsp.c Wed May 17 01:44:16 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcsp.c,v 1.30 2016/08/15 08:20:11 maxv Exp $ */
+/* $NetBSD: bcsp.c,v 1.30.6.1 2017/05/17 01:44:17 pgoyette Exp $ */
/*
* Copyright (c) 2007 KIYOHARA Takashi
* All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcsp.c,v 1.30 2016/08/15 08:20:11 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcsp.c,v 1.30.6.1 2017/05/17 01:44:17 pgoyette Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -422,6 +422,7 @@
/* start link-establishment */
bcsp_start_le(sc);
+ device_release(dev);
return 0;
}
diff -r dca8bfb383cc -r 290b605235af sys/dev/bluetooth/btuart.c
--- a/sys/dev/bluetooth/btuart.c Wed May 17 01:42:17 2017 +0000
+++ b/sys/dev/bluetooth/btuart.c Wed May 17 01:44:16 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: btuart.c,v 1.28 2015/08/20 14:40:17 christos Exp $ */
+/* $NetBSD: btuart.c,v 1.28.8.1 2017/05/17 01:44:17 pgoyette Exp $ */
/*-
* Copyright (c) 2006, 2007 KIYOHARA Takashi
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btuart.c,v 1.28 2015/08/20 14:40:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btuart.c,v 1.28.8.1 2017/05/17 01:44:17 pgoyette Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -273,6 +273,7 @@
splx(s);
+ device_release(dev);
return 0;
}
diff -r dca8bfb383cc -r 290b605235af sys/dev/cgd.c
--- a/sys/dev/cgd.c Wed May 17 01:42:17 2017 +0000
+++ b/sys/dev/cgd.c Wed May 17 01:44:16 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.114.4.6 2017/04/29 10:50:46 pgoyette Exp $ */
+/* $NetBSD: cgd.c,v 1.114.4.7 2017/05/17 01:44:17 pgoyette Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.114.4.6 2017/04/29 10:50:46 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.114.4.7 2017/05/17 01:44:17 pgoyette Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -382,10 +382,7 @@
cf->cf_unit = unit;
cf->cf_fstate = FSTATE_STAR;
- if (config_attach_pseudo(cf) == NULL)
- return NULL;
-
- if ((*self = device_lookup_acquire(&cgd_cd, unit)) == NULL)
+ if ((*self = config_attach_pseudo(cf)) == NULL)
return NULL;
else {
/*
diff -r dca8bfb383cc -r 290b605235af sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c Wed May 17 01:42:17 2017 +0000
+++ b/sys/dev/dkwedge/dk.c Wed May 17 01:44:16 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dk.c,v 1.96.4.1 2017/04/27 05:36:35 pgoyette Exp $ */
+/* $NetBSD: dk.c,v 1.96.4.2 2017/05/17 01:44:17 pgoyette Exp $ */
/*-
* Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.96.4.1 2017/04/27 05:36:35 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.96.4.2 2017/05/17 01:44:17 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_dkwedge.h"
@@ -483,6 +483,7 @@
sc->sc_size, sc->sc_offset,
sc->sc_ptype[0] == '\0' ? "<unknown>" : sc->sc_ptype);
+ device_release(sc->sc_dev);
return (0);
}
diff -r dca8bfb383cc -r 290b605235af sys/dev/dm/dm_ioctl.c
--- a/sys/dev/dm/dm_ioctl.c Wed May 17 01:42:17 2017 +0000
+++ b/sys/dev/dm/dm_ioctl.c Wed May 17 01:44:16 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_ioctl.c,v 1.30 2015/05/10 14:08:54 christos Exp $ */
+/* $NetBSD: dm_ioctl.c,v 1.30.8.1 2017/05/17 01:44:17 pgoyette Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -226,8 +226,10 @@
aprint_error("Unable to attach pseudo device dm/%s\n", name);
return (ENOMEM);
}
- if ((dmv = dm_dev_alloc()) == NULL)
+ if ((dmv = dm_dev_alloc()) == NULL) {
+ device_release(devt);
return ENOMEM;
+ }
if (uuid)
strncpy(dmv->uuid, uuid, DM_UUID_LEN);
@@ -269,6 +271,7 @@
/* Increment device counter After creating device */
atomic_inc_32(&dm_dev_counter);
+ device_release(devt);
return r;
}
/*
diff -r dca8bfb383cc -r 290b605235af sys/dev/fss.c
--- a/sys/dev/fss.c Wed May 17 01:42:17 2017 +0000
+++ b/sys/dev/fss.c Wed May 17 01:44:16 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fss.c,v 1.97.4.3 2017/04/29 11:12:14 pgoyette Exp $ */
+/* $NetBSD: fss.c,v 1.97.4.4 2017/05/17 01:44:17 pgoyette Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.97.4.3 2017/04/29 11:12:14 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.97.4.4 2017/05/17 01:44:17 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -223,7 +223,6 @@
cf->cf_unit = minor(dev);
cf->cf_fstate = FSTATE_STAR;
self = config_attach_pseudo(cf);
- device_acquire(self);
sc = device_private(self);
if (sc == NULL) {
device_release(self);
diff -r dca8bfb383cc -r 290b605235af sys/dev/gpio/gpiosim.c
--- a/sys/dev/gpio/gpiosim.c Wed May 17 01:42:17 2017 +0000
+++ b/sys/dev/gpio/gpiosim.c Wed May 17 01:44:16 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpiosim.c,v 1.20 2017/01/20 12:25:07 maya Exp $ */
+/* $NetBSD: gpiosim.c,v 1.20.4.1 2017/05/17 01:44:17 pgoyette Exp $ */
/* $OpenBSD: gpiosim.c,v 1.1 2008/11/23 18:46:49 mbalmer Exp $ */
/*
@@ -68,6 +68,7 @@
void
gpiosimattach(int num __unused)
{
+ device_t dev;
cfdata_t cf;
int n, err;
@@ -81,7 +82,8 @@
cf->cf_atname = "gpiosim";
cf->cf_unit = n;
cf->cf_fstate = FSTATE_NOTFOUND;
- config_attach_pseudo(cf);
+ dev = config_attach_pseudo(cf);
+ device_release(dev);
}
}
@@ -249,6 +251,7 @@
gpiosim_modcmd(modcmd_t cmd, void *opaque)
{
#ifdef _MODULE
+ device_t dev;
int error = 0;
#endif
switch (cmd) {
@@ -275,7 +278,8 @@
gpiosim_cd.cd_name);
return error;
}
- config_attach_pseudo(gpiosim_cfdata);
+ dev = config_attach_pseudo(gpiosim_cfdata);
+ device_release(dev);
#endif
return 0;
case MODULE_CMD_FINI:
diff -r dca8bfb383cc -r 290b605235af sys/dev/hpc/hpf1275a_tty.c
--- a/sys/dev/hpc/hpf1275a_tty.c Wed May 17 01:42:17 2017 +0000
+++ b/sys/dev/hpc/hpf1275a_tty.c Wed May 17 01:44:16 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hpf1275a_tty.c,v 1.27 2013/06/28 14:44:15 christos Exp $ */
+/* $NetBSD: hpf1275a_tty.c,v 1.27.24.1 2017/05/17 01:44:17 pgoyette Exp $ */
/*
* Copyright (c) 2004 Valeriy E. Ushakov
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpf1275a_tty.c,v 1.27 2013/06/28 14:44:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpf1275a_tty.c,v 1.27.24.1 2017/05/17 01:44:17 pgoyette Exp $");
#include "opt_wsdisplay_compat.h"
Home |
Main Index |
Thread Index |
Old Index