mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
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>
This commit is contained in:
committed by
Simon Glass
parent
b7af1a2da7
commit
cc73d37b7f
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user