FreeBSD/sys/dev/fdt/fdt_common.c
/*
 * This routine is an early-usage version of the ofw_bus_is_compatible() when
 * the ofw_bus I/F is not available (like early console routines and similar).
 * Note the buffer has to be on the stack since malloc() is usually not
 * available in such cases either.
 */
This routine is an early-usage version of the ofw_bus_is_compatible() when
the ofw_bus I/F is not available (like early console routines and similar).
Note the buffer has to be on the stack since malloc() is usually not
available in such cases either.
This routine is an early - usage version of the ofw_bus_is_compatible () when the ofw_bus I / F is not available ( like early console routines and similar ) . Note the buffer has to be on the stack since malloc () is usually not available in such cases either .
int
fdt_is_compatible(phandle_t node, const char *compatstr)
{
	char buf[FDT_COMPAT_LEN];
	char *compat;
	int len, onelen, l, rv;
	if ((len = OF_getproplen(node, "compatible")) <= 0)
		return (0);
	compat = (char *)&buf;
	bzero(compat, FDT_COMPAT_LEN);
	if (OF_getprop(node, "compatible", compat, FDT_COMPAT_LEN) < 0)
		return (0);
	onelen = strlen(compatstr);
	rv = 0;
	while (len > 0) {
		if (strncasecmp(compat, compatstr, onelen) == 0) {
			rv = 1;
			break;
		}
		l = strlen(compat) + 1;
		compat += l;
		len -= l;
	}
	return (rv);
}
int fdt_is_compatible ( phandle_t node , const char * compatstr ) { char buf [ FDT_COMPAT_LEN ] ; char * compat ; int len , onelen , l , rv ; if ( ( len = OF_getproplen ( node , " " ) ) <= 0 ) return ( 0 ) ; compat = ( char * ) & buf ; bzero ( compat , FDT_COMPAT_LEN ) ; if ( OF_getprop ( node , " " , compat , FDT_COMPAT_LEN ) < 0 ) return ( 0 ) ; onelen = strlen ( compatstr ) ; rv = 0 ; while ( len > 0 ) { if ( strncasecmp ( compat , compatstr , onelen ) == 0 ) { rv = 1 ; break ; } l = strlen ( compat ) + 1 ; compat += l ; len -= l ; } return ( rv ) ; }
This routine is an early-usage version of the ofw_bus_is_compatible() when
 the ofw_bus I/F is not available (like early console routines and similar).
This routine is an early - usage version of the ofw_bus_is_compatible () when the ofw_bus I / F is not available ( like early console routines and similar ) .
/* Found it. */ /* Slide to the next sub-string. */