FreeBSD/sys/dev/firewire/firewire.c
/*
 * To attach sub-devices layer onto IEEE1394 bus.
 */
To attach sub-devices layer onto IEEE1394 bus.
To attach sub - devices layer onto IEEE1394 bus .
static void
fw_attach_dev(struct firewire_comm *fc)
{
	struct fw_device *fwdev, *next;
	int i, err;
	device_t *devlistp;
	int devcnt;
	struct firewire_dev_comm *fdc;
	for (fwdev = STAILQ_FIRST(&fc->devices); fwdev != NULL; fwdev = next) {
		next = STAILQ_NEXT(fwdev, link);
		if (fwdev->status == FWDEVINIT) {
			fwdev->status = FWDEVATTACHED;
		} else if (fwdev->status == FWDEVINVAL) {
			fwdev->rcnt++;
			if (firewire_debug)
				device_printf(fc->bdev, "%s:"
				    "fwdev->rcnt(%d), hold_count(%d)\n",
				    __func__, fwdev->rcnt, hold_count);
			if (fwdev->rcnt > hold_count) {
				STAILQ_REMOVE(&fc->devices, fwdev, fw_device,
				    link);
				free(fwdev, M_FW);
			}
		}
	}
	err = device_get_children(fc->bdev, &devlistp, &devcnt);
	if (err == 0) {
		for (i = 0; i < devcnt; i++) {
			if (device_get_state(devlistp[i]) >= DS_ATTACHED) {
				fdc = device_get_softc(devlistp[i]);
				if (fdc->post_explore != NULL)
					fdc->post_explore(fdc);
			}
		}
		free(devlistp, M_TEMP);
	}
	return;
}
static void fw_attach_dev ( struct firewire_comm * fc ) { struct fw_device * fwdev , * next ; int i , err ; device_t * devlistp ; int devcnt ; struct firewire_dev_comm * fdc ; for ( fwdev = STAILQ_FIRST ( & fc -> devices ) ; fwdev != NULL ; fwdev = next ) { next = STAILQ_NEXT ( fwdev , link ) ; if ( fwdev -> status == FWDEVINIT ) { fwdev -> status = FWDEVATTACHED ; } else if ( fwdev -> status == FWDEVINVAL ) { fwdev -> rcnt ++ ; if ( firewire_debug ) device_printf ( fc -> bdev , " " " \n " , __func__ , fwdev -> rcnt , hold_count ) ; if ( fwdev -> rcnt > hold_count ) { STAILQ_REMOVE ( & fc -> devices , fwdev , fw_device , link ) ; free ( fwdev , M_FW ) ; } } } err = device_get_children ( fc -> bdev , & devlistp , & devcnt ) ; if ( err == 0 ) { for ( i = 0 ; i < devcnt ; i ++ ) { if ( device_get_state ( devlistp [ i ] ) >= DS_ATTACHED ) { fdc = device_get_softc ( devlistp [ i ] ) ; if ( fdc -> post_explore != NULL ) fdc -> post_explore ( fdc ) ; } } free ( devlistp , M_TEMP ) ; } return ; }
To attach sub-devices layer onto IEEE1394 bus.
To attach sub - devices layer onto IEEE1394 bus .
/*
				 * Remove devices which have not been seen
				 * for a while.
				 */