Skip to contentSkip to conversation

kobject: unexport kobject_create() in kobject.h

PATCH In review Qu Wenruo 2 participants 2 messages Aug 31, 2021

Subsystems (3)
lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

PATCH 1/1 kobject: unexport kobject_create() in kobject.h

The function kobject_create() is only used by one caller, kobject_create_and_add(), no other driver uses it, nor is exported to other modules.

However it's still exported in kobject.h, and can sometimes confuse users of kobject.h.

Since all users should call kobject_create_and_add(), or if extra attributes are needed, should alloc the memory manually then call kobject_init_and_add().

---
 include/linux/kobject.h | 1 -
 lib/kobject.c           | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
include/linux/kobject.h +0 -1
index ea30529fba08..efd56f990a46 100644
@@ -101,7 +101,6 @@ int kobject_init_and_add(struct kobject *kobj,
 
 extern void kobject_del(struct kobject *kobj);
 
-extern struct kobject * __must_check kobject_create(void);
 extern struct kobject * __must_check kobject_create_and_add(const char *name,
 						struct kobject *parent);
 
lib/kobject.c +1 -1
index ea53b30cf483..4a56f519139d 100644
@@ -777,7 +777,7 @@ static struct kobj_type dynamic_kobj_ktype = {
  * call to kobject_put() and not kfree(), as kobject_init() has
  * already been called on this structure.
  */
-struct kobject *kobject_create(void)
+static struct kobject *kobject_create(void)
 {
 	struct kobject *kobj;
 
Signature · 1 line
2.33.0
maintainer
#1 lore raw
Quoted 45 lines · Qu Wenruo

The function kobject_create() is only used by one caller, kobject_create_and_add(), no other driver uses it, nor is exported to other modules.

However it's still exported in kobject.h, and can sometimes confuse users of kobject.h.

Since all users should call kobject_create_and_add(), or if extra attributes are needed, should alloc the memory manually then call kobject_init_and_add().

---
 include/linux/kobject.h | 1 -
 lib/kobject.c           | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
include/linux/kobject.h +0 -1
index ea30529fba08..efd56f990a46 100644
@@ -101,7 +101,6 @@ int kobject_init_and_add(struct kobject *kobj,
 
 extern void kobject_del(struct kobject *kobj);
 
-extern struct kobject * __must_check kobject_create(void);
 extern struct kobject * __must_check kobject_create_and_add(const char *name,
 						struct kobject *parent);
 
lib/kobject.c +1 -1
index ea53b30cf483..4a56f519139d 100644
@@ -777,7 +777,7 @@ static struct kobj_type dynamic_kobj_ktype = {
  * call to kobject_put() and not kfree(), as kobject_init() has
  * already been called on this structure.
  */
-struct kobject *kobject_create(void)
+static struct kobject *kobject_create(void)
 {
 	struct kobject *kobj;
 
Signature · 1 line
2.33.0

Hi,

This is the friendly semi-automated patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response.

Right now, the development tree you have sent a patch for is "closed" due to the timing of the merge window. Don't worry, the patch(es) you have sent are not lost, and will be looked at after the merge window is over (after the -rc1 kernel is released by Linus).

So thank you for your patience and your patches will be reviewed at this later time, you do not have to do anything further, this is just a short note to let you know the patch status and so you don't worry they didn't make it through.

thanks,

greg k-h's patch email bot