git: 3dace161c237 - stable/14 - sound: Retire pcm_veto_load

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Tue, 05 Nov 2024 21:45:32 UTC
The branch stable/14 has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=3dace161c237069d954bda743e6c734df27ef274

commit 3dace161c237069d954bda743e6c734df27ef274
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-11-03 19:02:17 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-11-05 21:44:41 +0000

    sound: Retire pcm_veto_load
    
    pcm_veto_load is used to prevent pcm_register() from running if the root
    feeder has not been registered yet. However, feeder_register_root() is a
    SYSINIT.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      2 days
    Reviewed by:    dev_submerge.ch, markj, emaste
    Differential Revision:  https://reviews.freebsd.org/D47280
    
    (cherry picked from commit 98cd27c8e13418fa517a02844641f390f9389987)
---
 sys/dev/sound/pcm/feeder.c | 7 ++++---
 sys/dev/sound/pcm/sound.c  | 8 --------
 sys/dev/sound/pcm/sound.h  | 1 -
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/sys/dev/sound/pcm/feeder.c b/sys/dev/sound/pcm/feeder.c
index 2b9599859102..6a6d8c80a34a 100644
--- a/sys/dev/sound/pcm/feeder.c
+++ b/sys/dev/sound/pcm/feeder.c
@@ -68,9 +68,6 @@ feeder_register_root(void *p)
 	fte->idx = feedercnt;
 	SLIST_INSERT_HEAD(&feedertab, fte, link);
 	feedercnt++;
-
-	/* we've got our root feeder so don't veto pcm loading anymore */
-	pcm_veto_load = 0;
 }
 
 void
@@ -465,6 +462,10 @@ static struct feeder_class feeder_root_class = {
 	.desc =		NULL,
 	.data =		NULL,
 };
+/*
+ * Register the root feeder first so that pcm_addchan() and subsequent
+ * functions can use it.
+ */
 SYSINIT(feeder_root, SI_SUB_DRIVERS, SI_ORDER_FIRST, feeder_register_root,
     &feeder_root_class);
 SYSUNINIT(feeder_root, SI_SUB_DRIVERS, SI_ORDER_FIRST, feeder_unregisterall, NULL);
diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c
index e25cb359f793..948cbd0b8fb9 100644
--- a/sys/dev/sound/pcm/sound.c
+++ b/sys/dev/sound/pcm/sound.c
@@ -48,8 +48,6 @@
 
 devclass_t pcm_devclass;
 
-int pcm_veto_load = 1;
-
 int snd_unit = -1;
 
 static int snd_unit_auto = -1;
@@ -462,12 +460,6 @@ pcm_register(device_t dev, void *devinfo, int numplay, int numrec)
 	struct snddev_info *d;
 	int i;
 
-	if (pcm_veto_load) {
-		device_printf(dev, "disabled due to an error while initialising: %d\n", pcm_veto_load);
-
-		return EINVAL;
-	}
-
 	d = device_get_softc(dev);
 	d->dev = dev;
 	d->lock = snd_mtxcreate(device_get_nameunit(dev), "sound cdev");
diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h
index 126b3411b035..c5013e76034a 100644
--- a/sys/dev/sound/pcm/sound.h
+++ b/sys/dev/sound/pcm/sound.h
@@ -229,7 +229,6 @@ enum {
 
 #define DSP_DEFAULT_SPEED	8000
 
-extern int pcm_veto_load;
 extern int snd_unit;
 extern int snd_verbose;
 extern devclass_t pcm_devclass;