git: ea71ec44e200 - stable/14 - virtio: Use device_set_descf()

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

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

commit ea71ec44e20079fb922dff7df8a06495768ddae7
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-02-04 23:52:23 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-06-09 13:37:56 +0000

    virtio: Use device_set_descf()
    
    No functional change intended.
    
    MFC after:      1 week
    
    (cherry picked from commit de140d60d5282b0dbf79979d04d5b6b11511e25d)
---
 sys/dev/virtio/pci/virtio_pci_legacy.c | 4 +---
 sys/dev/virtio/pci/virtio_pci_modern.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/sys/dev/virtio/pci/virtio_pci_legacy.c b/sys/dev/virtio/pci/virtio_pci_legacy.c
index 88a8323bdd6f..cf574160cdd4 100644
--- a/sys/dev/virtio/pci/virtio_pci_legacy.c
+++ b/sys/dev/virtio/pci/virtio_pci_legacy.c
@@ -191,7 +191,6 @@ DRIVER_MODULE(virtio_pci_legacy, pci, vtpci_legacy_driver, 0, 0);
 static int
 vtpci_legacy_probe(device_t dev)
 {
-	char desc[64];
 	const char *name;
 
 	if (pci_get_vendor(dev) != VIRTIO_PCI_VENDORID)
@@ -208,8 +207,7 @@ vtpci_legacy_probe(device_t dev)
 	if (name == NULL)
 		name = "Unknown";
 
-	snprintf(desc, sizeof(desc), "VirtIO PCI (legacy) %s adapter", name);
-	device_set_desc_copy(dev, desc);
+	device_set_descf(dev, "VirtIO PCI (legacy) %s adapter", name);
 
 	/* Prefer transitional modern VirtIO PCI. */
 	return (BUS_PROBE_LOW_PRIORITY);
diff --git a/sys/dev/virtio/pci/virtio_pci_modern.c b/sys/dev/virtio/pci/virtio_pci_modern.c
index 2fa921dd9141..2e59448b4b5e 100644
--- a/sys/dev/virtio/pci/virtio_pci_modern.c
+++ b/sys/dev/virtio/pci/virtio_pci_modern.c
@@ -245,7 +245,6 @@ DRIVER_MODULE(virtio_pci_modern, pci, vtpci_modern_driver, 0, 0);
 static int
 vtpci_modern_probe(device_t dev)
 {
-	char desc[64];
 	const char *name;
 	uint16_t devid;
 
@@ -270,8 +269,7 @@ vtpci_modern_probe(device_t dev)
 	if (name == NULL)
 		name = "Unknown";
 
-	snprintf(desc, sizeof(desc), "VirtIO PCI (modern) %s adapter", name);
-	device_set_desc_copy(dev, desc);
+	device_set_descf(dev, "VirtIO PCI (modern) %s adapter", name);
 
 	return (BUS_PROBE_DEFAULT);
 }