All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: gregkh@linuxfoundation.org, rafael@kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: [PATCH] kobject: add the missing export for kobject_create()
Date: Tue, 31 Aug 2021 14:50:09 +0800	[thread overview]
Message-ID: <20210831065009.29358-1-wqu@suse.com> (raw)

[BUG]
For any module utilizing kobject_create(), it will lead to link error:

  $ make M=fs/btrfs -j12
    CC [M]  fs/btrfs/sysfs.o
    LD [M]  fs/btrfs/btrfs.o
    MODPOST fs/btrfs/Module.symvers
  ERROR: modpost: "kobject_create" [fs/btrfs/btrfs.ko] undefined!
  make[1]: *** [scripts/Makefile.modpost:150: fs/btrfs/Module.symvers] Error 1
  make[1]: *** Deleting file 'fs/btrfs/Module.symvers'
  make: *** [Makefile:1766: modules] Error 2

[CAUSE]
It's pretty straight forward, kobject_create() doesn't have
EXPORT_SYMBOL_GPL().

[FIX]
Fix it by adding the missing EXPORT_SYMBOL_GPL().

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
A little surprised by the fact that no know even is calling
kobject_create() now.

Or should we just call kmalloc() manually then kobject_init_and_add()?
---
 lib/kobject.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/kobject.c b/lib/kobject.c
index ea53b30cf483..af308cf7dba2 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -788,6 +788,7 @@ struct kobject *kobject_create(void)
 	kobject_init(kobj, &dynamic_kobj_ktype);
 	return kobj;
 }
+EXPORT_SYMBOL_GPL(kobject_create);
 
 /**
  * kobject_create_and_add() - Create a struct kobject dynamically and
-- 
2.33.0


             reply	other threads:[~2021-08-31  6:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31  6:50 Qu Wenruo [this message]
2021-08-31  6:57 ` [PATCH] kobject: add the missing export for kobject_create() Greg KH
2021-08-31  7:53   ` Qu Wenruo
2021-08-31 20:04     ` Greg KH
2021-08-31 22:58       ` Qu Wenruo
2021-08-31  7:32 ` Nikolay Borisov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210831065009.29358-1-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.