From nobody Mon Jan 22 09:46:03 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 4TJQMb3dKMz57Xdl; Mon, 22 Jan 2024 09:46:03 +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 4TJQMb2xl0z4Pg5; Mon, 22 Jan 2024 09:46:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705916763; 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=iJ7ldwSSvGZcBIl/add3Sl20Vj/dOSKIhH/VIhynXrQ=; b=heKhmyuOvSlOTKG/i8OBjZ/0bNCjDT85pnt4jzI1jDQhpYV3V6RcA/AHtg5tq6TMrWxz19 /LX6w4EsJiOS/CKrlemdgKF8F8w6l5YGvfxPDQVde+06i8DSDG7XbcnMtBhq4XoU7xRm8G mWeltKM+ssPOt/k4pM/9cgbcXbNnwly/VCI/Xe2U99pzyabBgS4LNmyhWqmpK0ZgWzfPxW l+0GeG23m+QK0uIW6cuEtEksOb1l7i3pjrWIo1sBGlcHEAFm21/5oiXkwcHNXVJvrRg6M4 Vuyi0hGDugfaYqjk0WjBMszJp93HZQLiW3fvwVfagY35sRTb1gmEeZA0O830Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705916763; 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=iJ7ldwSSvGZcBIl/add3Sl20Vj/dOSKIhH/VIhynXrQ=; b=BqKKmUmu9xMfx+wRR3jUyPgcNgZvsN+g9mrelncIQUgFfaAig3ucLHN1auESrp6bFuB/Xi rBNYDGVrIe+f1wB+qZVIkABzwcnoNZOvZYCOfSiTOmbygXQwcg1gY6yTkAQXa8be30q0Od 6EMMtEytvqoNiRKHZ1ny2zoNKMLwG/DWAcxNSxXqbkZb3TV0c/bOMlPQDWsuGIVMSJvTZL Q8JgYs3gzYLgMfaGLKgm0BlY3YTaH5JD6rMyiO6MpBeDLDXBVaoEOGJWxMXAxKdfo406JA 1O3hiAcXsjNQjeeZ7nirFXHuN7Guw2hIRUMXVT2cEXwHN2WDtFOWiygwGn0XoA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705916763; a=rsa-sha256; cv=none; b=xvsOyoucil+BzZXMx/69Q5Oq0YOzamW8S0kFgCdB8g7lEV/LYIoZdkuauzgAtssokoiiUa 0PfhavaDGf2fUwWB5ZhBd0xNWvCVSzSrd8x4XBe4NEfJ15/AqsbLUIMIdNl89VYlhXIYQU o766H24hfvEJQbAy8G5DOolxDf5cNQtK3UFUmBmbOCsue6DthrNJWg20kilwPvmXuRESv+ Bd5ydheV1UexF0Hk8utEdAR+caAAGn2sd3E53krLNmbgg1SUt7Ni7e2yjtvV6BphMl53wD Dwmx7251vha+uRoAjG4vKDUqHN+6+B/Z+QJjh1ynCOPWuQa1BQzsfs6Ry1G6Ag== 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 4TJQMb20DgzxMf; Mon, 22 Jan 2024 09:46:03 +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 40M9k3Ts027018; Mon, 22 Jan 2024 09:46:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40M9k3kf027015; Mon, 22 Jan 2024 09:46:03 GMT (envelope-from git) Date: Mon, 22 Jan 2024 09:46:03 GMT Message-Id: <202401220946.40M9k3kf027015@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: f7d3d0a4ded3 - main - sound: use device_set_descf() to set device descriptions 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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/main X-Git-Reftype: branch X-Git-Commit: f7d3d0a4ded35ba15d63cdf9287b4a2d6f80da11 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=f7d3d0a4ded35ba15d63cdf9287b4a2d6f80da11 commit f7d3d0a4ded35ba15d63cdf9287b4a2d6f80da11 Author: Christos Margiolis AuthorDate: 2024-01-22 09:44:51 +0000 Commit: Christos Margiolis CommitDate: 2024-01-22 09:44:51 +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 --- 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)));