diff options
author | Simon Glass <sjg@chromium.org> | 2015-03-05 12:25:20 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-04-16 19:27:42 -0600 |
commit | e564f054af002d9e6a1080ed9d4bc2c6052a4435 (patch) | |
tree | 7b945d568d32c7febf5a8b70c6bce26b5157663c /drivers/core | |
parent | 106cce9604306743c86addd4d27426cce498c9d1 (diff) | |
download | u-boot-imx-e564f054af002d9e6a1080ed9d4bc2c6052a4435.zip u-boot-imx-e564f054af002d9e6a1080ed9d4bc2c6052a4435.tar.gz u-boot-imx-e564f054af002d9e6a1080ed9d4bc2c6052a4435.tar.bz2 |
dm: core: Add dev_get_uclass_priv() to access uclass private data
Add a convenience function to access the private data that a uclass stores
for each of its devices. Convert over most existing uses for consistency
and to provide an example for others.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core')
-rw-r--r-- | drivers/core/device.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c index 73c3e07..92e8a57 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) { |