aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-06-27 19:28:54 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-27 21:03:20 -0400
commit378a33a686d457fa5a38d6ad134f5385a9cc7860 (patch)
treed3773b8cc8dec6580b7d2b7327766e9cd8738e5d
parent3448139b41b9e3b8799eed7d427cd50789dadc3e (diff)
[PATCH] pcmcia: release_class
Properly wait for the class refcount to reach zero. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/pcmcia/cs.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 0ff4d6ec8b77..e82859d3227a 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -903,17 +903,29 @@ static int pcmcia_socket_hotplug(struct class_device *dev, char **envp,
903} 903}
904 904
905 905
906static struct completion pcmcia_unload;
907
908static void pcmcia_release_socket_class(struct class *data)
909{
910 complete(&pcmcia_unload);
911}
912
913
906struct class pcmcia_socket_class = { 914struct class pcmcia_socket_class = {
907 .name = "pcmcia_socket", 915 .name = "pcmcia_socket",
908 .hotplug = pcmcia_socket_hotplug, 916 .hotplug = pcmcia_socket_hotplug,
909 .release = pcmcia_release_socket, 917 .release = pcmcia_release_socket,
918 .class_release = pcmcia_release_socket_class,
910}; 919};
911EXPORT_SYMBOL(pcmcia_socket_class); 920EXPORT_SYMBOL(pcmcia_socket_class);
912 921
913 922
914static int __init init_pcmcia_cs(void) 923static int __init init_pcmcia_cs(void)
915{ 924{
916 int ret = class_register(&pcmcia_socket_class); 925 int ret;
926
927 init_completion(&pcmcia_unload);
928 ret = class_register(&pcmcia_socket_class);
917 if (ret) 929 if (ret)
918 return (ret); 930 return (ret);
919 return class_interface_register(&pccard_sysfs_interface); 931 return class_interface_register(&pccard_sysfs_interface);
@@ -923,6 +935,8 @@ static void __exit exit_pcmcia_cs(void)
923{ 935{
924 class_interface_unregister(&pccard_sysfs_interface); 936 class_interface_unregister(&pccard_sysfs_interface);
925 class_unregister(&pcmcia_socket_class); 937 class_unregister(&pcmcia_socket_class);
938
939 wait_for_completion(&pcmcia_unload);
926} 940}
927 941
928subsys_initcall(init_pcmcia_cs); 942subsys_initcall(init_pcmcia_cs);