From nobody Tue Jan 30 11:08:32 2024 X-Original-To: dev-commits-src-branches@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 4TPMq43dFXz58dVk; Tue, 30 Jan 2024 11:08:32 +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 4TPMq41vx5z4Hjr; Tue, 30 Jan 2024 11:08:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706612912; 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=LCib1Yqr/o156tM8IEhszUaLEdQN6hEM5BBUzYXk4cg=; b=rmfxlOM3/OCu5npl+x2qiwr/x7t8/VJcsWOy7Aquy4YwOd9cqhtt9mzJrvEkYZ+7sXhyUp XmQUaisRrrEMh846WdHDmZSouRvWocPWCEuwV9cO57lIj9nSX1FQWla4ZS6i4j7xSf4KiY QNRFJmihljcrpFIe3jMJICgsJd9AT0kVhu7cFPbuMogYFAFfkxrsVRWendNJHfaeaNBV3z wrpAN/VvtDyUs+qj6d0JmyylPPeQC28n8MwEDTiOPI0QTrNTD65J5rDZMv3+e0Nk4jxHu/ w2HSIrsCX3mOM7vE3fV4Nxg26x7w60WiBuT81GNWNHI3gKMYt1VxTe4HWRPlDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706612912; 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=LCib1Yqr/o156tM8IEhszUaLEdQN6hEM5BBUzYXk4cg=; b=aYMPKEh7p5ce5fOnDriKiEj6g7fg7AwkuWW838Txh5GIS1vRzKdU+Qj/X7euLtc6DcNyDt rcKu4F2X7uLcFwJBfWiVRgarDQfAYZanHlWScgWwTCZJH40EI0EbtAhn12gQEwSDN1iZX2 I/ZaXDzpEFYFCOEV5mrDGxdbg8vop1Fh+xbCU/HARHZPFh5gzcqtciRtbmDATH92y73PuE Q3R9CJbdfBRCfGzaMzNS8BETM5WL0Ebu+Wh4s+AgGiNeoJVaO8ca67dKopfQXC0P3cjm9c w7ZmJMbECyTxAjx5gUBqO1eNbHV9flZ2aTqkcTMzAVOecUe3SV4dGvkyG9uYSA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706612912; a=rsa-sha256; cv=none; b=tnqWvYcZXpvNSr3fkj4RHjRCwZiQq89GaqotUqifp1iDyeaNZocdYxgH18W3tOIyv2q0Zn WvXF80VOx5n3463w9XCLAY5mV1GqAToxSy0v8FXUVzTFnlvJ6KJdNJD6r09ldu5Xh0W3Cz kYLTWsuHTFYMxx2sA1GlIuAbUmkb88K8oyP8b0EIncu8fLb3gYwHmfmp5pNExccvIBFct2 N+xLefX6m86gWWENoK2Xl4LeCJosbil3qTVOmWhZSPOE4HHIS5ZQtcndsve07DKb3JXvSW 4ISi5YaQfPbJD5+/uoPAWKnIcHX+giitpXQpqwSpnz3KuqLseR/YTBFdeSweww== 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 4TPMq40zhSzYXF; Tue, 30 Jan 2024 11:08:32 +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 40UB8WSW076169; Tue, 30 Jan 2024 11:08:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40UB8WB4076166; Tue, 30 Jan 2024 11:08:32 GMT (envelope-from git) Date: Tue, 30 Jan 2024 11:08:32 GMT Message-Id: <202401301108.40UB8WB4076166@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: 406d5c58148c - stable/14 - sound: use device_set_descf() to set device descriptions List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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: 406d5c58148c5cb41c549f60240ddbfe85a8081e Auto-Submitted: auto-generated The branch stable/14 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=406d5c58148c5cb41c549f60240ddbfe85a8081e commit 406d5c58148c5cb41c549f60240ddbfe85a8081e Author: Christos Margiolis AuthorDate: 2024-01-22 09:44:51 +0000 Commit: Christos Margiolis CommitDate: 2024-01-30 11:07:29 +0000 sound: use device_set_descf() to set device descriptions Commit 6b6914c1e21b introduced a printf-like version of device_set_desc(), so use it to simplify device description setting in the audio stack. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: dev_submerge.ch, markj Differential Revision: https://reviews.freebsd.org/D43467 (cherry picked from commit f7d3d0a4ded35ba15d63cdf9287b4a2d6f80da11) --- sys/dev/sound/pci/emu10kx-pcm.c | 4 +--- sys/dev/sound/pci/emu10kx.c | 12 ++---------- sys/dev/sound/pci/hda/hdaa.c | 8 ++------ sys/dev/sound/pci/hda/hdac.c | 6 ++---- sys/dev/sound/pci/hda/hdacc.c | 3 +-- sys/dev/sound/pci/hdspe-pcm.c | 13 +++++-------- sys/dev/sound/usb/uaudio.c | 5 ++--- 7 files changed, 15 insertions(+), 36 deletions(-) diff --git a/sys/dev/sound/pci/emu10kx-pcm.c b/sys/dev/sound/pci/emu10kx-pcm.c index b4633efdddc7..825a39fc4e63 100644 --- a/sys/dev/sound/pci/emu10kx-pcm.c +++ b/sys/dev/sound/pci/emu10kx-pcm.c @@ -1298,7 +1298,6 @@ emu_pcm_probe(device_t dev) { uintptr_t func, route; const char *rt; - char buffer[255]; BUS_READ_IVAR(device_get_parent(dev), dev, EMU_VAR_FUNC, &func); @@ -1328,8 +1327,7 @@ emu_pcm_probe(device_t dev) break; } - snprintf(buffer, 255, "EMU10Kx DSP %s PCM interface", rt); - device_set_desc_copy(dev, buffer); + device_set_descf(dev, "EMU10Kx DSP %s PCM interface", rt); return (0); } diff --git a/sys/dev/sound/pci/emu10kx.c b/sys/dev/sound/pci/emu10kx.c index 29366c3b61f3..6bbbfcc1df0e 100644 --- a/sys/dev/sound/pci/emu10kx.c +++ b/sys/dev/sound/pci/emu10kx.c @@ -2985,7 +2985,6 @@ emu_write_ivar(device_t bus __unused, device_t dev __unused, static int emu_pci_probe(device_t dev) { - struct sbuf *s; unsigned int thiscard = 0; uint16_t vendor; @@ -2997,15 +2996,8 @@ emu_pci_probe(device_t dev) if (thiscard == 0) return (ENXIO); - s = sbuf_new(NULL, NULL, 4096, 0); - if (s == NULL) - return (ENOMEM); - sbuf_printf(s, "Creative %s [%s]", emu_cards[thiscard].desc, emu_cards[thiscard].SBcode); - sbuf_finish(s); - - device_set_desc_copy(dev, sbuf_data(s)); - - sbuf_delete(s); + device_set_descf(dev, "Creative %s [%s]", + emu_cards[thiscard].desc, emu_cards[thiscard].SBcode); return (BUS_PROBE_DEFAULT); } diff --git a/sys/dev/sound/pci/hda/hdaa.c b/sys/dev/sound/pci/hda/hdaa.c index e64eac6114e4..02f4babcd331 100644 --- a/sys/dev/sound/pci/hda/hdaa.c +++ b/sys/dev/sound/pci/hda/hdaa.c @@ -6577,14 +6577,12 @@ static int hdaa_probe(device_t dev) { const char *pdesc; - char buf[128]; if (hda_get_node_type(dev) != HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_AUDIO) return (ENXIO); pdesc = device_get_desc(device_get_parent(dev)); - snprintf(buf, sizeof(buf), "%.*s Audio Function Group", + device_set_descf(dev, "%.*s Audio Function Group", (int)(strlen(pdesc) - 10), pdesc); - device_set_desc_copy(dev, buf); return (BUS_PROBE_DEFAULT); } @@ -6939,7 +6937,6 @@ hdaa_pcm_probe(device_t dev) struct hdaa_devinfo *devinfo = pdevinfo->devinfo; const char *pdesc; char chans1[8], chans2[8]; - char buf[128]; int loc1, loc2, t1, t2; if (pdevinfo->playas >= 0) @@ -6984,7 +6981,7 @@ hdaa_pcm_probe(device_t dev) if (pdevinfo->digital) t1 = -2; pdesc = device_get_desc(device_get_parent(dev)); - snprintf(buf, sizeof(buf), "%.*s (%s%s%s%s%s%s%s%s%s)", + device_set_descf(dev, "%.*s (%s%s%s%s%s%s%s%s%s)", (int)(strlen(pdesc) - 21), pdesc, loc1 >= 0 ? HDA_LOCS[loc1] : "", loc1 >= 0 ? " " : "", (pdevinfo->digital == 0x7)?"HDMI/DP": @@ -6994,7 +6991,6 @@ hdaa_pcm_probe(device_t dev) chans1[0] ? " " : "", chans1, chans2[0] ? "/" : "", chans2, t1 >= 0 ? " " : "", t1 >= 0 ? HDA_DEVS[t1] : ""); - device_set_desc_copy(dev, buf); return (BUS_PROBE_SPECIFIC); } diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c index 2cf9239499af..1f06692ba36e 100644 --- a/sys/dev/sound/pci/hda/hdac.c +++ b/sys/dev/sound/pci/hda/hdac.c @@ -1101,10 +1101,8 @@ hdac_probe(device_t dev) snprintf(desc, sizeof(desc), "Generic (0x%08x)", model); result = BUS_PROBE_GENERIC; } - if (result != ENXIO) { - strlcat(desc, " HDA Controller", sizeof(desc)); - device_set_desc_copy(dev, desc); - } + if (result != ENXIO) + device_set_descf(dev, "%s HDA Controller", desc); return (result); } diff --git a/sys/dev/sound/pci/hda/hdacc.c b/sys/dev/sound/pci/hda/hdacc.c index b551b4b37701..f815e39392d4 100644 --- a/sys/dev/sound/pci/hda/hdacc.c +++ b/sys/dev/sound/pci/hda/hdacc.c @@ -472,8 +472,7 @@ hdacc_probe(device_t dev) hdacc_codecs[i].name, hda_get_device_id(dev)); } else snprintf(buf, sizeof(buf), "Generic (0x%04x)", id); - strlcat(buf, " HDA CODEC", sizeof(buf)); - device_set_desc_copy(dev, buf); + device_set_descf(dev, "%s HDA CODEC", buf); return (BUS_PROBE_DEFAULT); } diff --git a/sys/dev/sound/pci/hdspe-pcm.c b/sys/dev/sound/pci/hdspe-pcm.c index 0360e84fbe91..db39b867879f 100644 --- a/sys/dev/sound/pci/hdspe-pcm.c +++ b/sys/dev/sound/pci/hdspe-pcm.c @@ -1000,23 +1000,20 @@ hdspe_pcm_attach(device_t dev) { char status[SND_STATUSLEN]; struct sc_pcminfo *scp; - char desc[64]; + const char *buf; int err; int play, rec; scp = device_get_ivars(dev); scp->ih = &hdspe_pcm_intr; - bzero(desc, sizeof(desc)); if (scp->hc->ports & HDSPE_CHAN_AIO_ALL) - snprintf(desc, sizeof(desc), "HDSPe AIO [%s]", - scp->hc->descr); + buf = "AIO"; else if (scp->hc->ports & HDSPE_CHAN_RAY_ALL) - snprintf(desc, sizeof(desc), "HDSPe RayDAT [%s]", - scp->hc->descr); + buf = "RayDAT"; else - snprintf(desc, sizeof(desc), "HDSPe ? [%s]", scp->hc->descr); - device_set_desc_copy(dev, desc); + buf = "?"; + device_set_descf(dev, "HDSPe %s [%s]", buf, scp->hc->descr); /* * We don't register interrupt handler with snd_setup_intr diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index ebbff0e633e4..917b6bd3f238 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -1171,7 +1171,7 @@ uaudio_attach_sub(device_t dev, kobj_class_t mixer_class, kobj_class_t chan_clas { struct uaudio_softc *sc = device_get_softc(device_get_parent(dev)); unsigned i = uaudio_get_child_index_by_dev(sc, dev); - char status[SND_STATUSLEN], desc[128]; + char status[SND_STATUSLEN]; uaudio_mixer_init(sc, i); @@ -1199,10 +1199,9 @@ uaudio_attach_sub(device_t dev, kobj_class_t mixer_class, kobj_class_t chan_clas mixer_hwvol_init(dev); - snprintf(desc, sizeof(desc), "%s %s", + device_set_descf(dev, "%s %s", usb_get_manufacturer(sc->sc_udev), usb_get_product(sc->sc_udev)); - device_set_desc_copy(dev, desc); snprintf(status, sizeof(status), "on %s", device_get_nameunit(device_get_parent(dev)));