Create per-instance sysctl nodes for ath(4), e.g., hw.ath0.debug,

hw.ath1.debug.
This commit is contained in:
dyoung 2005-07-03 19:44:50 +00:00
parent 3ba3e0571b
commit f069ffb8c5
2 changed files with 31 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ath.c,v 1.51 2005/07/03 19:42:10 dyoung Exp $ */
/* $NetBSD: ath.c,v 1.52 2005/07/03 19:44:50 dyoung Exp $ */
/*-
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@ -41,7 +41,7 @@
__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.88 2005/04/12 17:56:43 sam Exp $");
#endif
#ifdef __NetBSD__
__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.51 2005/07/03 19:42:10 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.52 2005/07/03 19:44:50 dyoung Exp $");
#endif
/*
@ -683,6 +683,7 @@ ath_detach(struct ath_softc *sc)
ath_rate_detach(sc->sc_rc);
ath_desc_free(sc);
ath_tx_cleanup(sc);
sysctl_teardown(&sc->sc_sysctllog);
ath_hal_detach(sc->sc_ah);
if_detach(ifp);
splx(s);

View File

@ -54,6 +54,9 @@
#include <dev/ic/ath_netbsd.h>
#include <dev/ic/athvar.h>
static const struct sysctlnode *ath_sysctl_instance(const char *,
struct sysctllog **);
void
device_printf(struct device dv, const char *fmt, ...)
{
@ -309,6 +312,29 @@ ath_sysctl_tpc(SYSCTLFN_ARGS)
return !ath_hal_settpc(sc->sc_ah, tpc) ? EINVAL : 0;
}
static const struct sysctlnode *
ath_sysctl_instance(const char *dvname, struct sysctllog **log)
{
int rc;
const struct sysctlnode *rnode;
if ((rc = sysctl_createv(log, 0, NULL, &rnode,
CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw", NULL,
NULL, 0, NULL, 0, CTL_HW, CTL_EOL)) != 0)
goto err;
if ((rc = sysctl_createv(log, 0, &rnode, &rnode,
CTLFLAG_PERMANENT, CTLTYPE_NODE, dvname,
SYSCTL_DESCR("ath information and options"),
NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL)) != 0)
goto err;
return rnode;
err:
printf("%s: sysctl_createv failed, rc = %d\n", __func__, rc);
return NULL;
}
const struct sysctlnode *
ath_sysctl_treetop(struct sysctllog **log)
{
@ -344,7 +370,7 @@ ath_sysctlattach(struct ath_softc *sc)
sc->sc_debug = ath_debug;
sc->sc_txintrperiod = ATH_TXINTR_PERIOD;
if ((rnode = ath_sysctl_treetop(NULL)) == NULL)
if ((rnode = ath_sysctl_instance(sc->sc_dev.dv_xname, log)) == NULL)
return;
if ((rc = SYSCTL_INT(0, countrycode, "EEPROM country code")) != 0)