headers/uninline: Uninline single-use function: kobject_has_children()
authorIngo Molnar <mingo@kernel.org>
Sun, 29 Aug 2021 07:18:53 +0000 (09:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Jan 2022 13:36:06 +0000 (14:36 +0100)
This was the only usage of <linux/kref_api.h> in <linux/kobject_api.h>,
so we'll able to decouple the two after this change.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/core.c
include/linux/kobject.h

index 60d703e..603941b 100644 (file)
@@ -3028,6 +3028,23 @@ static inline struct kobject *get_glue_dir(struct device *dev)
        return dev->kobj.parent;
 }
 
+/**
+ * kobject_has_children - Returns whether a kobject has children.
+ * @kobj: the object to test
+ *
+ * This will return whether a kobject has other kobjects as children.
+ *
+ * It does NOT account for the presence of attribute files, only sub
+ * directories. It also assumes there is no concurrent addition or
+ * removal of such children, and thus relies on external locking.
+ */
+static inline bool kobject_has_children(struct kobject *kobj)
+{
+       WARN_ON_ONCE(kref_read(&kobj->kref) == 0);
+
+       return kobj->sd && kobj->sd->dir.subdirs;
+}
+
 /*
  * make sure cleaning up dir as the last step, we need to make
  * sure .release handler of kobject is run with holding the
index ad90b49..c7b4739 100644 (file)
@@ -117,23 +117,6 @@ extern void kobject_get_ownership(struct kobject *kobj,
                                  kuid_t *uid, kgid_t *gid);
 extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);
 
-/**
- * kobject_has_children - Returns whether a kobject has children.
- * @kobj: the object to test
- *
- * This will return whether a kobject has other kobjects as children.
- *
- * It does NOT account for the presence of attribute files, only sub
- * directories. It also assumes there is no concurrent addition or
- * removal of such children, and thus relies on external locking.
- */
-static inline bool kobject_has_children(struct kobject *kobj)
-{
-       WARN_ON_ONCE(kref_read(&kobj->kref) == 0);
-
-       return kobj->sd && kobj->sd->dir.subdirs;
-}
-
 struct kobj_type {
        void (*release)(struct kobject *kobj);
        const struct sysfs_ops *sysfs_ops;