FreeBSD/sys/dev/bhnd/cores/chipc/chipc.c
/**
 * Examine bus state and make a best effort determination of whether it's
 * likely safe to enable the muxed SPROM pins.
 * 
 * On devices that do not use SPROM pin muxing, always returns true.
 * 
 * @param sc chipc driver state.
 */
Examine bus state and make a best effort determination of whether it's
likely safe to enable the muxed SPROM pins.

On devices that do not use SPROM pin muxing, always returns true.

@param sc chipc driver state.
Examine bus state and make a best effort determination of whether it ' s likely safe to enable the muxed SPROM pins . On devices that do not use SPROM pin muxing always returns true . @param sc chipc driver state .
static bool
chipc_should_enable_sprom(struct chipc_softc *sc)
{
	device_t	*devs;
	device_t	 hostb;
	device_t	 parent;
	int		 devcount;
	int		 error;
	bool		 result;
	mtx_assert(&Giant, MA_OWNED);	
	if (!CHIPC_QUIRK(sc, MUX_SPROM))
		return (true);
	parent = device_get_parent(sc->dev);
	hostb = bhnd_find_hostb_device(parent);
	if ((error = device_get_children(parent, &devs, &devcount)))
		return (false);
	result = true;
	for (int i = 0; i < devcount; i++) {
		if (devs[i] == hostb || devs[i] == sc->dev)
			continue;
		if (!device_is_attached(devs[i]))
			continue;
		if (device_is_suspended(devs[i]))
			continue;
		result = false;
		break;
	}
	free(devs, M_TEMP);
	return (result);
}
static bool chipc_should_enable_sprom ( struct chipc_softc * sc ) { device_t * devs ; device_t hostb ; device_t parent ; int devcount ; int error ; bool result ; mtx_assert ( & Giant , MA_OWNED ) ; if ( ! CHIPC_QUIRK ( sc , MUX_SPROM ) ) return ( true ) ; parent = device_get_parent ( sc -> dev ) ; hostb = bhnd_find_hostb_device ( parent ) ; if ( ( error = device_get_children ( parent , & devs , & devcount ) ) ) return ( false ) ; result = true ; for ( int i = 0 ; i < devcount ; i ++ ) { if ( devs [ i ] == hostb || devs [ i ] == sc -> dev ) continue ; if ( ! device_is_attached ( devs [ i ] ) ) continue ; if ( device_is_suspended ( devs [ i ] ) ) continue ; result = false ; break ; } free ( devs , M_TEMP ) ; return ( result ) ; }
Examine bus state and make a best effort determination of whether it's
 likely safe to enable the muxed SPROM pins.
Examine bus state and make a best effort determination of whether it ' s likely safe to enable the muxed SPROM pins .
/* for newbus */ /* Nothing to do? */ /* Reject any active devices other than ChipCommon, or the
	 * host bridge (if any). */ /* Active device; assume SPROM is busy */