git: e5f5ca7fee26 - main - mixer(3): remove redundant argument in _mixer_readvol()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 17 Jan 2023 13:10:17 UTC
The branch main has been updated by markj:

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

commit e5f5ca7fee26179725ab2d66b5500d51fe8ae113
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2023-01-17 13:08:59 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-01-17 13:08:59 +0000

    mixer(3): remove redundant argument in _mixer_readvol()
    
    There's no reason to pass the mixer as an argument since we can fetch it
    from mix_dev.  No functional change intended.
    
    Reviewed by:    markj, hselasky
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D38076
---
 lib/libmixer/mixer.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/libmixer/mixer.c b/lib/libmixer/mixer.c
index 1a448d222bb7..f81f2ff4a66b 100644
--- a/lib/libmixer/mixer.c
+++ b/lib/libmixer/mixer.c
@@ -37,17 +37,17 @@
 
 #define	BASEPATH "/dev/mixer"
 
-static int _mixer_readvol(struct mixer *, struct mix_dev *);
+static int _mixer_readvol(struct mix_dev *);
 
 /*
  * Fetch volume from the device.
  */
 static int
-_mixer_readvol(struct mixer *m, struct mix_dev *dev)
+_mixer_readvol(struct mix_dev *dev)
 {
 	int v;
 
-	if (ioctl(m->fd, MIXER_READ(dev->devno), &v) < 0)
+	if (ioctl(dev->parent_mixer->fd, MIXER_READ(dev->devno), &v) < 0)
 		return (-1);
 	dev->vol.left = MIX_VOLNORM(v & 0x00ff);
 	dev->vol.right = MIX_VOLNORM((v >> 8) & 0x00ff);
@@ -122,7 +122,7 @@ dunit:
 		dp->parent_mixer = m;
 		dp->devno = i;
 		dp->nctl = 0;
-		if (_mixer_readvol(m, dp) < 0)
+		if (_mixer_readvol(dp) < 0)
 			goto fail;
 		(void)strlcpy(dp->name, names[i], sizeof(dp->name));
 		TAILQ_INIT(&dp->ctls);
@@ -336,7 +336,7 @@ mixer_set_vol(struct mixer *m, mix_volume_t vol)
 	v = MIX_VOLDENORM(vol.left) | MIX_VOLDENORM(vol.right) << 8;
 	if (ioctl(m->fd, MIXER_WRITE(m->dev->devno), &v) < 0)
 		return (-1);
-	if (_mixer_readvol(m, m->dev) < 0)
+	if (_mixer_readvol(m->dev) < 0)
 		return (-1);
 
 	return (0);