[patch 16/19] pcmcia: release_class

Dominik Brodowski linux at dominikbrodowski.net
Sun Mar 20 05:44:12 EST 2005


Properly wait for the class refcount to reach zero.

Signed-off-by: Dominik Brodowski <linux at dominikbrodowski.net>

Index: 2.6.12-rc1/drivers/pcmcia/cs.c
===================================================================
--- 2.6.12-rc1.orig/drivers/pcmcia/cs.c	2005-03-19 11:18:32.000000000 +0100
+++ 2.6.12-rc1/drivers/pcmcia/cs.c	2005-03-19 11:23:15.000000000 +0100
@@ -887,17 +887,29 @@
 }
 
 
+static struct completion pcmcia_unload;
+
+static void pcmcia_release_socket_class(struct class *data)
+{
+	complete(&pcmcia_unload);
+}
+
+
 struct class pcmcia_socket_class = {
 	.name = "pcmcia_socket",
         .hotplug = pcmcia_socket_hotplug,
 	.release = pcmcia_release_socket,
+	.class_release = pcmcia_release_socket_class,
 };
 EXPORT_SYMBOL(pcmcia_socket_class);
 
 
 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)
 		return (ret);
 	return class_interface_register(&pccard_sysfs_interface);
@@ -907,6 +919,8 @@
 {
 	class_interface_unregister(&pccard_sysfs_interface);
 	class_unregister(&pcmcia_socket_class);
+
+	wait_for_completion(&pcmcia_unload);
 }
 
 subsys_initcall(init_pcmcia_cs);



More information about the linux-pcmcia mailing list