git: 796bcf184518 - main - cxgb: Use device_set_descf()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Sun, 02 Jun 2024 23:47:15 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=796bcf184518ad7ac75b4abfd2bd351ea417fdb6

commit 796bcf184518ad7ac75b4abfd2bd351ea417fdb6
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-02-04 23:36:54 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-06-02 23:38:40 +0000

    cxgb: Use device_set_descf()
    
    No functional change intended.
    
    MFC after:      1 week
---
 sys/dev/cxgb/cxgb_main.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/sys/dev/cxgb/cxgb_main.c b/sys/dev/cxgb/cxgb_main.c
index 1a088cdf0abe..c5fc067f8312 100644
--- a/sys/dev/cxgb/cxgb_main.c
+++ b/sys/dev/cxgb/cxgb_main.c
@@ -360,7 +360,7 @@ static int
 cxgb_controller_probe(device_t dev)
 {
 	const struct adapter_info *ai;
-	char *ports, buf[80];
+	const char *ports;
 	int nports;
 
 	ai = cxgb_get_adapter_info(dev);
@@ -373,8 +373,7 @@ cxgb_controller_probe(device_t dev)
 	else
 		ports = "ports";
 
-	snprintf(buf, sizeof(buf), "%s, %d %s", ai->desc, nports, ports);
-	device_set_desc_copy(dev, buf);
+	device_set_descf(dev, "%s, %d %s", ai->desc, nports, ports);
 	return (BUS_PROBE_DEFAULT);
 }
 
@@ -447,7 +446,6 @@ cxgb_controller_attach(device_t dev)
 	uint32_t vers;
 	int port_qsets = 1;
 	int msi_needed, reg;
-	char buf[80];
 
 	sc = device_get_softc(dev);
 	sc->dev = dev;
@@ -659,10 +657,9 @@ cxgb_controller_attach(device_t dev)
 	    G_FW_VERSION_MAJOR(vers), G_FW_VERSION_MINOR(vers),
 	    G_FW_VERSION_MICRO(vers));
 
-	snprintf(buf, sizeof(buf), "%s %sNIC\t E/C: %s S/N: %s",
-		 ai->desc, is_offload(sc) ? "R" : "",
-		 sc->params.vpd.ec, sc->params.vpd.sn);
-	device_set_desc_copy(dev, buf);
+	device_set_descf(dev, "%s %sNIC\t E/C: %s S/N: %s",
+	    ai->desc, is_offload(sc) ? "R" : "",
+	    sc->params.vpd.ec, sc->params.vpd.sn);
 
 	snprintf(&sc->port_types[0], sizeof(sc->port_types), "%x%x%x%x",
 		 sc->params.vpd.port_type[0], sc->params.vpd.port_type[1],
@@ -966,13 +963,11 @@ static int
 cxgb_port_probe(device_t dev)
 {
 	struct port_info *p;
-	char buf[80];
 	const char *desc;
 	
 	p = device_get_softc(dev);
 	desc = p->phy.desc;
-	snprintf(buf, sizeof(buf), "Port %d %s", p->port_id, desc);
-	device_set_desc_copy(dev, buf);
+	device_set_descf(dev, "Port %d %s", p->port_id, desc);
 	return (0);
 }