From nobody Mon Jan 10 00:30:25 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7B6391941070; Mon, 10 Jan 2022 00:30:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JXF8y121Qz56GJ; Mon, 10 Jan 2022 00:30:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 023321BA30; Mon, 10 Jan 2022 00:30:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20A0UPaZ054801; Mon, 10 Jan 2022 00:30:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20A0UPqM054800; Mon, 10 Jan 2022 00:30:25 GMT (envelope-from git) Date: Mon, 10 Jan 2022 00:30:25 GMT Message-Id: <202201100030.20A0UPqM054800@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 1b1f80ae1cfd - stable/13 - sound: Remove CTLFLAG_NEEDGIANT from some sysctls. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1b1f80ae1cfd97968ea3832d4e51df3ec7ba275c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641774626; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6iHu91jeyax8ihKQqtFbxzUG9nbBzwWEhF+ScQJzRWU=; b=Iof+xc6A9OOVrhyeMLyWiKnIJufR3ApXECD0oNCxGqdmzVHTBA4G+a9qlh51609V2IrIX6 9br1T6grTpe/ZeBw2C5jPSQLTUxzd0UtywDqnIu5tfVtntyt4uIO/fw+3Re7vDUr5MFsEv 4jGyx9TAUFp5+zAbCjs2epcQVyiJ9Y7uTa89xxrZa1ttKb13WCMuVp0/o1uNiQljC5HNIk a3D0H399sK0czqVRVqcemdk4dnzb3s7SrWPVqpH9KEI4e/qo/fDddOAeZhYentPtfERdnj V6le3mCoqjkHXBZVoocjvr4bSXYCENRZc5b9Shce9My4A4ttEfSXeX1uxpWEsQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641774626; a=rsa-sha256; cv=none; b=K0EbarpC6zpxRFIwCWfGSLcuQqJCRU+CzjmPgGx23cReNXFM/gU4pohbU0ecchLcqLUXdy hyWFqA0FBkoc4sXaPMwNMcoFomkwD6MX63rhcfSSD1pWbrFskgIZaktuGHY/VbiHs9Xaf0 MXMmLar/Qj3EujOlQti9UTY7C4IltOcPKRiV8NvGuEMyCP3bNnlaT4yu1rqabX8XBOkdsi VsoNcc+bLgGOCyusLoznMR6yFs2rBnYQYiUWbX/qAr/1SZMzvPiOfBBr5lNDSnI97xC1wC vke4OlQY5burdgUrBeLw40TcL+6KnFQ4ILvpa15iftJOlDwusmOQMoK7GRL5rg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=1b1f80ae1cfd97968ea3832d4e51df3ec7ba275c commit 1b1f80ae1cfd97968ea3832d4e51df3ec7ba275c Author: Alexander Motin AuthorDate: 2021-12-27 01:37:55 +0000 Commit: Alexander Motin CommitDate: 2022-01-10 00:29:59 +0000 sound: Remove CTLFLAG_NEEDGIANT from some sysctls. While there, remove some dead code. MFC after: 2 weeks (cherry picked from commit 3b4c5433229ac912929b77edee0b4dc001d70fe5) --- sys/dev/sound/clone.c | 101 ++-------------------------------------- sys/dev/sound/clone.h | 4 -- sys/dev/sound/pci/emu10kx.c | 4 +- sys/dev/sound/pcm/channel.c | 6 +-- sys/dev/sound/pcm/feeder_rate.c | 6 +-- sys/dev/sound/pcm/sndstat.c | 2 +- sys/dev/sound/pcm/sound.c | 8 ++-- 7 files changed, 16 insertions(+), 115 deletions(-) diff --git a/sys/dev/sound/clone.c b/sys/dev/sound/clone.c index 3ded510eae5c..7d3148750a1e 100644 --- a/sys/dev/sound/clone.c +++ b/sys/dev/sound/clone.c @@ -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) { /* diff --git a/sys/dev/sound/clone.h b/sys/dev/sound/clone.h index 54b26e31c8b4..bcfa504ad003 100644 --- a/sys/dev/sound/clone.h +++ b/sys/dev/sound/clone.h @@ -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 *); diff --git a/sys/dev/sound/pci/emu10kx.c b/sys/dev/sound/pci/emu10kx.c index 5ae760845008..784fd7e27ae1 100644 --- a/sys/dev/sound/pci/emu10kx.c +++ b/sys/dev/sound/pci/emu10kx.c @@ -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"); diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 9574697f8656..065bf6ee2c5c 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -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"); diff --git a/sys/dev/sound/pcm/feeder_rate.c b/sys/dev/sound/pcm/feeder_rate.c index 88a58461b1ed..f6bb1836089b 100644 --- a/sys/dev/sound/pcm/feeder_rate.c +++ b/sys/dev/sound/pcm/feeder_rate.c @@ -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"); diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index 31c4a1b14a79..7eb21c6840e7 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -101,7 +101,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"); diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 663ec84f93b6..dcc2180fe88a 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -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)