1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

sound: Remove CTLFLAG_NEEDGIANT from some sysctls.

While there, remove some dead code.

MFC after:	2 weeks
This commit is contained in:
Alexander Motin 2021-12-26 20:37:55 -05:00
parent 0fa074b53e
commit 3b4c543322
7 changed files with 16 additions and 115 deletions

View File

@ -99,71 +99,6 @@ struct snd_clone {
#define SND_CLONE_ASSERT(...) KASSERT(__VA_ARGS__)
#endif
/*
* Shamelessly ripped off from vfs_subr.c
* We need at least 1/HZ precision as default timestamping.
*/
enum { SND_TSP_SEC, SND_TSP_HZ, SND_TSP_USEC, SND_TSP_NSEC };
static int snd_timestamp_precision = SND_TSP_HZ;
TUNABLE_INT("hw.snd.timestamp_precision", &snd_timestamp_precision);
void
snd_timestamp(struct timespec *tsp)
{
struct timeval tv;
switch (snd_timestamp_precision) {
case SND_TSP_SEC:
tsp->tv_sec = time_second;
tsp->tv_nsec = 0;
break;
case SND_TSP_HZ:
getnanouptime(tsp);
break;
case SND_TSP_USEC:
microuptime(&tv);
TIMEVAL_TO_TIMESPEC(&tv, tsp);
break;
case SND_TSP_NSEC:
nanouptime(tsp);
break;
default:
snd_timestamp_precision = SND_TSP_HZ;
getnanouptime(tsp);
break;
}
}
#if defined(SND_DIAGNOSTIC) || defined(SND_DEBUG)
static int
sysctl_hw_snd_timestamp_precision(SYSCTL_HANDLER_ARGS)
{
int err, val;
val = snd_timestamp_precision;
err = sysctl_handle_int(oidp, &val, 0, req);
if (err == 0 && req->newptr != NULL) {
switch (val) {
case SND_TSP_SEC:
case SND_TSP_HZ:
case SND_TSP_USEC:
case SND_TSP_NSEC:
snd_timestamp_precision = val;
break;
default:
break;
}
}
return (err);
}
SYSCTL_PROC(_hw_snd, OID_AUTO, timestamp_precision,
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, 0, sizeof(int),
sysctl_hw_snd_timestamp_precision, "I",
"timestamp precision (0=s 1=hz 2=us 3=ns)");
#endif
/*
* snd_clone_create() : Return opaque allocated clone manager.
*/
@ -189,7 +124,7 @@ snd_clone_create(int typemask, int maxunit, int deadline, uint32_t flags)
maxunit;
c->deadline = deadline;
c->flags = flags;
snd_timestamp(&c->tsp);
getnanouptime(&c->tsp);
TAILQ_INIT(&c->head);
return (c);
@ -296,17 +231,6 @@ snd_clone_setdeadline(struct snd_clone *c, int deadline)
return (c->deadline);
}
int
snd_clone_gettime(struct snd_clone *c, struct timespec *tsp)
{
SND_CLONE_ASSERT(c != NULL, ("NULL snd_clone"));
SND_CLONE_ASSERT(tsp != NULL, ("NULL timespec"));
*tsp = c->tsp;
return (0);
}
uint32_t
snd_clone_getflags(struct snd_clone *c)
{
@ -327,25 +251,6 @@ snd_clone_setflags(struct snd_clone *c, uint32_t flags)
return (c->flags);
}
int
snd_clone_getdevtime(struct cdev *dev, struct timespec *tsp)
{
struct snd_clone_entry *ce;
SND_CLONE_ASSERT(dev != NULL, ("NULL dev"));
SND_CLONE_ASSERT(tsp != NULL, ("NULL timespec"));
ce = dev->si_drv2;
if (ce == NULL)
return (ENODEV);
SND_CLONE_ASSERT(ce->parent != NULL, ("NULL parent"));
*tsp = ce->tsp;
return (0);
}
uint32_t
snd_clone_getdevflags(struct cdev *dev)
{
@ -411,7 +316,7 @@ snd_clone_gc(struct snd_clone *c)
if (!(c->flags & SND_CLONE_GC_ENABLE) || c->size == 0)
return (0);
snd_timestamp(&now);
getnanouptime(&now);
/*
* Bail out if the last clone handler was invoked below the deadline
@ -642,7 +547,7 @@ snd_clone_alloc(struct snd_clone *c, struct cdev **dev, int *unit, int tmask)
allocunit = (*unit == -1) ? 0 : *unit;
curpid = curthread->td_proc->p_pid;
snd_timestamp(&now);
getnanouptime(&now);
TAILQ_FOREACH(ce, &c->head, link) {
/*

View File

@ -99,8 +99,6 @@ struct snd_clone;
#define SND_CLONE_DEVMASK SND_CLONE_ALLOC
void snd_timestamp(struct timespec *);
struct snd_clone *snd_clone_create(int, int, int, uint32_t);
int snd_clone_busy(struct snd_clone *);
int snd_clone_enable(struct snd_clone *);
@ -110,10 +108,8 @@ int snd_clone_getmaxunit(struct snd_clone *);
int snd_clone_setmaxunit(struct snd_clone *, int);
int snd_clone_getdeadline(struct snd_clone *);
int snd_clone_setdeadline(struct snd_clone *, int);
int snd_clone_gettime(struct snd_clone *, struct timespec *);
uint32_t snd_clone_getflags(struct snd_clone *);
uint32_t snd_clone_setflags(struct snd_clone *, uint32_t);
int snd_clone_getdevtime(struct cdev *, struct timespec *);
uint32_t snd_clone_getdevflags(struct cdev *);
uint32_t snd_clone_setdevflags(struct cdev *, uint32_t);
int snd_clone_gc(struct snd_clone *);

View File

@ -1569,7 +1569,7 @@ emu_addefxmixer(struct emu_sc_info *sc, const char *mix_name, const int mix_id,
snprintf(sysctl_name, 32, "_%s", mix_name);
SYSCTL_ADD_PROC(sc->ctx,
SYSCTL_CHILDREN(sc->root), OID_AUTO, sysctl_name,
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, mix_id,
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, mix_id,
sysctl_emu_mixer_control, "I", "");
}
@ -1609,7 +1609,7 @@ emu_digitalswitch(struct emu_sc_info *sc)
{
/* XXX temporary? */
SYSCTL_ADD_PROC(sc->ctx, SYSCTL_CHILDREN(sc->root), OID_AUTO,
"_digital", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
"_digital", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
sc, 0, sysctl_emu_digitalswitch_control, "I",
"Enable digital output");

View File

@ -69,7 +69,7 @@ sysctl_hw_snd_latency(SYSCTL_HANDLER_ARGS)
return err;
}
SYSCTL_PROC(_hw_snd, OID_AUTO, latency,
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, 0, sizeof(int),
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 0, sizeof(int),
sysctl_hw_snd_latency, "I",
"buffering latency (0=low ... 10=high)");
@ -92,7 +92,7 @@ sysctl_hw_snd_latency_profile(SYSCTL_HANDLER_ARGS)
return err;
}
SYSCTL_PROC(_hw_snd, OID_AUTO, latency_profile,
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, 0, sizeof(int),
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 0, sizeof(int),
sysctl_hw_snd_latency_profile, "I",
"buffering latency profile (0=aggressive 1=safe)");
@ -115,7 +115,7 @@ sysctl_hw_snd_timeout(SYSCTL_HANDLER_ARGS)
return err;
}
SYSCTL_PROC(_hw_snd, OID_AUTO, timeout,
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, 0, sizeof(int),
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 0, sizeof(int),
sysctl_hw_snd_timeout, "I",
"interrupt timeout (1 - 10) seconds");

View File

@ -186,7 +186,7 @@ sysctl_hw_snd_feeder_rate_min(SYSCTL_HANDLER_ARGS)
return (0);
}
SYSCTL_PROC(_hw_snd, OID_AUTO, feeder_rate_min,
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, 0, sizeof(int),
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 0, sizeof(int),
sysctl_hw_snd_feeder_rate_min, "I",
"minimum allowable rate");
@ -209,7 +209,7 @@ sysctl_hw_snd_feeder_rate_max(SYSCTL_HANDLER_ARGS)
return (0);
}
SYSCTL_PROC(_hw_snd, OID_AUTO, feeder_rate_max,
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, 0, sizeof(int),
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 0, sizeof(int),
sysctl_hw_snd_feeder_rate_max, "I",
"maximum allowable rate");
@ -232,7 +232,7 @@ sysctl_hw_snd_feeder_rate_round(SYSCTL_HANDLER_ARGS)
return (0);
}
SYSCTL_PROC(_hw_snd, OID_AUTO, feeder_rate_round,
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, 0, sizeof(int),
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 0, sizeof(int),
sysctl_hw_snd_feeder_rate_round, "I",
"sample rate converter rounding threshold");

View File

@ -142,7 +142,7 @@ sysctl_hw_sndverbose(SYSCTL_HANDLER_ARGS)
return (error);
}
SYSCTL_PROC(_hw_snd, OID_AUTO, verbose,
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, 0, sizeof(int),
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 0, sizeof(int),
sysctl_hw_sndverbose, "I",
"verbosity level");

View File

@ -1045,7 +1045,7 @@ pcm_sysinit(device_t dev)
OID_AUTO, "buffersize", CTLFLAG_RD, &d->bufsz, 0, "allocated buffer size");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
"bitperfect", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, d,
"bitperfect", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, d,
sizeof(d), sysctl_dev_pcm_bitperfect, "I",
"bit-perfect playback/recording (0=disable, 1=enable)");
SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev),
@ -1056,18 +1056,18 @@ pcm_sysinit(device_t dev)
#ifdef SND_DEBUG
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
"clone_flags", CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT,
"clone_flags", CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
d, sizeof(d), sysctl_dev_pcm_clone_flags, "IU",
"clone flags");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
"clone_deadline", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT,
"clone_deadline", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
d, sizeof(d), sysctl_dev_pcm_clone_deadline, "I",
"clone expiration deadline (ms)");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
"clone_gc",
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, d, sizeof(d),
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, d, sizeof(d),
sysctl_dev_pcm_clone_gc, "I", "clone garbage collector");
#endif
if (d->flags & SD_F_AUTOVCHAN)