Page MenuHomeFreeBSD

Conversion to device_set_descf()

Authored By
christos
Jan 10 2024, 11:01 PM
Size
4 KB
Referenced Files
None
Subscribers
None

Conversion to device_set_descf()

diff --git a/sys/dev/sound/pci/emu10kx-pcm.c b/sys/dev/sound/pci/emu10kx-pcm.c
index 661d65165190..739f6738c695 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 1831ae0c1f19..07f28e7229e8 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 b3daed4d9599..f2c65c80dabe 100644
--- a/sys/dev/sound/pci/hdspe-pcm.c
+++ b/sys/dev/sound/pci/hdspe-pcm.c
@@ -694,15 +694,12 @@ hdspe_pcm_attach(device_t dev)
{
char status[SND_STATUSLEN];
struct sc_pcminfo *scp;
- char desc[64];
int i, err;
scp = device_get_ivars(dev);
scp->ih = &hdspe_pcm_intr;
- bzero(desc, sizeof(desc));
- snprintf(desc, sizeof(desc), "HDSPe AIO [%s]", scp->hc->descr);
- device_set_desc_copy(dev, desc);
+ device_set_descf(dev, "HDSPe AIO [%s]", scp->hc->descr);
/*
* We don't register interrupt handler with snd_setup_intr

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
7328005
Default Alt Text
Conversion to device_set_descf() (4 KB)

Event Timeline