Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177862306
D47960.1795456260.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
7 KB
Referenced Files
None
Subscribers
None
D47960.1795456260.diff
View Options
diff --git a/sys/dev/bwn/if_bwn_pci.c b/sys/dev/bwn/if_bwn_pci.c
--- a/sys/dev/bwn/if_bwn_pci.c
+++ b/sys/dev/bwn/if_bwn_pci.c
@@ -189,17 +189,6 @@
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 @@
/* 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
--- a/sys/dev/iicbus/iicbb.c
+++ b/sys/dev/iicbus/iicbb.c
@@ -80,7 +80,6 @@
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 @@
/* 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 @@
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
--- 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 @@
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 @@
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
--- a/sys/dev/imcsmb/imcsmb_pci.c
+++ b/sys/dev/imcsmb/imcsmb_pci.c
@@ -146,7 +146,6 @@
/* 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 @@
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 @@
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
--- a/sys/dev/p2sb/lewisburg_gpiocm.c
+++ b/sys/dev/p2sb/lewisburg_gpiocm.c
@@ -322,23 +322,11 @@
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
--- a/sys/dev/pci/vga_pci.c
+++ b/sys/dev/pci/vga_pci.c
@@ -378,17 +378,6 @@
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 @@
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
--- a/sys/dev/ppbus/ppbconf.c
+++ b/sys/dev/ppbus/ppbconf.c
@@ -419,21 +419,6 @@
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 @@
/* 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
--- a/sys/dev/pwm/pwmbus.c
+++ b/sys/dev/pwm/pwmbus.c
@@ -188,17 +188,6 @@
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 @@
/* 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
--- a/sys/dev/usb/misc/cp2112.c
+++ b/sys/dev/usb/misc/cp2112.c
@@ -252,7 +252,6 @@
} 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 @@
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 @@
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
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 23, 5:51 PM (2 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41936204
Default Alt Text
D47960.1795456260.diff (7 KB)
Attached To
Mode
D47960: Use the new bus_generic_detach directly in place of home-grown versions
Attached
Detach File
Event Timeline