Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151750005
D34031.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
D34031.diff
View Options
diff --git a/sys/dev/mii/mii_fdt.c b/sys/dev/mii/mii_fdt.c
--- a/sys/dev/mii/mii_fdt.c
+++ b/sys/dev/mii/mii_fdt.c
@@ -326,20 +326,6 @@
return (&ma->obd);
}
-static ssize_t
-miibus_fdt_get_property(device_t bus, device_t child, const char *propname,
- void *buf, size_t size)
-{
- struct mii_attach_args *ma;
-
- ma = device_get_ivars(child);
-
- if (ma->obd.obd_node == 0)
- return (-1);
-
- return (OF_getencprop(ma->obd.obd_node, propname, buf, size));
-}
-
static device_method_t miibus_fdt_methods[] = {
DEVMETHOD(device_probe, miibus_fdt_probe),
DEVMETHOD(device_attach, miibus_fdt_attach),
@@ -362,7 +348,6 @@
DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource),
DEVMETHOD(bus_get_resource_list, miibus_fdt_get_resource_list),
- DEVMETHOD(bus_get_property, miibus_fdt_get_property),
DEVMETHOD_END
};
diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m
--- a/sys/kern/bus_if.m
+++ b/sys/kern/bus_if.m
@@ -77,12 +77,6 @@
return (0);
}
- static ssize_t
- null_get_property(device_t dev, device_t child, const char *propname,
- void *propvalue, size_t size)
- {
- return (-1);
- }
};
/**
@@ -944,7 +938,7 @@
const char *_propname;
void *_propvalue;
size_t _size;
-} DEFAULT null_get_property;
+} DEFAULT bus_generic_get_property;
/**
* @brief Gets a child's full path to the device
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -4125,6 +4125,23 @@
return (ENOENT);
}
+/**
+ * @brief Helper function for implementing BUS_GET_PROPERTY().
+ *
+ * This simply calls the BUS_GET_PROPERTY of the parent of dev,
+ * until a non-default implementation is found.
+ */
+ssize_t
+bus_generic_get_property(device_t dev, device_t child, const char *propname,
+ void *propvalue, size_t size)
+{
+ if (device_get_parent(dev) != NULL)
+ return (BUS_GET_PROPERTY(device_get_parent(dev), child,
+ propname, propvalue, size));
+
+ return (-1);
+}
+
/**
* @brief Stub function for implementing BUS_GET_RESOURCE_LIST().
*
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -444,6 +444,9 @@
bus_space_tag_t
bus_generic_get_bus_tag(device_t dev, device_t child);
int bus_generic_get_domain(device_t dev, device_t child, int *domain);
+ssize_t bus_generic_get_property(device_t dev, device_t child,
+ const char *propname, void *propvalue,
+ size_t size);
struct resource_list *
bus_generic_get_resource_list(device_t, device_t);
int bus_generic_map_resource(device_t dev, device_t child, int type,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 11, 10:28 AM (12 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31285058
Default Alt Text
D34031.diff (2 KB)
Attached To
Mode
D34031: bus_if: Add a default implementation of get_property
Attached
Detach File
Event Timeline
Log In to Comment