From nobody Thu Jan 02 18:28:19 2025 X-Original-To: dev-commits-src-all@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 4YPFZX3N8tz5jnRY; Thu, 02 Jan 2025 18:28:20 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YPFZX0PnBz4tkn; Thu, 2 Jan 2025 18:28:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1735842500; 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=SfnsgeHg5AG1ObPzoRmsrcZkOJlBwNgFrEbrK0YY9YE=; b=q/WpzYRgCQS5m/T50pduAEZZxrN6Q0w9ZriiWBNjfdCIFu7PQCxSkt3gIGatTRJsbIMY8s Sou8VfJjU/S8wnCdhqTppo8KohiIIZE+XLXPYxUyINUMfjjixXxYZdgF7GGgPRRpQlI1u/ AnCdmRlmNPN6tEAgMrZV1pCU8/EisgZCxDKPmSUVGhxKagHTFyH/TvBu9TIF45NLfPDg0f cgolMXW2jNlF8BylYTx6R3ua+m9e5JqzwPYN6yksQXUCZQxYrJexF37zuzFQosLEzBROcQ cO9LCUan96WiSuIQCpUM+Zq389J/QG3qjPms7jVsWnYe7OUr9Hy4D1IxYd+GWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1735842500; 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=SfnsgeHg5AG1ObPzoRmsrcZkOJlBwNgFrEbrK0YY9YE=; b=tBjB8bhf9skUFrHtL8s+nJMdDR04Ee/vr4T4uZT4MfJ4Eo5IelpV3lPJLolKNUf7Y48BXO ro/o0OAMTSKf7SENrmY/bthpHAt+qytqNzDv1yxxvt96ssvy9koMATkep/JY+1cZwQBfMM i0pQsjQEGpil0coibbFsGmrW3KL8J41K3Q8FyPMCOlvKofwC1nu9LvmTeV2y6cR02aTpR/ mBRKbIeiegmpoRsB8T5pVfWYjE/XSVfh6xL/TBLHAwJdH1nBPHY6r7Ym26wjoHvbiOKNvH q4/WimMucrniPhnKB+HqwdymLighHr/58LenLuwK8s4/HxGOm0BCgNIwzbnNWQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1735842500; a=rsa-sha256; cv=none; b=RT/OUUi9GQjz3+LnxLtMWNiyF/7xcsg+3FJ4/1m2JPXQAjjV/wlg5S5U5rNwYxIDLXtFAE ffkOnDuk18A/TfUvSOVZp636/nDI/7hBxlZRTB+U6MVnFY7VGlROzgYjA+9/uZbeLLLn9k vlU8fST9HogZeAPYdCeWGKI0k9aE29sval2BpImBEyaOlSa1sIup6OKpC/3UPEyOH/Pmfc Jczyed2hkRnAWRZ6LZbZxxRCO6eKk2CU62qBxP7f9WeWeWHfH53YzXScVNL12aalV2zgwf 1enJErxFOgcqrqF5J78AJoMSw5RfdznVkCocE3eekjAYoUs7fkzqDErCUF1eEQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YPFZW71g9zpRy; Thu, 02 Jan 2025 18:28:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 502ISJSH066160; Thu, 2 Jan 2025 18:28:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 502ISJ3Y066157; Thu, 2 Jan 2025 18:28:19 GMT (envelope-from git) Date: Thu, 2 Jan 2025 18:28:19 GMT Message-Id: <202501021828.502ISJ3Y066157@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: cf416f56eb73 - main - Use the new bus_generic_detach directly in place of home-grown versions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf416f56eb73006b32f9279da6a848299ede3f1d Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=cf416f56eb73006b32f9279da6a848299ede3f1d commit cf416f56eb73006b32f9279da6a848299ede3f1d Author: John Baldwin AuthorDate: 2025-01-02 18:22:20 +0000 Commit: John Baldwin CommitDate: 2025-01-02 18:22:20 +0000 Use the new bus_generic_detach directly in place of home-grown versions Differential Revision: https://reviews.freebsd.org/D47960 --- sys/dev/bwn/if_bwn_pci.c | 13 +------------ sys/dev/iicbus/iicbb.c | 13 +------------ sys/dev/imcsmb/imcsmb.c | 27 +-------------------------- sys/dev/imcsmb/imcsmb_pci.c | 27 +-------------------------- sys/dev/p2sb/lewisburg_gpiocm.c | 14 +------------- sys/dev/pci/vga_pci.c | 13 +------------ sys/dev/ppbus/ppbconf.c | 17 +---------------- sys/dev/pwm/pwmbus.c | 13 +------------ sys/dev/usb/misc/cp2112.c | 17 ++--------------- 9 files changed, 10 insertions(+), 144 deletions(-) diff --git a/sys/dev/bwn/if_bwn_pci.c b/sys/dev/bwn/if_bwn_pci.c index e2ba15dd67c8..a81284158443 100644 --- a/sys/dev/bwn/if_bwn_pci.c +++ b/sys/dev/bwn/if_bwn_pci.c @@ -189,17 +189,6 @@ bwn_pci_attach(device_t dev) return (0); } -static int -bwn_pci_detach(device_t dev) -{ - int error; - - if ((error = bus_generic_detach(dev))) - return (error); - - return (device_delete_children(dev)); -} - static void bwn_pci_probe_nomatch(device_t dev, device_t child) { @@ -268,7 +257,7 @@ static device_method_t bwn_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, bwn_pci_probe), DEVMETHOD(device_attach, bwn_pci_attach), - DEVMETHOD(device_detach, bwn_pci_detach), + DEVMETHOD(device_detach, bus_generic_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, bus_generic_suspend), DEVMETHOD(device_resume, bus_generic_resume), diff --git a/sys/dev/iicbus/iicbb.c b/sys/dev/iicbus/iicbb.c index dec5e4bc0c7e..c344bda930b0 100644 --- a/sys/dev/iicbus/iicbb.c +++ b/sys/dev/iicbus/iicbb.c @@ -80,7 +80,6 @@ struct iicbb_softc { static int iicbb_attach(device_t); static void iicbb_child_detached(device_t, device_t); -static int iicbb_detach(device_t); static int iicbb_print_child(device_t, device_t); static int iicbb_probe(device_t); @@ -101,7 +100,7 @@ static device_method_t iicbb_methods[] = { /* device interface */ DEVMETHOD(device_probe, iicbb_probe), DEVMETHOD(device_attach, iicbb_attach), - DEVMETHOD(device_detach, iicbb_detach), + DEVMETHOD(device_detach, bus_generic_detach), /* bus interface */ DEVMETHOD(bus_child_detached, iicbb_child_detached), @@ -168,16 +167,6 @@ iicbb_attach(device_t dev) return (0); } -static int -iicbb_detach(device_t dev) -{ - - bus_generic_detach(dev); - device_delete_children(dev); - - return (0); -} - #ifdef FDT static phandle_t iicbb_get_node(device_t bus, device_t dev) diff --git a/sys/dev/imcsmb/imcsmb.c b/sys/dev/imcsmb/imcsmb.c index 2507d948e8e4..50280ad1b0f7 100644 --- a/sys/dev/imcsmb/imcsmb.c +++ b/sys/dev/imcsmb/imcsmb.c @@ -53,7 +53,6 @@ /* Device methods */ static int imcsmb_attach(device_t dev); -static int imcsmb_detach(device_t dev); static int imcsmb_probe(device_t dev); /* SMBus methods */ @@ -106,30 +105,6 @@ out: return (rc); } -/** - * device_detach() method. attach() didn't do any allocations, so all that's - * needed here is to free up any downstream drivers and children. - * - * @author Joe Kloss - * - * @param[in] dev - * Device being detached. - */ -static int -imcsmb_detach(device_t dev) -{ - int rc; - - /* Detach any attached drivers */ - rc = bus_generic_detach(dev); - if (rc == 0) { - /* Remove all children */ - rc = device_delete_children(dev); - } - - return (rc); -} - /** * device_probe() method. All the actual probing was done by the imcsmb_pci * parent, so just report success. @@ -522,7 +497,7 @@ out: static device_method_t imcsmb_methods[] = { /* Device interface */ DEVMETHOD(device_attach, imcsmb_attach), - DEVMETHOD(device_detach, imcsmb_detach), + DEVMETHOD(device_detach, bus_generic_detach), DEVMETHOD(device_probe, imcsmb_probe), /* smbus methods */ diff --git a/sys/dev/imcsmb/imcsmb_pci.c b/sys/dev/imcsmb/imcsmb_pci.c index c6e5d1d690c0..6e9e601989b1 100644 --- a/sys/dev/imcsmb/imcsmb_pci.c +++ b/sys/dev/imcsmb/imcsmb_pci.c @@ -146,7 +146,6 @@ static struct imcsmb_pci_device { /* Device methods. */ static int imcsmb_pci_attach(device_t dev); -static int imcsmb_pci_detach(device_t dev); static int imcsmb_pci_probe(device_t dev); /** @@ -195,30 +194,6 @@ out: return (rc); } -/** - * device_detach() method. attach() didn't do any allocations, so all that's - * needed here is to free up any downstream drivers and children. - * - * @author Joe Kloss - * - * @param[in] dev - * Device being detached. - */ -static int -imcsmb_pci_detach(device_t dev) -{ - int rc; - - /* Detach any attached drivers */ - rc = bus_generic_detach(dev); - if (rc == 0) { - /* Remove all children */ - rc = device_delete_children(dev); - } - - return (rc); -} - /** * device_probe() method. Look for the right PCI vendor/device IDs. * @@ -318,7 +293,7 @@ imcsmb_pci_request_bus(device_t dev) static device_method_t imcsmb_pci_methods[] = { /* Device interface */ DEVMETHOD(device_attach, imcsmb_pci_attach), - DEVMETHOD(device_detach, imcsmb_pci_detach), + DEVMETHOD(device_detach, bus_generic_detach), DEVMETHOD(device_probe, imcsmb_pci_probe), DEVMETHOD_END diff --git a/sys/dev/p2sb/lewisburg_gpiocm.c b/sys/dev/p2sb/lewisburg_gpiocm.c index 7eeab669d625..f5c1792c69e1 100644 --- a/sys/dev/p2sb/lewisburg_gpiocm.c +++ b/sys/dev/p2sb/lewisburg_gpiocm.c @@ -322,23 +322,11 @@ lbggpiocm_attach(device_t dev) return (0); } -static int -lbggpiocm_detach(device_t dev) -{ - int error; - - error = device_delete_children(dev); - if (error) - return (error); - - return (bus_generic_detach(dev)); -} - static device_method_t lbggpiocm_methods[] = { /* Device interface */ DEVMETHOD(device_probe, lbggpiocm_probe), DEVMETHOD(device_attach, lbggpiocm_attach), - DEVMETHOD(device_detach, lbggpiocm_detach), + DEVMETHOD(device_detach, bus_generic_detach), DEVMETHOD_END }; diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c index 243c0b53dda4..09166c0cbea6 100644 --- a/sys/dev/pci/vga_pci.c +++ b/sys/dev/pci/vga_pci.c @@ -378,17 +378,6 @@ vga_pci_attach(device_t dev) return (0); } -static int -vga_pci_detach(device_t dev) -{ - int error; - - error = bus_generic_detach(dev); - if (error == 0) - error = device_delete_children(dev); - return (error); -} - /* Bus interface. */ static int @@ -719,7 +708,7 @@ static device_method_t vga_pci_methods[] = { DEVMETHOD(device_attach, vga_pci_attach), DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_detach, vga_pci_detach), + DEVMETHOD(device_detach, bus_generic_detach), DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ diff --git a/sys/dev/ppbus/ppbconf.c b/sys/dev/ppbus/ppbconf.c index 17fef1eebde7..2c3f17318747 100644 --- a/sys/dev/ppbus/ppbconf.c +++ b/sys/dev/ppbus/ppbconf.c @@ -419,21 +419,6 @@ ppbus_attach(device_t dev) return (0); } -static int -ppbus_detach(device_t dev) -{ - int error; - - error = bus_generic_detach(dev); - if (error) - return (error); - - /* detach & delete all children */ - device_delete_children(dev); - - return (0); -} - static int ppbus_intr(void *arg) { @@ -578,7 +563,7 @@ static device_method_t ppbus_methods[] = { /* device interface */ DEVMETHOD(device_probe, ppbus_probe), DEVMETHOD(device_attach, ppbus_attach), - DEVMETHOD(device_detach, ppbus_detach), + DEVMETHOD(device_detach, bus_generic_detach), /* bus interface */ DEVMETHOD(bus_add_child, ppbus_add_child), diff --git a/sys/dev/pwm/pwmbus.c b/sys/dev/pwm/pwmbus.c index ae40a23d0d45..c0c07a36c277 100644 --- a/sys/dev/pwm/pwmbus.c +++ b/sys/dev/pwm/pwmbus.c @@ -188,17 +188,6 @@ pwmbus_attach(device_t dev) return (0); } -static int -pwmbus_detach(device_t dev) -{ - int rv; - - if ((rv = bus_generic_detach(dev)) == 0) - rv = device_delete_children(dev); - - return (rv); -} - /* * pwmbus_if methods... */ @@ -249,7 +238,7 @@ static device_method_t pwmbus_methods[] = { /* device_if */ DEVMETHOD(device_probe, pwmbus_probe), DEVMETHOD(device_attach, pwmbus_attach), - DEVMETHOD(device_detach, pwmbus_detach), + DEVMETHOD(device_detach, bus_generic_detach), /* bus_if */ DEVMETHOD(bus_add_child, pwmbus_add_child), diff --git a/sys/dev/usb/misc/cp2112.c b/sys/dev/usb/misc/cp2112.c index 2492eae978bb..e3587241f412 100644 --- a/sys/dev/usb/misc/cp2112.c +++ b/sys/dev/usb/misc/cp2112.c @@ -252,7 +252,6 @@ struct cp2112iic_softc { } io; }; -static int cp2112_detach(device_t dev); static int cp2112gpio_detach(device_t dev); static int cp2112iic_detach(device_t dev); @@ -351,22 +350,10 @@ cp2112_attach(device_t dev) return (0); detach: - cp2112_detach(dev); + bus_generic_detach(dev); return (ENXIO); } -static int -cp2112_detach(device_t dev) -{ - int err; - - err = bus_generic_detach(dev); - if (err != 0) - return (err); - device_delete_children(dev); - return (0); -} - static int cp2112_gpio_read_pin(device_t dev, uint32_t pin_num, bool *on) { @@ -1374,7 +1361,7 @@ cp2112iic_detach(device_t dev) static device_method_t cp2112hid_methods[] = { DEVMETHOD(device_probe, cp2112_probe), DEVMETHOD(device_attach, cp2112_attach), - DEVMETHOD(device_detach, cp2112_detach), + DEVMETHOD(device_detach, bus_generic_detach), DEVMETHOD_END };