Date: Sun, 29 Jul 2007 14:55:47 GMT From: Maxim Zhuravlev <thioretic@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 124314 for review Message-ID: <200707291455.l6TEtls5024734@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=124314 Change 124314 by thioretic@thioretic on 2007/07/29 14:55:46 Some semantics verification and resulting cleanups. Affected files ... .. //depot/projects/soc2007/thioretic_gidl/kern/subr_bus.c#23 edit Differences ... ==== //depot/projects/soc2007/thioretic_gidl/kern/subr_bus.c#23 (text+ko) ==== @@ -1345,7 +1345,9 @@ } return (NULL); } + dcl->devclass_ptr = dc; TAILQ_INSERT_TAIL(&dcp->filters, dcl, link); + bus_data_generation_update(); } return (dc); } @@ -1404,7 +1406,6 @@ if (!dl) return (ENOMEM); - isfilter = driverinfo_isfilter (driver); /* * Compile the driver's methods. Also increase the reference count * so that the class doesn't get freed when the last instance @@ -1416,10 +1417,15 @@ drv_internal_t drv_intnl; drv_intnl = driverinfo_create_driver_drv_internal (driver); - if (!drv_intnl && !(di = driverinfo_add_driver(intnl))) - if (drv_intnl) free (drv_intnl); + if (!drv_intnl && !(di = driverinfo_add_driver(drv_intnl))) + if (drv_intnl){ + free (drv_intnl); + return (1); + } } + isfilter = driverinfo_isfilter (driver); + /* * Make sure the devclass which the driver is implementing exists. */ @@ -1442,7 +1448,7 @@ BUS_DRIVER_ADDED(dc->devices[i], driver); } else { - devclass_filter2devices(dc, driver); + devclass_filter2devices(pdc, driver); } bus_data_generation_update(); @@ -1970,8 +1976,6 @@ dev->devclass = dc; snprintf(dev->nameunit, buflen, "%s%d", dc->name, dev->unit); - devclass_device2filters (dc, dev); - return (0); } @@ -2015,6 +2019,12 @@ device_set_driver (dev, driver); if (DEVICE_PROBE(dev)<=0){ device_attach(dev); + else { + dev->driver = TAILQ_FIRST(&dev->drivers[DRL_LOWEST]); + dev->driver_level=DRL_LOWEST; + dev->raw--; + if(!dev->raw) + dev->state = DS_ATTACHED; } } @@ -2039,7 +2049,7 @@ for (i=0, i<=dc->maxunit; i++){ if ((dc->devices[i]) && - ((dc->devices[i])->state >= DS_ALIVE)) + ((dc->devices[i])->state == DS_ATTACHED)) filter_probe_and_attach (dv->devices[i], filter); } } @@ -2082,12 +2092,13 @@ return (NULL); TAILQ_INIT(&(dev->parents)); pd = malloc(sizeof(struct devicelink), M_BUS, M_NOWAIT|M_ZERO); + if (!pd){free(dev); return(NULL);} pd->device_ptr = parent; - TAILQ_INSERT_TAIL(&(dev->parents), pd, link); - TAILQ_INIT(&(dev->children)); + TAILQ_INSERT_TAIL(&dev->parents, pd, link); + TAILQ_INIT(&dev->children); kobj_init((kobj_t) dev, &drv_compat_ctrl_driver) for (level=DRL_LOWEST; level<=DRL_TOPMOST; level++) - TAILQ_INIT(&((dev->drivers)[level])); + TAILQ_INIT(&dev->drivers[level]); dev->devclass = NULL; dev->state = DS_NOTPRESENT; dev->refs = 0; @@ -3212,7 +3223,7 @@ level = driverinfo_flags2idx(flags); if (driver != NULL){ - TAILQ_FOREACH(dil, &(dev->drivers[level]), link){ + TAILQ_FOREACH(dil, &dev->drivers[level], link){ if (dil->pdriver == di) break; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707291455.l6TEtls5024734>