git: 3f6fc84ad947 - stable/14 - proto: Use device_set_descf()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Sun, 09 Jun 2024 14:12:14 UTC
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=3f6fc84ad9475501913d718770ec67d972917637

commit 3f6fc84ad9475501913d718770ec67d972917637
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-02-04 23:58:30 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-06-09 13:37:59 +0000

    proto: Use device_set_descf()
    
    No functional change intended.
    
    MFC after:      1 week
    
    (cherry picked from commit 542f9494b747079b13f3ed672cd01fa902e98ff2)
---
 sys/dev/proto/proto_bus_isa.c |  8 +-------
 sys/dev/proto/proto_bus_pci.c | 12 +++---------
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/sys/dev/proto/proto_bus_isa.c b/sys/dev/proto/proto_bus_isa.c
index 31c65b9d7857..7176543345a7 100644
--- a/sys/dev/proto/proto_bus_isa.c
+++ b/sys/dev/proto/proto_bus_isa.c
@@ -33,7 +33,6 @@
 #include <machine/bus.h>
 #include <sys/rman.h>
 #include <machine/resource.h>
-#include <sys/sbuf.h>
 
 #include <isa/isavar.h>
 #include <isa/pnpvar.h>
@@ -63,7 +62,6 @@ static char **proto_isa_devnames;
 static int
 proto_isa_probe(device_t dev)
 {
-	struct sbuf *sb;
 	struct resource *res;
 	int rid, type;
 
@@ -77,11 +75,7 @@ proto_isa_probe(device_t dev)
 	if (res == NULL)
 		return (ENODEV);
 
-	sb = sbuf_new_auto();
-	sbuf_printf(sb, "%s:%#jx", proto_isa_prefix, rman_get_start(res));
-	sbuf_finish(sb);
-	device_set_desc_copy(dev, sbuf_data(sb));
-	sbuf_delete(sb);
+	device_set_descf(dev, "%s:%#jx", proto_isa_prefix, rman_get_start(res));
 	bus_release_resource(dev, type, rid, res);
 	return (proto_probe(dev, proto_isa_prefix, &proto_isa_devnames));
 }
diff --git a/sys/dev/proto/proto_bus_pci.c b/sys/dev/proto/proto_bus_pci.c
index 326f1105f1a5..015a2c53d526 100644
--- a/sys/dev/proto/proto_bus_pci.c
+++ b/sys/dev/proto/proto_bus_pci.c
@@ -33,7 +33,6 @@
 #include <machine/bus.h>
 #include <sys/rman.h>
 #include <machine/resource.h>
-#include <sys/sbuf.h>
 
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
@@ -63,17 +62,12 @@ static char **proto_pci_devnames;
 static int
 proto_pci_probe(device_t dev)
 {
-	struct sbuf *sb;
-
 	if ((pci_read_config(dev, PCIR_HDRTYPE, 1) & PCIM_HDRTYPE) != 0)
 		return (ENXIO);
 
-	sb = sbuf_new_auto();
-	sbuf_printf(sb, "%s%d:%d:%d:%d", proto_pci_prefix, pci_get_domain(dev),
-	    pci_get_bus(dev), pci_get_slot(dev), pci_get_function(dev));
-	sbuf_finish(sb);
-	device_set_desc_copy(dev, sbuf_data(sb));
-	sbuf_delete(sb);
+	device_set_descf(dev, "%s%d:%d:%d:%d", proto_pci_prefix,
+	    pci_get_domain(dev), pci_get_bus(dev), pci_get_slot(dev),
+	    pci_get_function(dev));
 	return (proto_probe(dev, proto_pci_prefix, &proto_pci_devnames));
 }