register size_t lname;
config_make_softc(parent, cf)	struct device *parent;	struct cfdata *cf;{	register struct device *dev;	register struct cfdriver *cd;	register struct cfattach *ca;	register size_t lname;	cd = cf->cf_driver;	ca = cf->cf_attach;	if (ca->ca_devsize < sizeof(struct device))		panic("config_make_softc");	/* get memory for all device vars */	dev = (struct device *)malloc(ca->ca_devsize, M_DEVBUF, M_NOWAIT);	if (!dev)		panic("config_make_softc: allocation for device softc failed");	bzero(dev, ca->ca_devsize);	dev->dv_class = cd->cd_class;	dev->dv_cfdata = cf;	dev->dv_flags = DVF_ACTIVE;	/* always initially active */	/* If this is a STAR device, search for a free unit number */	if (cf->cf_fstate == FSTATE_STAR) {		for (dev->dv_unit = cf->cf_starunit1;		    dev->dv_unit < cf->cf_unit; dev->dv_unit++)			if (cd->cd_ndevs == 0 ||			    cd->cd_devs[dev->dv_unit] == NULL)				break;	} else		dev->dv_unit = cf->cf_unit;	/* compute length of name and decimal expansion of unit number */	lname = snprintf(dev->dv_xname, sizeof(dev->dv_xname), "%s%d",		    cd->cd_name, dev->dv_unit);	if (lname >= sizeof(dev->dv_xname))		panic("config_make_softc: device name too long");	dev->dv_parent = parent;	/* put this device in the devices array */	if (dev->dv_unit >= cd->cd_ndevs) {		/*		 * Need to expand the array.		 */		int old = cd->cd_ndevs, new;		void **nsp;		if (old == 0)			new = MINALLOCSIZE / sizeof(void *);		else			new = old * 2;		while (new <= dev->dv_unit)			new *= 2;		cd->cd_ndevs = new;		nsp = malloc(new * sizeof(void *), M_DEVBUF, M_NOWAIT);			if (nsp == 0)			panic("config_make_softc: %sing dev array",			    old != 0 ? "expand" : "creat");		bzero(nsp + old, (new - old) * sizeof(void *));		if (old != 0) {			bcopy(cd->cd_devs, nsp, old * sizeof(void *));			free(cd->cd_devs, M_DEVBUF);		}		cd->cd_devs = nsp;	}	if (cd->cd_devs[dev->dv_unit])		panic("config_make_softc: duplicate %s", dev->dv_xname);	dev->dv_ref = 1;	return (dev);}