diff options
author | Przemyslaw Marczak <p.marczak@samsung.com> | 2015-04-15 13:07:24 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-04-22 11:03:15 -0600 |
commit | cc73d37b7f1edbbf03e2abcf5815bdd122e8baed (patch) | |
tree | 049e945aed984e4e1bbee25aa51145592bb24150 /drivers/core | |
parent | b7af1a2da767c0dd283ffce3d50efd36af32df14 (diff) | |
download | u-boot-cc73d37b7f1edbbf03e2abcf5815bdd122e8baed.tar.gz u-boot-cc73d37b7f1edbbf03e2abcf5815bdd122e8baed.tar.bz2 u-boot-cc73d37b7f1edbbf03e2abcf5815bdd122e8baed.zip |
dm: core: device: add function: dev_get_driver_ops()
This commit extends the driver model device's API by function:
- dev_get_driver_ops()
And this function returns the device's driver's operations if given:
- dev pointer, is non-NULL
- dev->driver->ops pointer, is non-NULL
in other case the, the NULL pointer is returned.
Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core')
-rw-r--r-- | drivers/core/device.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c index 80eb55bb3b..d024abbd41 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -499,6 +499,14 @@ ulong dev_get_driver_data(struct udevice *dev) return dev->driver_data; } +const void *dev_get_driver_ops(struct udevice *dev) +{ + if (!dev || !dev->driver->ops) + return NULL; + + return dev->driver->ops; +} + enum uclass_id device_get_uclass_id(struct udevice *dev) { return dev->uclass->uc_drv->id; |