git: 69707d9f5091 - stable/14 - sound: Call device_get_name() and device_get_unit() only once in mixer_init()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 17 May 2024 19:30:49 UTC
The branch stable/14 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=69707d9f509175e4b79ef046798226f79c3787f4 commit 69707d9f509175e4b79ef046798226f79c3787f4 Author: Christos Margiolis <christos@FreeBSD.org> AuthorDate: 2024-04-18 20:35:01 +0000 Commit: Christos Margiolis <christos@FreeBSD.org> CommitDate: 2024-05-17 19:30:01 +0000 sound: Call device_get_name() and device_get_unit() only once in mixer_init() No functional change intended. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: markj, emaste Differential Revision: https://reviews.freebsd.org/D44840 (cherry picked from commit 41ab202ff74ea6af7e9125c9dfb430c729380f41) --- sys/dev/sound/pcm/mixer.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 0645089ac503..24fc5678af71 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -726,14 +726,17 @@ mixer_init(device_t dev, kobj_class_t cls, void *devinfo) struct snd_mixer *m; u_int16_t v; struct cdev *pdev; + const char *name; int i, unit, devunit, val; snddev = device_get_softc(dev); if (snddev == NULL) return (-1); - if (resource_int_value(device_get_name(dev), - device_get_unit(dev), "eq", &val) == 0 && val != 0) { + name = device_get_name(dev); + unit = device_get_unit(dev); + if (resource_int_value(name, unit, "eq", &val) == 0 && + val != 0) { snddev->flags |= SD_F_EQ; if ((val & SD_F_EQ_MASK) == val) snddev->flags |= val; @@ -749,8 +752,8 @@ mixer_init(device_t dev, kobj_class_t cls, void *devinfo) for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { v = snd_mixerdefaults[i]; - if (resource_int_value(device_get_name(dev), - device_get_unit(dev), snd_mixernames[i], &val) == 0) { + if (resource_int_value(name, unit, snd_mixernames[i], + &val) == 0) { if (val >= 0 && val <= 100) { v = (u_int16_t) val; } @@ -761,7 +764,6 @@ mixer_init(device_t dev, kobj_class_t cls, void *devinfo) mixer_setrecsrc(m, 0); /* Set default input. */ - unit = device_get_unit(dev); devunit = snd_mkunit(unit, SND_DEV_CTL, 0); pdev = make_dev(&mixer_cdevsw, PCMMINOR(devunit), UID_ROOT, GID_WHEEL, 0666, "mixer%d", unit);