hal/hald/linux2 acpi.c, 1.5, 1.6 classdev.c, 1.9, 1.10 physdev.c, 1.6, 1.7

David Zeuthen david at freedesktop.org
Tue Feb 8 12:11:08 PST 2005


Update of /cvs/hal/hal/hald/linux2
In directory gabe:/tmp/cvs-serv6957/hald/linux2

Modified Files:
	acpi.c classdev.c physdev.c 
Log Message:
2005-02-08  David Zeuthen  <davidz at redhat.com>

	* hald/linux2/physdev.c (physdev_remove): Don't remove device yet.
	(physdev_callouts_add_done): New function
	(physdev_callouts_remove_done): New function
	(hotplug_event_begin_add_physdev): Do add callouts
	(hotplug_event_begin_remove_physdev): Do remove callouts

	* hald/linux2/classdev.c (classdev_remove): Don't remove device yet.
	(classdev_callouts_add_done): New function
	(classdev_callouts_remove_done): New function
	(add_classdev_after_probing): Do add callouts
	(hotplug_event_begin_remove_classdev): Do remove callouts

	* hald/linux2/acpi.c (acpi_callouts_remove_done): Yikes, don't remove
	from TDL since it's not there.



Index: acpi.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/acpi.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- acpi.c	8 Feb 2005 16:44:20 -0000	1.5
+++ acpi.c	8 Feb 2005 20:11:05 -0000	1.6
@@ -337,9 +337,6 @@
 
 	HAL_INFO (("Remove callouts completed udi=%s", d->udi));
 
-	/* Move from temporary to global device store */
-	hal_device_store_remove (hald_get_tdl (), d);
-
 	if (!hal_device_store_remove (hald_get_gdl (), d)) {
 		HAL_WARNING (("Error removing device"));
 	}

Index: classdev.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/classdev.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- classdev.c	8 Feb 2005 16:44:20 -0000	1.9
+++ classdev.c	8 Feb 2005 20:11:05 -0000	1.10
@@ -425,10 +425,6 @@
 static gboolean
 classdev_remove (HalDevice *d)
 {
-	if (!hal_device_store_remove (hald_get_gdl (), d)) {
-		HAL_WARNING (("Error removing device"));
-	}
-
 	return TRUE;
 }
 
@@ -511,6 +507,34 @@
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static void 
+classdev_callouts_add_done (HalDevice *d, gpointer userdata)
+{
+	void *end_token = (void *) userdata;
+
+	HAL_INFO (("Add callouts completed udi=%s", d->udi));
+
+	/* Move from temporary to global device store */
+	hal_device_store_remove (hald_get_tdl (), d);
+	hal_device_store_add (hald_get_gdl (), d);
+
+	hotplug_event_end (end_token);
+}
+
+static void 
+classdev_callouts_remove_done (HalDevice *d, gpointer userdata)
+{
+	void *end_token = (void *) userdata;
+
+	HAL_INFO (("Remove callouts completed udi=%s", d->udi));
+
+	if (!hal_device_store_remove (hald_get_gdl (), d)) {
+		HAL_WARNING (("Error removing device"));
+	}
+
+	hotplug_event_end (end_token);
+}
+
+static void 
 add_classdev_after_probing (HalDevice *d, ClassDevHandler *handler, void *end_token)
 {
 	/* Merge properties from .fdi files */
@@ -519,19 +543,17 @@
 	/* Compute UDI */
 	if (!handler->compute_udi (d)) {
 		hal_device_store_remove (hald_get_tdl (), d);
+		hotplug_event_end (end_token);
 		goto out;
 	}
 	
 	/* TODO: Merge persistent properties */
 
-	/* TODO: Run callouts */
-
-	/* Move from temporary to global device store */
-	hal_device_store_remove (hald_get_tdl (), d);
-	hal_device_store_add (hald_get_gdl (), d);
+	/* Run callouts */
+	hal_util_callout_device_add (d, classdev_callouts_add_done, end_token);
 
 out:
-	hotplug_event_end (end_token);
+	;
 }
 
 static void 
@@ -642,11 +664,10 @@
 			
 			handler = classdev_handlers[i];
 			if (strcmp (handler->subsystem, subsystem) == 0) {
-				if (handler->remove (d)) {
-					/* let the handler end the event */
-					hotplug_event_end (end_token);
-					goto out;
-				}
+				handler->remove (d);
+
+				hal_util_callout_device_remove (d, classdev_callouts_remove_done, end_token);
+				goto out;
 			}
 		}
 	}

Index: physdev.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/physdev.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- physdev.c	8 Feb 2005 16:44:20 -0000	1.6
+++ physdev.c	8 Feb 2005 20:11:05 -0000	1.7
@@ -745,10 +745,6 @@
 static gboolean
 physdev_remove (HalDevice *d)
 {
-	if (!hal_device_store_remove (hald_get_gdl (), d)) {
-		HAL_WARNING (("Error removing device"));
-	}
-
 	return TRUE;
 }
 
@@ -833,6 +829,34 @@
 
 /*--------------------------------------------------------------------------------------------------------------*/
 
+static void 
+physdev_callouts_add_done (HalDevice *d, gpointer userdata)
+{
+	void *end_token = (void *) userdata;
+
+	HAL_INFO (("Add callouts completed udi=%s", d->udi));
+
+	/* Move from temporary to global device store */
+	hal_device_store_remove (hald_get_tdl (), d);
+	hal_device_store_add (hald_get_gdl (), d);
+
+	hotplug_event_end (end_token);
+}
+
+static void 
+physdev_callouts_remove_done (HalDevice *d, gpointer userdata)
+{
+	void *end_token = (void *) userdata;
+
+	HAL_INFO (("Remove callouts completed udi=%s", d->udi));
+
+	if (!hal_device_store_remove (hald_get_gdl (), d)) {
+		HAL_WARNING (("Error removing device"));
+	}
+
+	hotplug_event_end (end_token);
+}
+
 void
 hotplug_event_begin_add_physdev (const gchar *subsystem, const gchar *sysfs_path, HalDevice *parent, void *end_token)
 {
@@ -863,8 +887,6 @@
 			/* Merge properties from .fdi files */
 			di_search_and_merge (d);
 
-			/* TODO: Run callouts */
-			
 			/* Compute UDI */
 			if (!handler->compute_udi (d)) {
 				hal_device_store_remove (hald_get_tdl (), d);
@@ -872,11 +894,8 @@
 				goto out;
 			}
 
-			/* Move from temporary to global device store */
-			hal_device_store_remove (hald_get_tdl (), d);
-			hal_device_store_add (hald_get_gdl (), d);
-			
-			hotplug_event_end (end_token);
+			/* Run callouts */
+			hal_util_callout_device_add (d, physdev_callouts_add_done, end_token);
 			goto out;
 		}
 	}
@@ -902,16 +921,16 @@
 		HAL_WARNING (("Couldn't remove device with sysfs path %s - not found", sysfs_path));
 		goto out;
 	}
-
+	
 	for (i = 0; phys_handlers [i] != NULL; i++) {
 		PhysDevHandler *handler;
-
+		
 		handler = phys_handlers[i];
 		if (strcmp (handler->subsystem, subsystem) == 0) {
-			if (handler->remove (d)) {
-				hotplug_event_end (end_token);
-				goto out2;
-			}
+			handler->remove (d);
+			
+			hal_util_callout_device_remove (d, physdev_callouts_remove_done, end_token);
+			goto out2;
 		}
 	}
 




More information about the hal-commit mailing list