From nobody Sun Jun 02 23:47:13 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VstnF5vMTz5LVPt; Sun, 02 Jun 2024 23:47:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VstnF2tr0z49mm; Sun, 2 Jun 2024 23:47:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717372033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NMDiuda9aUBSOj8uwiztn4+fxb7XE2DxYXFV5vV/PvY=; b=PNw2dHXRM49bvBhO4mfGZ2PTxghxyDAd2I9FMA8l6TEn6DQAVgB6NIrqnb9gITgQ3nInSb mtv2FtptJzk5mLQt8lr5S+2zQLI8ZsK9DIhJODlffSVdlo4wjVfUYIZ+P6l/3quYDBVRPB wBd3jnZH/a1xMZk/oNTPdlO4B705VMp45oAG0U6ZfccJr2SOAa/gudPjjn0nKn1an63Sc3 1+213af/H9HA4U/MOFdRcgg/SlNXiFQVnTz5JOAAjfqyJDLJ4h0OVYooScDCroY5va13fe eDNRS4LcSTjWKRani12C02YcKl71LbeVn6c78hwuP2rvDVhOLyuc95DxMJOWqw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717372033; a=rsa-sha256; cv=none; b=GviHbGkwI2e6rV8oUSGmkcOL0f9TnF0euCLiAqg+rIl0Xb1kES5gDIoyRKdMA70u/hqcou PorNksx9mGE75uzes0gxk/X1M59tGde8wLomoFuFRBgFaMhkDUAKBVsGAiG0IUCmxNAUL3 EyQiD3bIo2HDrjCD2dv5EHk+8Hq4bEg4EA/bblKxk5caQ1bw14E0Y7c6Oc+E3oOh19iaqF Wf/gtd/xZTwIHSlAJwSc6non4mObc84mGag6fY0DATJIHoPP4Vwaio4j/GXPpEUD67kpC1 kndA5KpQ3eSwWPGjFZIj52z6owGLAllkBW+Q0OR7Ksq4L/kwRp1BZTljprbzPw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717372033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NMDiuda9aUBSOj8uwiztn4+fxb7XE2DxYXFV5vV/PvY=; b=YbKiBSQ2vo8P1KdRCay1FdR8Z0mt8BvyD7mPxlsPAIPSw7EGh29RzA24J4baHoFGjiYQtZ VK/VYnQxs646rpbalQlJy3uoI1bXcL/M8VtGS8rVfYb9Wo0cf0DUMVKQwglriK2VKm2u4R 5clgtwQTZH9tVI7qhESs2eYjkdGcldUZ9IfqDCm00CnyYazTbB7CZ/DFiZzZiR6oaxIQsp w0CbD2e92ArxokCboGjAQYhXdvK82HVgVLpdeXXXq4L8IHBk7cLQOFxlfR/Z8+z1/QGaqh 3527cip4w4DZd6cOWrlqhlNQouFjn79qwl2mOH6WQ1xXxWhVNHaOMMtvl50VXA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VstnF2HfHz1BfT; Sun, 2 Jun 2024 23:47:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 452NlDEJ056473; Sun, 2 Jun 2024 23:47:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 452NlDqf056470; Sun, 2 Jun 2024 23:47:13 GMT (envelope-from git) Date: Sun, 2 Jun 2024 23:47:13 GMT Message-Id: <202406022347.452NlDqf056470@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 25b839dfd2aa - main - ata: Use device_set_descf() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 25b839dfd2aa60640c7b92abc69b11c107a95020 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=25b839dfd2aa60640c7b92abc69b11c107a95020 commit 25b839dfd2aa60640c7b92abc69b11c107a95020 Author: Mark Johnston AuthorDate: 2024-02-04 23:33:05 +0000 Commit: Mark Johnston 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);