[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230406093056.33916-1-frank.li@vivo.com>
Date: Thu, 6 Apr 2023 17:30:54 +0800
From: Yangtao Li <frank.li@...o.com>
To: xiang@...nel.org, chao@...nel.org, huyue2@...lpad.com,
jefflexu@...ux.alibaba.com, damien.lemoal@...nsource.wdc.com,
naohiro.aota@....com, jth@...nel.org, gregkh@...uxfoundation.org,
rafael@...nel.org
Cc: linux-erofs@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, Yangtao Li <frank.li@...o.com>
Subject: [PATCH 1/3] kobject: introduce kobject_is_added()
Add kobject_is_added() to avoid consumers from directly accessing
the internal variables of kobject.
Signed-off-by: Yangtao Li <frank.li@...o.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
Powered by blists - more mailing lists