From nobody Thu Apr 18 20:35:48 2024 X-Original-To: dev-commits-src-main@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 4VL8g860cYz5HX47; Thu, 18 Apr 2024 20:35:48 +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 4VL8g85SQqz4Mpb; Thu, 18 Apr 2024 20:35:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713472548; 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=YmAsloaA/vPID1p/m6SpmwZKPI69ND771MUBqYy+sUA=; b=krBk1cojzwdrcLZWf1977NRyeYdR6QieQvgwhqlxVILH5W/hOrKrkbvf6wjPqc7aGJHMW9 Sy0m8Bi439AcvKUwwRZZiqDOrn19JIPG3LXPJJxiW+95kX3f4zw9Xr8638BBeq/j802DfR h+qVlqR/wWX96mZxnjpkFF7adJ8zMvUrouDsoJK7jfQDlniboAldvgLEmWwI79TrM9EZFK S9u0ew9gTTxUZtxbFF9X+uXUgogucDBwl41WiO7iRuyMuJ7yBHjz0T0bWGWgpzjR0i02eF 9e9G7u5FJIKqedsHpVN2bsmFLHsg9WnH1IuMld4krk6qjZz/z8Vh9hGxunmDqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713472548; a=rsa-sha256; cv=none; b=twMcf0BJmwmhOQ1dd6jbqu9qfOTE9e2gpRvDvqWjQM8GcHnxOBSV4Sn6ihKv65W2lFretI phqLTBplWOXc6YkugmwY0DhfJLzY1Chxayyg7sXGJq/Cryn0rlGag9bDH22yam+J9/x9j4 +1IWpcDFg14jjise3TK5pgJlggafO2LXIbIy5AOlH98W1lBm6rFVrCtoBiEHN4L8t+nV4D c13EosFnOl5Nj7lzYi0rjO3wurpqc5UhbPV6GF7Uui5XNvp9rPQ30TlzM2ArqmJPN58541 Zx/tORucjxQbWxMFA4XNKautkm9R7h7tCCc3eKfjTWBm2UGkPadgKw6MiBDFxQ== 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=1713472548; 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=YmAsloaA/vPID1p/m6SpmwZKPI69ND771MUBqYy+sUA=; b=VC5QtDdhcytplSWSpjjj4Ey8WsSc4qiAaeIH+6CNMyppS+zE8mP4qmBrR+Ye0s+w7LOiOC ulYJQ2+WMTC5xexCKyuVDtbymeaLQDSU6jOjKn5VbbIuWdyBg4Xt/hZcpqPk10YXN0jA55 QjTgBv2idkdob66Gpbiwg2T57oo/UnjbReoe5lyV3wufvMjpztUyku/Mhhb3tfluIqgT8D bk4EyzOTA+wnHNIxMvumPsrvuDoZ46Iiptjp0gUou7wAFQzqH2ZFXuxzUEnEpKX7cNTdVe FmdjsIfI6LpjBrEUvqPAVG2g0c0X/NUe8S1xDoQcpS8XzLUvQb3cSKQcQrf2Eg== 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 4VL8g8548szPZx; Thu, 18 Apr 2024 20:35:48 +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 43IKZmcx056637; Thu, 18 Apr 2024 20:35:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43IKZmYB056634; Thu, 18 Apr 2024 20:35:48 GMT (envelope-from git) Date: Thu, 18 Apr 2024 20:35:48 GMT Message-Id: <202404182035.43IKZmYB056634@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 41ab202ff74e - main - sound: Call device_get_name() and device_get_unit() only once in mixer_init() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 41ab202ff74ea6af7e9125c9dfb430c729380f41 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=41ab202ff74ea6af7e9125c9dfb430c729380f41 commit 41ab202ff74ea6af7e9125c9dfb430c729380f41 Author: Christos Margiolis AuthorDate: 2024-04-18 20:35:01 +0000 Commit: Christos Margiolis CommitDate: 2024-04-18 20:35:40 +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 --- 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 cc8cf5b1ceea..9a83fc305bc7 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);