Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jul 2007 17:28:17 GMT
From:      Maxim Zhuravlev <thioretic@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 123699 for review
Message-ID:  <200707181728.l6IHSHCa048858@repoman.freebsd.org>

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

Change 123699 by thioretic@thioretic on 2007/07/18 17:27:28

	Just some load code for DR_REQDEV drivers.

Affected files ...

.. //depot/projects/soc2007/thioretic_gidl/kern/subr_bus.c#17 edit

Differences ...

==== //depot/projects/soc2007/thioretic_gidl/kern/subr_bus.c#17 (text+ko) ====

@@ -4662,8 +4662,8 @@
 	drv_internal_t drv_intnl;
 	kobj_class_t driver;
 	char* parents[];
-	int count=0, isfilter;
-	device_t dev;
+	int count=0, isfilter, devcount;
+	device_t dev, *devices;
 
 	dmd = (struct driver_module_data *)arg;
 	drv_intnl = dmd->dmd_driver;
@@ -4702,14 +4702,14 @@
 			parentname = driver->baseclasses[0]->name;
 			*dmd->dmd_devclass =
 				devclass_find_internal(driver->name,
-				    parentname, TRUE);
+				    parentname, TRUE, FALSE);
 		} else {
 			*dmd->dmd_devclass =
-				devclass_find_internal(driver->name, 0, TRUE);
+				devclass_find_internal(driver->name, 0, TRUE, FALSR);
 		}
 
 		if(drv_intnl->flags & DR_REQDEV){ /*restrict to DR_LOWEST? */
-			dev = make_device (root_bus, DRIVERNAME(driver), -1/*, driver*/);
+			dev = make_device (root_bus, DRIVERNAME(driver), -1);
 			device_set_driver(dev, driver);
 			/*if (!hasclass)*/
 			device_set_devclass(dev, driver->name);
@@ -4718,12 +4718,21 @@
 			resource_int_value(dl->driver->name, child->unit,
 			    "flags", &child->devflags);
 			*/
+			count = 0;
+			while (parents[count]){
+				if (!(parent_devclass = devclass_find(parents[count++])))
+					continue;
+				devclass_get_devices(parent_devclass, &devices, &devcount);
+				for (i=0, i<devcount, i++){
+					device_add_existing_parent(dev, devices[i]);
+				}
+			}
+			
+			result = DEVICE_PROBE(dev);
 
-			result = DEVICE_PROBE(dev);
-			/* todo: set all parents for device
-			 * parents are all devices (alive) in parent
-			 * devclasses
-			 */
+			if(result <= 0)
+				device_attach(dev);
+			/*overwise the device is to be destroyed by now*/
 		}
 
 		break;



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