From nobody Fri May 17 19:30:49 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vgxrn6tYgz5Lg8P; Fri, 17 May 2024 19:30:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vgxrn6Hj2z4v1d; Fri, 17 May 2024 19:30:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715974249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IPVu2ipqLE1sI4FMGH2cULNSKgAT76ljSn2TErzyFMA=; b=QVbjmrQpFxa0cetkDN1P9lp/NGCOedRmrlGggEq9kArjP14MGww/ZiwICRI8DZg3pp13iw bfI7V+QAe5bxzz5kzSO61UZGmU7l037oawmGsOFObFe4QkTyEGg1Ysw+I7JSr/1jDaIHhV kS+4PQBbmVX5u5sI2lJyGpsH8BAAmzzssd3AdEVB+s6jXDQV3XxI1VjXTmhNUO3/2PKGZG u+YSFkAVRUjKEyosiwUQ9WiaRN4aPZHqvweHkMK//FnTALaZeXcZQGTb5pCBTMNYPTDLHY +zhB88MGtvgTWEwC6CmLo2Hu5JAdOLERoN3UD4kMUM31ye3HLRUXhgC9lX7dSA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715974249; a=rsa-sha256; cv=none; b=t2hl4qfVijRwfr8TxLV/iDGwWIZrvNrt6yL0vW2C7NKgCUry1Zq8VT0hYbDPW+nHHenJzD tzSbQluDeRasMs6y9hfcTdh5smBdX0JroAOaB/MJn3cCtnas0buYguRWf3cDIDo0qKion1 vjYg6tYWdvVmu2ehYEVhasNHZWzWwZ9b5acRaHtCo5d1ol99fRAEi88lfN2X9D7zIukY2y zU3v7vir7FQP4U1y2GroO5/qBgYAUTyqTFt7pbVRemDrDhZN64Et3iS6sopIRUJyohIL/2 Xnyg8rJoaJMpijgGuz+MalmFMRO1niu2ZjItIgJhx0apWGNqGnGjg0fSMlSCXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715974249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IPVu2ipqLE1sI4FMGH2cULNSKgAT76ljSn2TErzyFMA=; b=OQ9n15hxRmuz2Mxg9XUdpId2XvVYzFlpfhk4Q1slOMC+iUwH1xjdz4bLDkgjdoFh/tDorr w4l6UoytyrKlxioL1rcBIpoFcBgFFwpT8fVhRfwG7v1ei00PedTXwLodTv+7eZ4Sp9HbDC nwKtlENqjqqcLoz3MAR5mJNmFOekCPJ66S7MWOK2HqQT8gkUBcK07hrWuoIOpd/d1lU1qs DbfqdCfPHb7SXztmLJMtGKTmRMPTT3leVoPRZNuEQCoxdAXoNmx+I+OeWFY3I34pgTQwTx HSSJQKNr7waR1jjN2lZ8x2my3E+jSfHzXCnF+uOJUBDg9bvEv6+EWNI9RwMeeA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vgxrn5tz7zvqy; Fri, 17 May 2024 19:30:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44HJUnZs099170; Fri, 17 May 2024 19:30:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44HJUn0U099167; Fri, 17 May 2024 19:30:49 GMT (envelope-from git) Date: Fri, 17 May 2024 19:30:49 GMT Message-Id: <202405171930.44HJUn0U099167@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Christos Margiolis Subject: git: 69707d9f5091 - stable/14 - sound: Call device_get_name() and device_get_unit() only once in mixer_init() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 69707d9f509175e4b79ef046798226f79c3787f4 Auto-Submitted: auto-generated The branch stable/14 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=69707d9f509175e4b79ef046798226f79c3787f4 commit 69707d9f509175e4b79ef046798226f79c3787f4 Author: Christos Margiolis AuthorDate: 2024-04-18 20:35:01 +0000 Commit: Christos Margiolis 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);