summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-12-19 10:40:11 -0700
committerSimon Glass <sjg@chromium.org>2021-01-05 12:24:41 -0700
commit156004f863c06ed985ed089450977827e11cb451 (patch)
tree4cd7d182f37e61bd9fe12f7c37bf911689a75daa
parent73466df3e214f6ff1966e69df351f273eec1a029 (diff)
downloadu-boot-156004f863c06ed985ed089450977827e11cb451.tar.gz
u-boot-156004f863c06ed985ed089450977827e11cb451.tar.bz2
u-boot-156004f863c06ed985ed089450977827e11cb451.zip
dm: core: Rename device flags to indicate it is private
To avoid having people accidentally access this member, add a trailing underscore. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--include/dm/device.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/include/dm/device.h b/include/dm/device.h
index 4ec423e961..a0c1752cdd 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -135,7 +135,8 @@ enum {
* @uclass_node: Used by uclass to link its devices
* @child_head: List of children of this device
* @sibling_node: Next device in list of all devices
- * @flags: Flags for this device DM_FLAG_...
+ * @flags_: Flags for this device DM_FLAG_... (do not access outside driver
+ * model)
* @seq_: Allocated sequence number for this device (-1 = none). This is set up
* when the device is bound and is unique within the device's uclass. If the
* device has an alias in the devicetree then that is used to set the sequence
@@ -163,7 +164,7 @@ struct udevice {
struct list_head uclass_node;
struct list_head child_head;
struct list_head sibling_node;
- uint32_t flags;
+ u32 flags_;
int seq_;
#ifdef CONFIG_DEVRES
struct list_head devres_head;
@@ -176,24 +177,24 @@ struct udevice {
/* Returns the operations for a device */
#define device_get_ops(dev) (dev->driver->ops)
-/* Returns non-zero if the device is active (probed and not removed) */
-#define device_active(dev) ((dev)->flags & DM_FLAG_ACTIVATED)
-
static inline u32 dev_get_flags(const struct udevice *dev)
{
- return dev->flags;
+ return dev->flags_;
}
static inline void dev_or_flags(struct udevice *dev, u32 or)
{
- dev->flags |= or;
+ dev->flags_ |= or;
}
static inline void dev_bic_flags(struct udevice *dev, u32 bic)
{
- dev->flags &= ~bic;
+ dev->flags_ &= ~bic;
}
+/* Returns non-zero if the device is active (probed and not removed) */
+#define device_active(dev) (dev_get_flags(dev) & DM_FLAG_ACTIVATED)
+
static inline int dev_of_offset(const struct udevice *dev)
{
return ofnode_to_offset(dev->node);