From e160f7d430f163bc42757aff3bf2bcac0a459f02 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 17 Jan 2017 16:52:55 -0700 Subject: 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 --- include/dm/device.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/dm/device.h b/include/dm/device.h index 9948bd4..4e95fb7 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -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 -- cgit v1.1