Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Dec 2007 21:48:07 GMT
From:      John Birrell <jb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 132128 for review
Message-ID:  <200712302148.lBULm7Ep092401@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=132128

Change 132128 by jb@jb_freebsd1 on 2007/12/30 21:47:07

	Move the event handler cleanup code from modevent to here so that
	the SYSUINIT drivers it.
	
	Use FreeBSD error values rather than the DDI_FAILURE hack.
	
	Remove some OpenSolaris-specific code.

Affected files ...

.. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_unload.c#16 edit

Differences ...

==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_unload.c#16 (text+ko) ====

@@ -22,14 +22,25 @@
  *
  */
 
-#define	DDI_FAILURE	EBUSY
-
 static int
 dtrace_unload()
 {
 	dtrace_state_t *state;
 	int error = 0;
 
+	/*
+	 * Check if there is still an event handler callback
+	 * registered.
+	 */
+	if (eh_tag != 0) {
+		/* De-register the device cloning event handler. */
+		EVENTHANDLER_DEREGISTER(dev_clone, eh_tag);
+		eh_tag = 0;
+
+		/* Stop device cloning. */
+		clone_cleanup(&dtrace_clones);
+	}
+
 	mutex_enter(&cpu_lock);
 	mutex_enter(&dtrace_provider_lock);
 	mutex_enter(&dtrace_lock);
@@ -40,14 +51,14 @@
 		mutex_exit(&dtrace_provider_lock);
 		mutex_exit(&dtrace_lock);
 		mutex_exit(&cpu_lock);
-		return (DDI_FAILURE);
+		return (EBUSY);
 	}
 
 	if (dtrace_unregister((dtrace_provider_id_t)dtrace_provider) != 0) {
 		mutex_exit(&dtrace_provider_lock);
 		mutex_exit(&dtrace_lock);
 		mutex_exit(&cpu_lock);
-		return (DDI_FAILURE);
+		return (EBUSY);
 	}
 
 	dtrace_provider = NULL;
@@ -120,13 +131,6 @@
 		dtrace_toxranges_max = 0;
 	}
 
-#ifdef DOODAD
-	ddi_remove_minor_node(dtrace_devi, NULL);
-	dtrace_devi = NULL;
-
-	ddi_soft_state_fini(&dtrace_softstate);
-#endif
-
 	ASSERT(dtrace_vtime_references == 0);
 	ASSERT(dtrace_opens == 0);
 	ASSERT(dtrace_retained == NULL);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712302148.lBULm7Ep092401>