git: b095a41a3a2a - main - Revert "sound: Access softc through si_drv1 in dsp cdev methods"

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Fri, 25 Apr 2025 22:03:57 UTC
The branch main has been updated by christos:

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

commit b095a41a3a2ad53e3d1c51e62ff6a85707158e08
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-04-25 22:02:24 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-04-25 22:02:24 +0000

    Revert "sound: Access softc through si_drv1 in dsp cdev methods"
    
    Committed by accident.
    
    This reverts commit facccfc8c7e1463c3139a74d746b715c4f3a02a0.
---
 sys/dev/sound/pcm/dsp.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index bc64b50b4510..9b174f4592f3 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -455,7 +455,7 @@ dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td)
 }
 
 static __inline int
-dsp_io_ops(struct cdev *i_dev, struct uio *buf, struct dsp_cdevpriv *priv)
+dsp_io_ops(struct dsp_cdevpriv *priv, struct uio *buf)
 {
 	struct snddev_info *d;
 	struct pcm_channel **ch;
@@ -467,7 +467,7 @@ dsp_io_ops(struct cdev *i_dev, struct uio *buf, struct dsp_cdevpriv *priv)
 	    (buf->uio_rw == UIO_READ || buf->uio_rw == UIO_WRITE),
 	    ("%s(): io train wreck!", __func__));
 
-	d = i_dev->si_drv1;
+	d = priv->sc;
 	if (!DSP_REGISTERED(d))
 		return (EBADF);
 
@@ -536,7 +536,7 @@ dsp_read(struct cdev *i_dev, struct uio *buf, int flag)
 
 	if ((err = devfs_get_cdevpriv((void **)&priv)) != 0)
 		return (err);
-	return (dsp_io_ops(i_dev, buf, priv));
+	return (dsp_io_ops(priv, buf));
 }
 
 static int
@@ -547,16 +547,18 @@ dsp_write(struct cdev *i_dev, struct uio *buf, int flag)
 
 	if ((err = devfs_get_cdevpriv((void **)&priv)) != 0)
 		return (err);
-	return (dsp_io_ops(i_dev, buf, priv));
+	return (dsp_io_ops(priv, buf));
 }
 
 static int
-dsp_ioctl_channel(struct snddev_info *d, struct dsp_cdevpriv *priv,
-    struct pcm_channel *volch, u_long cmd, caddr_t arg)
+dsp_ioctl_channel(struct dsp_cdevpriv *priv, struct pcm_channel *volch,
+    u_long cmd, caddr_t arg)
 {
+	struct snddev_info *d;
 	struct pcm_channel *rdch, *wrch;
 	int j, left, right, center, mute;
 
+	d = priv->sc;
 	if (!PCM_REGISTERED(d) || !(pcm_getflags(d->dev) & SD_F_VPC))
 		return (-1);
 
@@ -684,7 +686,7 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode,
 	if ((err = devfs_get_cdevpriv((void **)&priv)) != 0)
 		return (err);
 
-	d = i_dev->si_drv1;
+	d = priv->sc;
 	if (!DSP_REGISTERED(d))
 		return (EBADF);
 
@@ -701,7 +703,7 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode,
 			PCM_GIANT_EXIT(d);
 			return (0);
 		}
-		ret = dsp_ioctl_channel(d, priv, priv->volch, cmd, arg);
+		ret = dsp_ioctl_channel(priv, priv->volch, cmd, arg);
 		if (ret != -1) {
 			PCM_GIANT_EXIT(d);
 			return (ret);
@@ -1458,7 +1460,7 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode,
 			chn = wrch;
 		}
 
-		ret = dsp_ioctl_channel(d, priv, chn, xcmd, arg);
+		ret = dsp_ioctl_channel(priv, chn, xcmd, arg);
 		if (ret != -1) {
 			PCM_GIANT_EXIT(d);
 			return (ret);
@@ -1781,7 +1783,7 @@ dsp_poll(struct cdev *i_dev, int events, struct thread *td)
 
 	if ((err = devfs_get_cdevpriv((void **)&priv)) != 0)
 		return (err);
-	d = i_dev->si_drv1;
+	d = priv->sc;
 	if (!DSP_REGISTERED(d)) {
 		/* XXX many clients don't understand POLLNVAL */
 		return (events & (POLLHUP | POLLPRI | POLLIN |
@@ -1863,7 +1865,7 @@ dsp_mmap_single(struct cdev *i_dev, vm_ooffset_t *offset,
 
 	if ((err = devfs_get_cdevpriv((void **)&priv)) != 0)
 		return (err);
-	d = i_dev->si_drv1;
+	d = priv->sc;
 	if (!DSP_REGISTERED(d))
 		return (EINVAL);