Commit 378a33a6 authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Linus Torvalds

[PATCH] pcmcia: release_class

Properly wait for the class refcount to reach zero.
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3448139b
...@@ -903,17 +903,29 @@ static int pcmcia_socket_hotplug(struct class_device *dev, char **envp, ...@@ -903,17 +903,29 @@ static int pcmcia_socket_hotplug(struct class_device *dev, char **envp,
} }
static struct completion pcmcia_unload;
static void pcmcia_release_socket_class(struct class *data)
{
complete(&pcmcia_unload);
}
struct class pcmcia_socket_class = { struct class pcmcia_socket_class = {
.name = "pcmcia_socket", .name = "pcmcia_socket",
.hotplug = pcmcia_socket_hotplug, .hotplug = pcmcia_socket_hotplug,
.release = pcmcia_release_socket, .release = pcmcia_release_socket,
.class_release = pcmcia_release_socket_class,
}; };
EXPORT_SYMBOL(pcmcia_socket_class); EXPORT_SYMBOL(pcmcia_socket_class);
static int __init init_pcmcia_cs(void) static int __init init_pcmcia_cs(void)
{ {
int ret = class_register(&pcmcia_socket_class); int ret;
init_completion(&pcmcia_unload);
ret = class_register(&pcmcia_socket_class);
if (ret) if (ret)
return (ret); return (ret);
return class_interface_register(&pccard_sysfs_interface); return class_interface_register(&pccard_sysfs_interface);
...@@ -923,6 +935,8 @@ static void __exit exit_pcmcia_cs(void) ...@@ -923,6 +935,8 @@ static void __exit exit_pcmcia_cs(void)
{ {
class_interface_unregister(&pccard_sysfs_interface); class_interface_unregister(&pccard_sysfs_interface);
class_unregister(&pcmcia_socket_class); class_unregister(&pcmcia_socket_class);
wait_for_completion(&pcmcia_unload);
} }
subsys_initcall(init_pcmcia_cs); subsys_initcall(init_pcmcia_cs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment