git: 5fd4a966624f - stable/13 - pcm: Turn SND_DECLARE_FILE into a no-op.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 06 Sep 2023 21:56:52 UTC
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5fd4a966624f43171d25aa3031b1c5eb644ceb76 commit 5fd4a966624f43171d25aa3031b1c5eb644ceb76 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2023-08-18 20:04:33 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2023-09-06 21:56:10 +0000 pcm: Turn SND_DECLARE_FILE into a no-op. SND_DECLARE_FILE originally added lines to the output of /dev/sndstat listing the $FreeBSD$ strings for individual files, but only if the value of hw.snd.verbose was raised to 3. With the switch to Git these strings became meaningless as they were now all identical and no longer contained the path (which was implicitly included previously via the keyword expansion). This commit removes all of the infrastructure to support file version strings from /dev/sndstat, but preserves the KPI/KBI by turning the SND_DECLARE_FILE macro into a nop and changing the backing sysinit functions into null functions and is suitable for merging to stable/13. A future commit will remove SND_DECLARE_FILE entirely. Reviewed by: kbowling, emaste MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D41498 (cherry picked from commit cbe53bd975b7fa05eb5165c5d6bbcb7b4b37407f) --- sys/dev/sound/pcm/sndstat.c | 65 ++++++++++----------------------------------- sys/dev/sound/pcm/sound.h | 15 +++-------- 2 files changed, 17 insertions(+), 63 deletions(-) diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index 4ee73c176909..c227c8adce99 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -38,7 +38,6 @@ SND_DECLARE_FILE(""); -#define SS_TYPE_MODULE 0 #define SS_TYPE_PCM 1 #define SS_TYPE_MIDI 2 #define SS_TYPE_SEQUENCER 3 @@ -240,21 +239,16 @@ sndstat_register(device_t dev, char *str, sndstat_handler handler) const char *devtype; int type, unit; - if (dev) { - unit = device_get_unit(dev); - devtype = device_get_name(dev); - if (!strcmp(devtype, "pcm")) - type = SS_TYPE_PCM; - else if (!strcmp(devtype, "midi")) - type = SS_TYPE_MIDI; - else if (!strcmp(devtype, "sequencer")) - type = SS_TYPE_SEQUENCER; - else - return (EINVAL); - } else { - type = SS_TYPE_MODULE; - unit = -1; - } + unit = device_get_unit(dev); + devtype = device_get_name(dev); + if (!strcmp(devtype, "pcm")) + type = SS_TYPE_PCM; + else if (!strcmp(devtype, "midi")) + type = SS_TYPE_MIDI; + else if (!strcmp(devtype, "sequencer")) + type = SS_TYPE_SEQUENCER; + else + return (EINVAL); ent = malloc(sizeof *ent, M_DEVBUF, M_WAITOK | M_ZERO); ent->dev = dev; @@ -285,10 +279,9 @@ sndstat_register(device_t dev, char *str, sndstat_handler handler) return (0); } -int -sndstat_registerfile(char *str) +void +sndstat_registerfile(void *dummy __unused) { - return (sndstat_register(NULL, str, NULL)); } int @@ -311,24 +304,9 @@ sndstat_unregister(device_t dev) return (error); } -int -sndstat_unregisterfile(char *str) +void +sndstat_unregisterfile(void *dummy __unused) { - struct sndstat_entry *ent; - int error = ENXIO; - - SNDSTAT_LOCK(); - TAILQ_FOREACH(ent, &sndstat_devlist, link) { - if (ent->dev == NULL && ent->str == str) { - TAILQ_REMOVE(&sndstat_devlist, ent, link); - free(ent, M_DEVBUF); - error = 0; - break; - } - } - SNDSTAT_UNLOCK(); - - return (error); } /************************************************************************/ @@ -354,8 +332,6 @@ sndstat_prepare(struct sndstat_file *pf_self) /* generate list of installed devices */ k = 0; TAILQ_FOREACH(ent, &sndstat_devlist, link) { - if (ent->dev == NULL) - continue; d = device_get_softc(ent->dev); if (!PCM_REGISTERED(d)) continue; @@ -391,19 +367,6 @@ sndstat_prepare(struct sndstat_file *pf_self) if (k == 0) sbuf_printf(s, "No devices installed from userspace.\n"); - /* append any file versions */ - if (snd_verbose >= 3) { - k = 0; - TAILQ_FOREACH(ent, &sndstat_devlist, link) { - if (ent->dev == NULL && ent->str != NULL) { - if (!k++) - sbuf_printf(s, "\nFile Versions:\n"); - sbuf_printf(s, "%s\n", ent->str); - } - } - if (k == 0) - sbuf_printf(s, "\nNo file versions.\n"); - } sbuf_finish(s); return (sbuf_len(s)); } diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index cbcf0a1312eb..ffb71aec6716 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -346,20 +346,11 @@ void snd_mtxassert(void *m); typedef int (*sndstat_handler)(struct sbuf *s, device_t dev, int verbose); int sndstat_register(device_t dev, char *str, sndstat_handler handler); -int sndstat_registerfile(char *str); +void sndstat_registerfile(void *); int sndstat_unregister(device_t dev); -int sndstat_unregisterfile(char *str); +void sndstat_unregisterfile(void *); -#define SND_DECLARE_FILE(version) \ - _SND_DECLARE_FILE(__LINE__, version) - -#define _SND_DECLARE_FILE(uniq, version) \ - __SND_DECLARE_FILE(uniq, version) - -#define __SND_DECLARE_FILE(uniq, version) \ - static char sndstat_vinfo[] = version; \ - SYSINIT(sdf_ ## uniq, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, sndstat_registerfile, sndstat_vinfo); \ - SYSUNINIT(sdf_ ## uniq, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, sndstat_unregisterfile, sndstat_vinfo); +#define SND_DECLARE_FILE(version) /* usage of flags in device config entry (config file) */ #define DV_F_DRQ_MASK 0x00000007 /* mask for secondary drq */