Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F164475719
D26468.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D26468.diff
View Options
Index: sys/dev/fdt/simplebus.h
===================================================================
--- sys/dev/fdt/simplebus.h
+++ sys/dev/fdt/simplebus.h
@@ -67,5 +67,6 @@
struct simplebus_softc *sc);
int simplebus_attach(device_t dev);
+int simplebus_detach(device_t dev);
#endif /* _FDT_SIMPLEBUS_H */
Index: sys/dev/fdt/simplebus.c
===================================================================
--- sys/dev/fdt/simplebus.c
+++ sys/dev/fdt/simplebus.c
@@ -67,7 +67,7 @@
/* Device interface */
DEVMETHOD(device_probe, simplebus_probe),
DEVMETHOD(device_attach, simplebus_attach),
- DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_detach, simplebus_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, bus_generic_resume),
@@ -155,6 +155,33 @@
for (node = OF_child(sc->node); node > 0; node = OF_peer(node))
simplebus_add_device(dev, node, 0, NULL, -1, NULL);
return (bus_generic_attach(dev));
+}
+
+int
+simplebus_detach(device_t dev)
+{
+ struct simplebus_softc *sc;
+ struct simplebus_devinfo *ndi;
+ device_t *devlist;
+ int index, num;
+
+ sc = device_get_softc(dev);
+
+ /* Free ranges */
+ if (sc->ranges)
+ free(sc->ranges, M_DEVBUF);
+
+ /* Free simplebus_devinfo ndi */
+ device_get_children(dev, &devlist, &num);
+ for (index = 0; index < num; index++) {
+ ndi = device_get_ivars(devlist[index]);
+ free(ndi, M_DEVBUF);
+ }
+ free(devlist, M_TEMP);
+
+ bus_generic_detach(dev);
+
+ return (0);
}
void
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Aug 2, 7:02 AM (52 m, 56 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35852320
Default Alt Text
D26468.diff (1 KB)
Attached To
Mode
D26468: Add simplebus_detach()
Attached
Detach File
Event Timeline
Log In to Comment