lkml.org 
[lkml]   [2023]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/3] kobject: introduce kobject_is_added()
Date
Add kobject_is_added() to avoid consumers from directly accessing
the internal variables of kobject.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
include/linux/kobject.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index bdab370a24f4..b5cdb0c58729 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -203,6 +203,11 @@ static inline const struct kobj_type *get_ktype(const struct kobject *kobj)
return kobj->ktype;
}

+static inline int kobject_is_added(struct kobject *kobj)
+{
+ return kobj->state_in_sysfs;
+}
+
extern struct kobject *kset_find_obj(struct kset *, const char *);

/* The global /sys/kernel/ kobject for people to chain off of */
--
2.35.1
\
 
 \ /
  Last update: 2023-04-06 11:32    [W:0.116 / U:0.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site