From nobody Sun Jun 02 23:47:14 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 4VstnH1Pglz5LVjt; Sun, 02 Jun 2024 23:47:15 +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 4VstnG3phGz49n3; Sun, 2 Jun 2024 23:47:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717372034; 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=GhxvWvwXvjy8zTPszkzZLvxE+lS5wMwBXIN9hwWaDCI=; b=f86taatETEwX9vg6PEzaVx4qiHBwXQOmQDG3OCbZJgkapEbJUIzLVTE4lsUVNvXHG5TAQQ /AZYAaOlrBzbi0kh5NPOSkoxlUOMDuBFc0CS3R/qJGjaDzlF3dZ4gddDJVIsOKvj/waBcy 34WsKTsAzXXwRr0zu8MEVO6EBPJc3BBAEVF5xpFPCoXanVc72N5ywgOXhtFIH71aEyodgK Bc2kiGl9IXWlh/pJuPcLPZpciGOK4SA5/eAGuf6szGeK6g7RWdO0/hTVI/+MnC0aaRUdNr lVx8JLUrK3hVL4z5BpHxU/XcbTLuiLFStfmbnsRXSnKIvIKUbt1KGgNZWgphWQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717372034; a=rsa-sha256; cv=none; b=s6A5ZRw7Y/a+0HHZhkir7SIJgTf6GwDDE6EurudVIP0iUgmctKpIRP3Q2g6QtHuN6MlUSI IL2vjPWng9lRTSLF0hu7vrmtomAMFSL9e9/Q55UQ/v0e+JTozx0TMcBqUOobjNCSqArPOt FmzlWI+Vb9kmTCS+B/NvychS4wlpHxN25anpgYFJyvheNRagMKHQCkZ+T646s71KA2sYrZ lUP/8iyUDbCACaGMfEJ6H8x/6qoiXgZLWu6pNwAq174n8VgdT1ZuXBaymZieNIPFYRehJ/ kwmSi7BAG3mNhxaKGdI1mdcZ8ZRTjYGameeHYURHLMVCaeum8dDHhmo8spKLhA== 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=1717372034; 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=GhxvWvwXvjy8zTPszkzZLvxE+lS5wMwBXIN9hwWaDCI=; b=qmOaljH1PbhC7RfX2lvIl60z4UyFBMRlVex4XGjRmfGXVGnn/uKf7zDqdlEleqlOb4KOTh tBli43BYIlat0FnjHKoNOgp2/ouPe4A1jHoPJm+MYOAi8eJfRr1Oa7J4zj7gdDRSSDn0Ab ilbbsP76lyogp4wwXzDSDStaZC6FluMe1ttMmOp8wV6PKoNawYCjWOCMD49ZwVFFtcFzEM Vgld6AiFoHgynb6YZmw62lyK3Lxlz4N4GekHVZWuW4cwYO70+71wSPwjGc/gEjkjdKlLtj wskLqnT7RRF1AZYaKv/ME+BpJk1+YreD12bu5uzaWTXgz69lLjpBqbMg1nURLg== 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 4VstnG3Jk4z1BSS; Sun, 2 Jun 2024 23:47:14 +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 452NlEHq056509; Sun, 2 Jun 2024 23:47:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 452NlEvM056506; Sun, 2 Jun 2024 23:47:14 GMT (envelope-from git) Date: Sun, 2 Jun 2024 23:47:14 GMT Message-Id: <202406022347.452NlEvM056506@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a866a40b9b80 - main - bhnd: Use device_set_descf() 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a866a40b9b8095a1a31eb22d575535c1f5fbc080 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a866a40b9b8095a1a31eb22d575535c1f5fbc080 commit a866a40b9b8095a1a31eb22d575535c1f5fbc080 Author: Mark Johnston AuthorDate: 2024-02-04 23:35:02 +0000 Commit: Mark Johnston CommitDate: 2024-06-02 23:38:40 +0000 bhnd: Use device_set_descf() Here we are in a device probe routine with no locks held. M_WAITOK allocations are ok. No functional change intended. MFC after: 1 week --- sys/dev/bhnd/bhnd_subr.c | 20 ++------------------ sys/dev/bhnd/cores/chipc/bhnd_pmu_chipc.c | 4 +--- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/sys/dev/bhnd/bhnd_subr.c b/sys/dev/bhnd/bhnd_subr.c index 0d38c1ca8a24..1c456ed1cddf 100644 --- a/sys/dev/bhnd/bhnd_subr.c +++ b/sys/dev/bhnd/bhnd_subr.c @@ -1765,18 +1765,10 @@ void bhnd_set_custom_core_desc(device_t dev, const char *dev_name) { const char *vendor_name; - char *desc; vendor_name = bhnd_get_vendor_name(dev); - asprintf(&desc, M_BHND, "%s %s, rev %hhu", vendor_name, dev_name, + device_set_descf(dev, "%s %s, rev %hhu", vendor_name, dev_name, bhnd_get_hwrev(dev)); - - if (desc != NULL) { - device_set_desc_copy(dev, desc); - free(desc, M_BHND); - } else { - device_set_desc(dev, dev_name); - } } /** @@ -1802,7 +1794,6 @@ void bhnd_set_default_bus_desc(device_t dev, const struct bhnd_chipid *chip_id) { const char *bus_name; - char *desc; char chip_name[BHND_CHIPID_MAX_NAMELEN]; /* Determine chip type's bus name */ @@ -1827,14 +1818,7 @@ bhnd_set_default_bus_desc(device_t dev, const struct bhnd_chipid *chip_id) chip_id->chip_id); /* Format and set device description */ - asprintf(&desc, M_BHND, "%s %s", chip_name, bus_name); - if (desc != NULL) { - device_set_desc_copy(dev, desc); - free(desc, M_BHND); - } else { - device_set_desc(dev, bus_name); - } - + device_set_descf(dev, "%s %s", chip_name, bus_name); } /** diff --git a/sys/dev/bhnd/cores/chipc/bhnd_pmu_chipc.c b/sys/dev/bhnd/cores/chipc/bhnd_pmu_chipc.c index 95b19d973e26..ce50fcd0ee1f 100644 --- a/sys/dev/bhnd/cores/chipc/bhnd_pmu_chipc.c +++ b/sys/dev/bhnd/cores/chipc/bhnd_pmu_chipc.c @@ -62,7 +62,6 @@ bhnd_pmu_chipc_probe(device_t dev) struct chipc_caps *ccaps; struct chipc_softc *chipc_sc; device_t chipc; - char desc[34]; int error; uint32_t pcaps; uint8_t rev; @@ -87,8 +86,7 @@ bhnd_pmu_chipc_probe(device_t dev) /* Set description */ rev = BHND_PMU_GET_BITS(pcaps, BHND_PMU_CAP_REV); - snprintf(desc, sizeof(desc), "Broadcom ChipCommon PMU, rev %hhu", rev); - device_set_desc_copy(dev, desc); + device_set_descf(dev, "Broadcom ChipCommon PMU, rev %hhu", rev); return (BUS_PROBE_NOWILDCARD); }