From nobody Mon Dec 27 01:39:36 2021 X-Original-To: dev-commits-src-all@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 C12E319172A0; Mon, 27 Dec 2021 01:39:36 +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 4JMgMD3cfDz59F1; Mon, 27 Dec 2021 01:39:36 +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 58E4B155A1; Mon, 27 Dec 2021 01:39:36 +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 1BR1daUm023469; Mon, 27 Dec 2021 01:39:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BR1daSE023468; Mon, 27 Dec 2021 01:39:36 GMT (envelope-from git) Date: Mon, 27 Dec 2021 01:39:36 GMT Message-Id: <202112270139.1BR1daSE023468@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 3b4c5433229a - main - sound: Remove CTLFLAG_NEEDGIANT from some sysctls. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: 3b4c5433229ac912929b77edee0b4dc001d70fe5 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640569176; 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=7hV2PNczDDdIQ6nhwhROtWlWroZptXxCfdYhbQ/6ipE=; b=c2KcnGPF8HsUgzTmhttd5X8Kok5egaTUeb0S/Sfd31zRGwdvaOPjezEHPUyJ7IPSsIIMS6 GHLSTrT5Pce1WAHPUO+DHvNuwIEqmw8oxnujh9xOR65fDLrt6EJKlB/KRmVqAFeSsfLK0z oVeKhVoR/a3ZayT5omgo8SndGmokzwMLhsv76qSuQS4SP3DIyQO2uXGE8COxEkucWlGiMd UneogGyqGhZNt12aCKLrf7/yagxZcxBFLHUpdDx7Y5Wir9tP2+Z+1rFiX+1JVgsFWPdZ5P JqwQwBdCjR7Fi6JlDl/YIewfLcBd4dBG71f9tmI/WQyo6mlSfB+YndrrlBws2Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640569176; a=rsa-sha256; cv=none; b=yaUhPyLAK93AOZjGR+/RYh54s2oT8W1IbM/+/HtcCxNOuF8H4n7wAhqZ1jHoNCmHttiaFp 1nFGzwq4ATaHYuSF4+kdtA5a+mFEsFiP5C6pKrYNnoR6bHA/5VNlT67VfX/BPs6DshLkKw oRmxZCaNZQxBp5C8zrHBQTvPlM3nApc3LM9wdAQ6yS+rhssUTSYTjDa8VXL2jwrw/zsim0 criuH3kS56vXLtp4wFfxWgGTF3KIxaZmTEOUhGbwZFI/pcpnDDPp4SAmLMDOiULj9ShX2V xe9klrtLu/RJfWnu5QH2NKmY6tBCIMwL2a6FJctPmlaRvfQuz90UPgcUIbPISg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=3b4c5433229ac912929b77edee0b4dc001d70fe5 commit 3b4c5433229ac912929b77edee0b4dc001d70fe5 Author: Alexander Motin AuthorDate: 2021-12-27 01:37:55 +0000 Commit: Alexander Motin CommitDate: 2021-12-27 01:39:32 +0000 sound: Remove CTLFLAG_NEEDGIANT from some sysctls. While there, remove some dead code. MFC after: 2 weeks --- 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 611af91de4d4..f40d60156a9c 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 ea36f4ba79ba..90cc345a73a6 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -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"); diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 1560da40c9c2..4b55e798cb80 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)