lib/extensions/amu/amu_fconf.c
static int amu_fconf_populate_cpu_amu(const void *fdt, int parent,
				      struct amu_fconf_core *amu)
{
	int ret = 0;
	int node = 0;

	fdt_for_each_subnode(node, fdt, parent) {
		const char *name;
		const char *value;
		int len;

		uintptr_t idx = 0U;

		name = fdt_get_name(fdt, node, &len);
		if (strncmp(name, "counter@", 8) != 0) {
			continue;
		}

		ret = fdt_get_reg_props_by_index(fdt, node, 0, &idx, NULL);
		if (ret < 0) {
			break;
		}

		value = fdt_getprop(fdt, node, "enable-at-el3", &len);
		if ((value == NULL) && (len != -FDT_ERR_NOTFOUND)) {
			break;
		}

		if (len != -FDT_ERR_NOTFOUND) {
			amu->enable |= (1 << idx);
		}
	}

	if ((node < 0) && (node != -FDT_ERR_NOTFOUND)) {
		return node;
	}

	return ret;
}
/*
 * Populate the core-specific AMU structure with information retrieved from a
 * device tree.
 *
 * Returns `0` on success, or a negative integer representing an error code.
 */
Populate the core-specific AMU structure with information retrieved from a
device tree.

Returns `0` on success, or a negative integer representing an error code.
Populate the core - specific AMU structure with information retrieved from a device tree . Returns ` 0 ` on success or a negative integer representing an error code .
static int amu_fconf_populate_cpu_amu(const void *fdt, int parent,
				      struct amu_fconf_core *amu)
{
	int ret = 0;
	int node = 0;
	fdt_for_each_subnode(node, fdt, parent) {
		const char *name;
		const char *value;
		int len;
		uintptr_t idx = 0U;
		name = fdt_get_name(fdt, node, &len);
		if (strncmp(name, "counter@", 8) != 0) {
			continue;
		}
		ret = fdt_get_reg_props_by_index(fdt, node, 0, &idx, NULL);
		if (ret < 0) {
			break;
		}
		value = fdt_getprop(fdt, node, "enable-at-el3", &len);
		if ((value == NULL) && (len != -FDT_ERR_NOTFOUND)) {
			break;
		}
		if (len != -FDT_ERR_NOTFOUND) {
			amu->enable |= (1 << idx);
		}
	}
	if ((node < 0) && (node != -FDT_ERR_NOTFOUND)) {
		return node;
	}
	return ret;
}
static int amu_fconf_populate_cpu_amu ( const void * fdt , int parent , struct amu_fconf_core * amu ) { int ret = 0 ; int node = 0 ; fdt_for_each_subnode ( node , fdt , parent ) { const char * name ; const char * value ; int len ; uintptr_t idx = 0U ; name = fdt_get_name ( fdt , node , & len ) ; if ( strncmp ( name , " " , 8 ) != 0 ) { continue ; } ret = fdt_get_reg_props_by_index ( fdt , node , 0 , & idx , NULL ) ; if ( ret < 0 ) { break ; } value = fdt_getprop ( fdt , node , " " , & len ) ; if ( ( value == NULL ) && ( len != - FDT_ERR_NOTFOUND ) ) { break ; } if ( len != - FDT_ERR_NOTFOUND ) { amu -> enable |= ( 1 << idx ) ; } } if ( ( node < 0 ) && ( node != - FDT_ERR_NOTFOUND ) ) { return node ; } return ret ; }
Populate the core-specific AMU structure with information retrieved from a
 device tree.
Populate the core - specific AMU structure with information retrieved from a device tree .