
This is a convenience function only so far. Eventually it could have some consistency checking added.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/core/device.c | 10 ++++++++++ include/dm/device.h | 10 ++++++++++ 2 files changed, 20 insertions(+)
diff --git a/drivers/core/device.c b/drivers/core/device.c index b73d3b8..fbb377b 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -305,6 +305,16 @@ void *dev_get_priv(struct udevice *dev) return dev->priv; }
+void *dev_get_uclass_priv(struct udevice *dev) +{ + if (!dev) { + dm_warn("%s: null device\n", __func__); + return NULL; + } + + return dev->uclass_priv; +} + void *dev_get_parentdata(struct udevice *dev) { if (!dev) { diff --git a/include/dm/device.h b/include/dm/device.h index 81afa8c..511dbd9 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -229,6 +229,16 @@ void *dev_get_parentdata(struct udevice *dev); void *dev_get_priv(struct udevice *dev);
/** + * dev_get_uclass_priv() - Get the private data for a device's class + * + * This checks that dev is not NULL, but no other checks for now + * + * @dev Device to check + * @return uclass private data, or NULL if none + */ +void *dev_get_uclass_priv(struct udevice *dev); + +/** * struct dev_get_parent() - Get the parent of a device * * @child: Child to check