diff options
Diffstat (limited to 'include/linux/kobject.h')
| -rw-r--r-- | include/linux/kobject.h | 34 | 
1 files changed, 8 insertions, 26 deletions
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index efd56f990a46..c7b47399b36a 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@ -19,10 +19,10 @@  #include <linux/list.h>  #include <linux/sysfs.h>  #include <linux/compiler.h> +#include <linux/container_of.h>  #include <linux/spinlock.h>  #include <linux/kref.h>  #include <linux/kobject_ns.h> -#include <linux/kernel.h>  #include <linux/wait.h>  #include <linux/atomic.h>  #include <linux/workqueue.h> @@ -66,7 +66,7 @@ struct kobject {  	struct list_head	entry;  	struct kobject		*parent;  	struct kset		*kset; -	struct kobj_type	*ktype; +	const struct kobj_type	*ktype;  	struct kernfs_node	*sd; /* sysfs directory entry */  	struct kref		kref;  #ifdef CONFIG_DEBUG_KOBJECT_RELEASE @@ -90,13 +90,13 @@ static inline const char *kobject_name(const struct kobject *kobj)  	return kobj->name;  } -extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype); +extern void kobject_init(struct kobject *kobj, const struct kobj_type *ktype);  extern __printf(3, 4) __must_check  int kobject_add(struct kobject *kobj, struct kobject *parent,  		const char *fmt, ...);  extern __printf(4, 5) __must_check  int kobject_init_and_add(struct kobject *kobj, -			 struct kobj_type *ktype, struct kobject *parent, +			 const struct kobj_type *ktype, struct kobject *parent,  			 const char *fmt, ...);  extern void kobject_del(struct kobject *kobj); @@ -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; @@ -153,10 +136,9 @@ struct kobj_uevent_env {  };  struct kset_uevent_ops { -	int (* const filter)(struct kset *kset, struct kobject *kobj); -	const char *(* const name)(struct kset *kset, struct kobject *kobj); -	int (* const uevent)(struct kset *kset, struct kobject *kobj, -		      struct kobj_uevent_env *env); +	int (* const filter)(struct kobject *kobj); +	const char *(* const name)(struct kobject *kobj); +	int (* const uevent)(struct kobject *kobj, struct kobj_uevent_env *env);  };  struct kobj_attribute { @@ -217,7 +199,7 @@ static inline void kset_put(struct kset *k)  	kobject_put(&k->kobj);  } -static inline struct kobj_type *get_ktype(struct kobject *kobj) +static inline const struct kobj_type *get_ktype(struct kobject *kobj)  {  	return kobj->ktype;  }  |