Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102683479
D47373.id145847.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D47373.id145847.diff
View Options
diff --git a/sys/dev/spibus/acpi_spibus.c b/sys/dev/spibus/acpi_spibus.c
--- a/sys/dev/spibus/acpi_spibus.c
+++ b/sys/dev/spibus/acpi_spibus.c
@@ -561,6 +561,7 @@
DEVMETHOD(bus_alloc_resource, acpi_spibus_alloc_resource),
#endif
DEVMETHOD(bus_add_child, acpi_spibus_add_child),
+ DEVMETHOD(bus_child_deleted, spibus_child_deleted),
DEVMETHOD(bus_probe_nomatch, acpi_spibus_probe_nomatch),
DEVMETHOD(bus_driver_added, acpi_spibus_driver_added),
DEVMETHOD(bus_child_deleted, acpi_spibus_child_deleted),
diff --git a/sys/dev/spibus/ofw_spibus.c b/sys/dev/spibus/ofw_spibus.c
--- a/sys/dev/spibus/ofw_spibus.c
+++ b/sys/dev/spibus/ofw_spibus.c
@@ -190,6 +190,12 @@
return (child);
}
+static void
+ofw_spibus_child_deleted(device_t dev, device_t child)
+{
+ free(device_get_ivars(child), M_DEVBUF);
+}
+
static const struct ofw_bus_devinfo *
ofw_spibus_get_devinfo(device_t bus, device_t dev)
{
@@ -216,6 +222,7 @@
/* Bus interface */
DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
DEVMETHOD(bus_add_child, ofw_spibus_add_child),
+ DEVMETHOD(bus_child_deleted, ofw_spibus_child_deleted),
DEVMETHOD(bus_get_resource_list, ofw_spibus_get_resource_list),
/* ofw_bus interface */
diff --git a/sys/dev/spibus/spibus.c b/sys/dev/spibus/spibus.c
--- a/sys/dev/spibus/spibus.c
+++ b/sys/dev/spibus/spibus.c
@@ -198,6 +198,18 @@
return (child);
}
+void
+spibus_child_deleted(device_t dev, device_t child)
+{
+ struct spibus_ivar *devi;
+
+ devi = device_get_ivars(child);
+ if (devi == NULL)
+ return;
+ resource_list_free(&devi->rl);
+ free(devi, M_DEVBUF);
+}
+
static device_t
spibus_add_child(device_t dev, u_int order, const char *name, int unit)
{
@@ -262,6 +274,7 @@
DEVMETHOD(bus_get_resource_list, spibus_get_resource_list),
DEVMETHOD(bus_add_child, spibus_add_child),
+ DEVMETHOD(bus_child_deleted, spibus_child_deleted),
DEVMETHOD(bus_print_child, spibus_print_child),
DEVMETHOD(bus_probe_nomatch, spibus_probe_nomatch),
DEVMETHOD(bus_read_ivar, spibus_read_ivar),
diff --git a/sys/dev/spibus/spibusvar.h b/sys/dev/spibus/spibusvar.h
--- a/sys/dev/spibus/spibusvar.h
+++ b/sys/dev/spibus/spibusvar.h
@@ -79,6 +79,7 @@
int spibus_attach(device_t);
int spibus_detach(device_t);
device_t spibus_add_child_common(device_t, u_int, const char *, int, size_t);
+void spibus_child_deleted(device_t, device_t);
void spibus_probe_nomatch(device_t, device_t);
int spibus_child_location(device_t, device_t, struct sbuf *);
int spibus_read_ivar(device_t, device_t, int, uintptr_t *);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 7:59 PM (7 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14663795
Default Alt Text
D47373.id145847.diff (2 KB)
Attached To
Mode
D47373: spibus: Use a bus_child_deleted method to free ivars for children
Attached
Detach File
Event Timeline
Log In to Comment