mirror of
https://xff.cz/git/u-boot/
synced 2025-10-18 08:23:24 +02:00
dm: core: Replace of_offset with accessor
At present devices use a simple integer offset to record the device tree node associated with the device. In preparation for supporting a live device tree, which uses a node pointer instead, refactor existing code to access this field through an inline function. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -121,6 +121,16 @@ struct udevice {
|
||||
/* Returns non-zero if the device is active (probed and not removed) */
|
||||
#define device_active(dev) ((dev)->flags & DM_FLAG_ACTIVATED)
|
||||
|
||||
static inline int dev_of_offset(const struct udevice *dev)
|
||||
{
|
||||
return dev->of_offset;
|
||||
}
|
||||
|
||||
static inline void dev_set_of_offset(struct udevice *dev, int of_offset)
|
||||
{
|
||||
dev->of_offset = of_offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* struct udevice_id - Lists the compatible strings supported by a driver
|
||||
* @compatible: Compatible string
|
||||
|
Reference in New Issue
Block a user