git: 25b839dfd2aa - main - ata: Use device_set_descf()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 02 Jun 2024 23:47:13 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=25b839dfd2aa60640c7b92abc69b11c107a95020
commit 25b839dfd2aa60640c7b92abc69b11c107a95020
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-02-04 23:33:05 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-06-02 23:38:40 +0000
ata: Use device_set_descf()
No functional change intended.
MFC after: 1 week
---
sys/dev/ata/ata-pci.c | 8 ++------
sys/dev/ata/chipsets/ata-highpoint.c | 15 +++++++--------
sys/dev/ata/chipsets/ata-jmicron.c | 4 +---
sys/dev/ata/chipsets/ata-promise.c | 14 ++++++--------
sys/dev/ata/chipsets/ata-sis.c | 13 ++++++-------
5 files changed, 22 insertions(+), 32 deletions(-)
diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c
index 9cc815150665..436601267012 100644
--- a/sys/dev/ata/ata-pci.c
+++ b/sys/dev/ata/ata-pci.c
@@ -60,7 +60,6 @@ int
ata_pci_probe(device_t dev)
{
struct ata_pci_controller *ctlr = device_get_softc(dev);
- char buffer[64];
/* is this a storage class device ? */
if (pci_get_class(dev) != PCIC_STORAGE)
@@ -70,8 +69,7 @@ ata_pci_probe(device_t dev)
if (pci_get_subclass(dev) != PCIS_STORAGE_IDE)
return (ENXIO);
- sprintf(buffer, "%s ATA controller", ata_pcivendor2str(dev));
- device_set_desc_copy(dev, buffer);
+ device_set_descf(dev, "%s ATA controller", ata_pcivendor2str(dev));
ctlr->chipinit = ata_generic_chipinit;
/* we are a low priority handler */
@@ -831,12 +829,10 @@ void
ata_set_desc(device_t dev)
{
struct ata_pci_controller *ctlr = device_get_softc(dev);
- char buffer[128];
- sprintf(buffer, "%s %s %s controller",
+ device_set_descf(dev, "%s %s %s controller",
ata_pcivendor2str(dev), ctlr->chip->text,
ata_mode2str(ctlr->chip->max_dma));
- device_set_desc_copy(dev, buffer);
}
const struct ata_chip_id *
diff --git a/sys/dev/ata/chipsets/ata-highpoint.c b/sys/dev/ata/chipsets/ata-highpoint.c
index bf9dfd22e6ad..23ddf05a5f51 100644
--- a/sys/dev/ata/chipsets/ata-highpoint.c
+++ b/sys/dev/ata/chipsets/ata-highpoint.c
@@ -81,7 +81,7 @@ ata_highpoint_probe(device_t dev)
{ ATA_HPT366, 0x00, HPT_366, HPT_OLD, ATA_UDMA4, "HPT366" },
{ ATA_HPT302, 0x01, HPT_372, 0, ATA_UDMA6, "HPT302" },
{ 0, 0, 0, 0, 0, 0}};
- char buffer[64];
+ const char *channel;
if (pci_get_vendor(dev) != ATA_HIGHPOINT_ID)
return ENXIO;
@@ -89,16 +89,15 @@ ata_highpoint_probe(device_t dev)
if (!(idx = ata_match_chip(dev, ids)))
return ENXIO;
- strcpy(buffer, "HighPoint ");
- strcat(buffer, idx->text);
+ channel = "";
if (idx->cfg1 == HPT_374) {
if (pci_get_function(dev) == 0)
- strcat(buffer, " (channel 0+1)");
- if (pci_get_function(dev) == 1)
- strcat(buffer, " (channel 2+3)");
+ channel = " (channel 0+1)";
+ else if (pci_get_function(dev) == 1)
+ channel = " (channel 2+3)";
}
- sprintf(buffer, "%s %s controller", buffer, ata_mode2str(idx->max_dma));
- device_set_desc_copy(dev, buffer);
+ device_set_descf(dev, "Highpoint %s%s %s controller",
+ idx->text, channel, ata_mode2str(idx->max_dma));
ctlr->chip = idx;
ctlr->chipinit = ata_highpoint_chipinit;
return (BUS_PROBE_LOW_PRIORITY);
diff --git a/sys/dev/ata/chipsets/ata-jmicron.c b/sys/dev/ata/chipsets/ata-jmicron.c
index a24eb18f59da..0ae80d2a85a1 100644
--- a/sys/dev/ata/chipsets/ata-jmicron.c
+++ b/sys/dev/ata/chipsets/ata-jmicron.c
@@ -72,7 +72,6 @@ ata_jmicron_probe(device_t dev)
{ ATA_JMB368, 0, 0, 1, ATA_UDMA6, "JMB368" },
{ ATA_JMB368_2, 0, 0, 1, ATA_UDMA6, "JMB368" },
{ 0, 0, 0, 0, 0, 0}};
- char buffer[64];
if (pci_get_vendor(dev) != ATA_JMICRON_ID)
return ENXIO;
@@ -80,9 +79,8 @@ ata_jmicron_probe(device_t dev)
if (!(idx = ata_match_chip(dev, ids)))
return ENXIO;
- sprintf(buffer, "JMicron %s %s controller",
+ device_set_descf(dev, "JMicron %s %s controller",
idx->text, ata_mode2str(idx->max_dma));
- device_set_desc_copy(dev, buffer);
ctlr->chip = idx;
ctlr->chipinit = ata_jmicron_chipinit;
return (BUS_PROBE_LOW_PRIORITY);
diff --git a/sys/dev/ata/chipsets/ata-promise.c b/sys/dev/ata/chipsets/ata-promise.c
index 86cb0c4fe6c4..15c6ae84c1bb 100644
--- a/sys/dev/ata/chipsets/ata-promise.c
+++ b/sys/dev/ata/chipsets/ata-promise.c
@@ -166,7 +166,7 @@ ata_promise_probe(device_t dev)
{ ATA_PDC40719, 0, PR_MIO, PR_SATA2, ATA_SA300, "PDC40719" },
{ ATA_PDC40779, 0, PR_MIO, PR_SATA2, ATA_SA300, "PDC40779" },
{ 0, 0, 0, 0, 0, 0}};
- char buffer[64];
+ const char *channel;
uintptr_t devid = 0;
if (pci_get_vendor(dev) != ATA_PROMISE_ID)
@@ -182,10 +182,8 @@ ata_promise_probe(device_t dev)
devid == ATA_I960RM)
return ENXIO;
- strcpy(buffer, "Promise ");
- strcat(buffer, idx->text);
-
/* if we are on a FastTrak TX4, adjust the interrupt resource */
+ channel = NULL;
if ((idx->cfg2 & PR_TX4) && pci_get_class(GRANDPARENT(dev))==PCIC_BRIDGE &&
!BUS_READ_IVAR(device_get_parent(GRANDPARENT(dev)),
GRANDPARENT(dev), PCI_IVAR_DEVID, &devid) &&
@@ -194,18 +192,18 @@ ata_promise_probe(device_t dev)
if (pci_get_slot(dev) == 1) {
bus_get_resource(dev, SYS_RES_IRQ, 0, &start, &end);
- strcat(buffer, " (channel 0+1)");
+ channel = " (channel 0+1)";
}
else if (pci_get_slot(dev) == 2 && start && end) {
bus_set_resource(dev, SYS_RES_IRQ, 0, start, end);
- strcat(buffer, " (channel 2+3)");
+ channel = " (channel 2+3)";
}
else {
start = end = 0;
}
}
- sprintf(buffer, "%s %s controller", buffer, ata_mode2str(idx->max_dma));
- device_set_desc_copy(dev, buffer);
+ device_set_descf(dev, "Promise %s%s %s controller", idx->text,
+ channel == NULL ? "" : channel, ata_mode2str(idx->max_dma));
ctlr->chip = idx;
ctlr->chipinit = ata_promise_chipinit;
return (BUS_PROBE_LOW_PRIORITY);
diff --git a/sys/dev/ata/chipsets/ata-sis.c b/sys/dev/ata/chipsets/ata-sis.c
index bf4c5c744289..b31d76fe3f7c 100644
--- a/sys/dev/ata/chipsets/ata-sis.c
+++ b/sys/dev/ata/chipsets/ata-sis.c
@@ -101,7 +101,6 @@ ata_sis_probe(device_t dev)
{ 0, 0, 0, 0, 0, 0 }};
static struct ata_chip_id id[] =
{{ ATA_SISSOUTH, 0x10, 0, 0, 0, "" }, { 0, 0, 0, 0, 0, 0 }};
- char buffer[64];
int found = 0;
if (pci_get_class(dev) != PCIC_STORAGE)
@@ -122,8 +121,8 @@ ata_sis_probe(device_t dev)
memcpy(&id[0], idx, sizeof(id[0]));
id[0].cfg1 = SIS_133NEW;
id[0].max_dma = ATA_UDMA6;
- sprintf(buffer, "SiS 962/963 %s controller",
- ata_mode2str(idx->max_dma));
+ device_set_descf(dev, "SiS 962/963 %s controller",
+ ata_mode2str(idx->max_dma));
}
pci_write_config(dev, 0x57, reg57, 1);
}
@@ -140,17 +139,17 @@ ata_sis_probe(device_t dev)
id[0].cfg1 = SIS_100NEW;
id[0].max_dma = ATA_UDMA5;
}
- sprintf(buffer, "SiS 961 %s controller",ata_mode2str(idx->max_dma));
+ device_set_descf(dev, "SiS 961 %s controller",
+ ata_mode2str(idx->max_dma));
}
pci_write_config(dev, 0x4a, reg4a, 1);
}
if (!found)
- sprintf(buffer,"SiS %s %s controller",
- idx->text, ata_mode2str(idx->max_dma));
+ device_set_descf(dev, "SiS %s %s controller",
+ idx->text, ata_mode2str(idx->max_dma));
else
idx = &id[0];
- device_set_desc_copy(dev, buffer);
ctlr->chip = idx;
ctlr->chipinit = ata_sis_chipinit;
return (BUS_PROBE_LOW_PRIORITY);