* [PATCH 0/2] dmi-sysfs module unload fixes
@ 2013-12-05 23:46 Bjorn Helgaas
2013-12-05 23:46 ` [PATCH 1/2] firmware: dmi-sysfs: Don't remove dmi-sysfs "raw" file explicitly Bjorn Helgaas
2013-12-05 23:46 ` [PATCH 2/2] firmware: dmi-sysfs: Remove "dmi" directory on module exit Bjorn Helgaas
0 siblings, 2 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2013-12-05 23:46 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, Mike Waychison
These fix a warning on dmi-sysfs module unload and an error when
reloading immediately after unload with DEBUG_KOBJECT_RELEASE.
---
Bjorn Helgaas (2):
firmware: dmi-sysfs: Don't remove dmi-sysfs "raw" file explicitly
firmware: dmi-sysfs: Remove "dmi" directory on module exit
drivers/firmware/dmi-sysfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] firmware: dmi-sysfs: Don't remove dmi-sysfs "raw" file explicitly
2013-12-05 23:46 [PATCH 0/2] dmi-sysfs module unload fixes Bjorn Helgaas
@ 2013-12-05 23:46 ` Bjorn Helgaas
2013-12-05 23:46 ` [PATCH 2/2] firmware: dmi-sysfs: Remove "dmi" directory on module exit Bjorn Helgaas
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2013-12-05 23:46 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, Mike Waychison
Removing the dmi-sysfs module causes the following warning:
# modprobe -r dmi_sysfs
WARNING: CPU: 11 PID: 6785 at fs/sysfs/inode.c:325 sysfs_hash_and_remove+0xa9/0xb0()
sysfs: can not remove 'raw', no directory
This is because putting the entry kobject, e.g., for
"/sys/firmware/dmi/entries/19-0", removes the directory and all its
contents. By the time dmi_sysfs_entry_release() runs, the "raw" file
inside ".../19-0/" has already been removed.
Therefore, we don't need to remove the "raw" bin file at all in
dmi_sysfs_entry_release().
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/firmware/dmi-sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/dmi-sysfs.c b/drivers/firmware/dmi-sysfs.c
index eb26d62e5188..66200ed5e6a1 100644
--- a/drivers/firmware/dmi-sysfs.c
+++ b/drivers/firmware/dmi-sysfs.c
@@ -553,7 +553,7 @@ static const struct bin_attribute dmi_entry_raw_attr = {
static void dmi_sysfs_entry_release(struct kobject *kobj)
{
struct dmi_sysfs_entry *entry = to_entry(kobj);
- sysfs_remove_bin_file(&entry->kobj, &dmi_entry_raw_attr);
+
spin_lock(&entry_list_lock);
list_del(&entry->list);
spin_unlock(&entry_list_lock);
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] firmware: dmi-sysfs: Remove "dmi" directory on module exit
2013-12-05 23:46 [PATCH 0/2] dmi-sysfs module unload fixes Bjorn Helgaas
2013-12-05 23:46 ` [PATCH 1/2] firmware: dmi-sysfs: Don't remove dmi-sysfs "raw" file explicitly Bjorn Helgaas
@ 2013-12-05 23:46 ` Bjorn Helgaas
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2013-12-05 23:46 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, Mike Waychison
With CONFIG_DEBUG_KOBJECT_RELEASE=y, removing and immediately reloading the
dmi-sysfs module causes the following warning:
sysfs: cannot create duplicate filename '/firmware/dmi'
kobject_add_internal failed for dmi with -EEXIST, don't try to register things with the same name in the same directory.
The "dmi" directory stays in sysfs until the dmi_kobj is released, and
DEBUG_KOBJECT_RELEASE delays that.
I don't think we can hit this problem in normal usage because dmi_kobj is
static and nothing outside dmi-sysfs can get a reference to it, so the
only way to delay the "dmi" release is with DEBUG_KOBJECT_RELEASE.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/firmware/dmi-sysfs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/firmware/dmi-sysfs.c b/drivers/firmware/dmi-sysfs.c
index 66200ed5e6a1..e0f1cb3d3598 100644
--- a/drivers/firmware/dmi-sysfs.c
+++ b/drivers/firmware/dmi-sysfs.c
@@ -685,6 +685,7 @@ static void __exit dmi_sysfs_exit(void)
pr_debug("dmi-sysfs: unloading.\n");
cleanup_entry_list();
kset_unregister(dmi_kset);
+ kobject_del(dmi_kobj);
kobject_put(dmi_kobj);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-05 23:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-05 23:46 [PATCH 0/2] dmi-sysfs module unload fixes Bjorn Helgaas
2013-12-05 23:46 ` [PATCH 1/2] firmware: dmi-sysfs: Don't remove dmi-sysfs "raw" file explicitly Bjorn Helgaas
2013-12-05 23:46 ` [PATCH 2/2] firmware: dmi-sysfs: Remove "dmi" directory on module exit Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®