git: 72cbd381075a - main - sound: Remove unused dsp_cdevs[] fields and devices

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Mon, 06 May 2024 18:36:38 UTC
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=72cbd381075a2eb22a070505334d1ce92ec2d7ad

commit 72cbd381075a2eb22a070505334d1ce92ec2d7ad
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-05-06 18:32:25 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-05-06 18:35:55 +0000

    sound: Remove unused dsp_cdevs[] fields and devices
    
    These fields and devices are unused as of e8c0d15a64fa ("sound: Get rid
    of snd_clone and use DEVFS_CDEVPRIV(9)").
    
    While here, remove unused SND_DEV_* defines from pcm/sound.h and convert
    the list to an enum.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Reviewed by:    dev_submerge.ch, markj
    Differential Revision:  https://reviews.freebsd.org/D45013
---
 sys/dev/sound/pcm/dsp.c   | 57 +++++++++--------------------------------------
 sys/dev/sound/pcm/sound.h | 50 +++++++++--------------------------------
 2 files changed, 21 insertions(+), 86 deletions(-)

diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index 9c31fff7e8cd..6c3d76e27b6b 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -203,13 +203,6 @@ relchns(struct dsp_cdevpriv *priv, uint32_t prio)
 		CHN_UNLOCK(priv->wrch);
 }
 
-/* duplex / simplex cdev type */
-enum {
-	DSP_CDEV_TYPE_RDONLY,		/* simplex read-only (record)   */
-	DSP_CDEV_TYPE_WRONLY,		/* simplex write-only (play)    */
-	DSP_CDEV_TYPE_RDWR		/* duplex read, write, or both  */
-};
-
 #define DSP_F_VALID(x)		((x) & (FREAD | FWRITE))
 #define DSP_F_DUPLEX(x)		(((x) & (FREAD | FWRITE)) == (FREAD | FWRITE))
 #define DSP_F_SIMPLEX(x)	(!DSP_F_DUPLEX(x))
@@ -221,48 +214,18 @@ static const struct {
 	char *name;
 	char *sep;
 	char *alias;
-	int use_sep;
-	int hw;
-	int max;
-	int volctl;
-	uint32_t fmt, spd;
-	int query;
 } dsp_cdevs[] = {
-	{ SND_DEV_DSP,         "dsp",    ".", NULL, 0, 0, 0, 0,
-	  SND_FORMAT(AFMT_U8, 1, 0),     DSP_DEFAULT_SPEED,
-	  DSP_CDEV_TYPE_RDWR },
-	{ SND_DEV_AUDIO,       "audio",  ".", NULL, 0, 0, 0, 0,
-	  SND_FORMAT(AFMT_MU_LAW, 1, 0), DSP_DEFAULT_SPEED,
-	  DSP_CDEV_TYPE_RDWR },
-	{ SND_DEV_DSP16,       "dspW",   ".", NULL, 0, 0, 0, 0,
-	  SND_FORMAT(AFMT_S16_LE, 1, 0), DSP_DEFAULT_SPEED,
-	  DSP_CDEV_TYPE_RDWR },
-	{ SND_DEV_DSPHW_PLAY,  "dsp",   ".p", NULL, 1, 1, SND_MAXHWCHAN, 1,
-	  SND_FORMAT(AFMT_S16_LE, 2, 0), 48000, DSP_CDEV_TYPE_WRONLY },
-	{ SND_DEV_DSPHW_VPLAY, "dsp",  ".vp", NULL, 1, 1, SND_MAXVCHANS, 1,
-	  SND_FORMAT(AFMT_S16_LE, 2, 0), 48000, DSP_CDEV_TYPE_WRONLY },
-	{ SND_DEV_DSPHW_REC,   "dsp",   ".r", NULL, 1, 1, SND_MAXHWCHAN, 1,
-	  SND_FORMAT(AFMT_S16_LE, 2, 0), 48000, DSP_CDEV_TYPE_RDONLY },
-	{ SND_DEV_DSPHW_VREC,  "dsp",  ".vr", NULL, 1, 1, SND_MAXVCHANS, 1,
-	  SND_FORMAT(AFMT_S16_LE, 2, 0), 48000, DSP_CDEV_TYPE_RDONLY },
-	{ SND_DEV_DSPHW_CD,    "dspcd",  ".", NULL, 0, 0, 0, 0,
-	  SND_FORMAT(AFMT_S16_LE, 2, 0), 44100, DSP_CDEV_TYPE_RDWR   },
+	{ SND_DEV_DSP,         "dsp",    ".", NULL },
+	{ SND_DEV_DSPHW_PLAY,  "dsp",   ".p", NULL },
+	{ SND_DEV_DSPHW_VPLAY, "dsp",  ".vp", NULL },
+	{ SND_DEV_DSPHW_REC,   "dsp",   ".r", NULL },
+	{ SND_DEV_DSPHW_VREC,  "dsp",  ".vr", NULL },
 	/* Low priority, OSSv4 aliases. */
-	{ SND_DEV_DSP,      "dsp_ac3",   ".", "dsp", 0, 0, 0, 0,
-	  SND_FORMAT(AFMT_U8, 1, 0),     DSP_DEFAULT_SPEED,
-	  DSP_CDEV_TYPE_RDWR },
-	{ SND_DEV_DSP,     "dsp_mmap",   ".", "dsp", 0, 0, 0, 0,
-	  SND_FORMAT(AFMT_U8, 1, 0),     DSP_DEFAULT_SPEED,
-	  DSP_CDEV_TYPE_RDWR },
-	{ SND_DEV_DSP,  "dsp_multich",   ".", "dsp", 0, 0, 0, 0,
-	  SND_FORMAT(AFMT_U8, 1, 0),     DSP_DEFAULT_SPEED,
-	  DSP_CDEV_TYPE_RDWR },
-	{ SND_DEV_DSP, "dsp_spdifout",   ".", "dsp", 0, 0, 0, 0,
-	  SND_FORMAT(AFMT_U8, 1, 0),     DSP_DEFAULT_SPEED,
-	  DSP_CDEV_TYPE_RDWR },
-	{ SND_DEV_DSP,  "dsp_spdifin",   ".", "dsp", 0, 0, 0, 0,
-	  SND_FORMAT(AFMT_U8, 1, 0),     DSP_DEFAULT_SPEED,
-	  DSP_CDEV_TYPE_RDWR },
+	{ SND_DEV_DSP,      "dsp_ac3",   ".", "dsp" },
+	{ SND_DEV_DSP,     "dsp_mmap",   ".", "dsp" },
+	{ SND_DEV_DSP,  "dsp_multich",   ".", "dsp" },
+	{ SND_DEV_DSP, "dsp_spdifout",   ".", "dsp" },
+	{ SND_DEV_DSP,  "dsp_spdifin",   ".", "dsp" },
 };
 
 static void
diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h
index d2ec480b45b0..5a750440cbea 100644
--- a/sys/dev/sound/pcm/sound.h
+++ b/sys/dev/sound/pcm/sound.h
@@ -228,45 +228,17 @@ struct snd_mixer;
 #define AFMT_NE		(AFMT_SIGNED_NE | AFMT_U8_NE | AFMT_U16_NE |	\
 			 AFMT_U24_NE | AFMT_U32_NE)
 
-/*
- * Minor numbers for the sound driver.
- *
- * Unfortunately Creative called the codec chip of SB as a DSP. For this
- * reason the /dev/dsp is reserved for digitized audio use. There is a
- * device for true DSP processors but it will be called something else.
- * In v3.0 it's /dev/sndproc but this could be a temporary solution.
- */
-
-#define SND_DEV_CTL	0	/* Control port /dev/mixer */
-#define SND_DEV_SEQ	1	/* Sequencer /dev/sequencer */
-#define SND_DEV_MIDIN	2	/* Raw midi access */
-#define SND_DEV_DSP	3	/* Digitized voice /dev/dsp */
-#define SND_DEV_AUDIO	4	/* Sparc compatible /dev/audio */
-#define SND_DEV_DSP16	5	/* Like /dev/dsp but 16 bits/sample */
-#define SND_DEV_STATUS	6	/* /dev/sndstat */
-				/* #7 not in use now. */
-#define SND_DEV_SEQ2	8	/* /dev/sequencer, level 2 interface */
-#define SND_DEV_SNDPROC 9	/* /dev/sndproc for programmable devices */
-#define SND_DEV_PSS	SND_DEV_SNDPROC /* ? */
-#define SND_DEV_NORESET	10
-
-#define SND_DEV_DSPHW_PLAY	11	/* specific playback channel */
-#define SND_DEV_DSPHW_VPLAY	12	/* specific virtual playback channel */
-#define SND_DEV_DSPHW_REC	13	/* specific record channel */
-#define SND_DEV_DSPHW_VREC	14	/* specific virtual record channel */
-
-#define SND_DEV_DSPHW_CD	15	/* s16le/stereo 44100Hz CD */
-
-/* 
- * OSSv4 compatible device. For now, it serve no purpose and
- * the cloning itself will forward the request to ordinary /dev/dsp
- * instead.
- */
-#define SND_DEV_DSP_MMAP	16	/* /dev/dsp_mmap     */
-#define SND_DEV_DSP_AC3		17	/* /dev/dsp_ac3      */
-#define SND_DEV_DSP_MULTICH	18	/* /dev/dsp_multich  */
-#define SND_DEV_DSP_SPDIFOUT	19	/* /dev/dsp_spdifout */
-#define SND_DEV_DSP_SPDIFIN	20	/* /dev/dsp_spdifin  */
+enum {
+	SND_DEV_CTL = 0,	/* Control port /dev/mixer */
+	SND_DEV_SEQ,		/* Sequencer /dev/sequencer */
+	SND_DEV_MIDIN,		/* Raw midi access */
+	SND_DEV_DSP,		/* Digitized voice /dev/dsp */
+	SND_DEV_STATUS,		/* /dev/sndstat */
+	SND_DEV_DSPHW_PLAY,	/* specific playback channel */
+	SND_DEV_DSPHW_VPLAY,	/* specific virtual playback channel */
+	SND_DEV_DSPHW_REC,	/* specific record channel */
+	SND_DEV_DSPHW_VREC,	/* specific virtual record channel */
+};
 
 #define DSP_DEFAULT_SPEED	8000