Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Aug 2011 18:36:58 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r225079 - head/sys/sys
Message-ID:  <201108221836.p7MIawPg063472@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Mon Aug 22 18:36:58 2011
New Revision: 225079
URL: http://svn.freebsd.org/changeset/base/225079

Log:
  Add two new macros DRIVER_MODULE_ORDERED() and EARLY_DRIVER_MODULE_ORDERED()
  that allow a module to use an order other than the default of
  SI_ORDER_MIDDLE when registering a driver.  This can be useful for drivers
  in a kld that contain multiple new-bus drivers as part of one logical device
  driver.  A typical case would be to use SI_ORDER_LAST for the "main" driver
  to ensure that any other "helper" drivers are registered and available
  before the "main" driver attempts to attach.
  
  Tested by:	kib, Jason Harmening  jason harmening / gmail
  Approved by:	re (kib)
  MFC after:	1 week

Modified:
  head/sys/sys/bus.h

Modified: head/sys/sys/bus.h
==============================================================================
--- head/sys/sys/bus.h	Mon Aug 22 16:35:46 2011	(r225078)
+++ head/sys/sys/bus.h	Mon Aug 22 18:36:58 2011	(r225079)
@@ -596,7 +596,8 @@ struct driver_module_data {
 	int		dmd_pass;
 };
 
-#define	EARLY_DRIVER_MODULE(name, busname, driver, devclass, evh, arg, pass) \
+#define	EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass,	\
+    evh, arg, order, pass)						\
 									\
 static struct driver_module_data name##_##busname##_driver_mod = {	\
 	evh, arg,							\
@@ -612,7 +613,16 @@ static moduledata_t name##_##busname##_m
 	&name##_##busname##_driver_mod					\
 };									\
 DECLARE_MODULE(name##_##busname, name##_##busname##_mod,		\
-	       SI_SUB_DRIVERS, SI_ORDER_MIDDLE)
+	       SI_SUB_DRIVERS, order)
+
+#define	EARLY_DRIVER_MODULE(name, busname, driver, devclass, evh, arg, pass) \
+	EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass,	\
+	    evh, arg, SI_ORDER_MIDDLE, pass)
+
+#define	DRIVER_MODULE_ORDERED(name, busname, driver, devclass, evh, arg,\
+    order)								\
+	EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass,	\
+	    evh, arg, order, BUS_PASS_DEFAULT)
 
 #define	DRIVER_MODULE(name, busname, driver, devclass, evh, arg)	\
 	EARLY_DRIVER_MODULE(name, busname, driver, devclass, evh, arg,	\



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