lib/extensions/amu/amu_fconf.c
static int amu_fconf_foreach_cpu(const void *fdt,
				 int (*callback)(const void *, int, uintptr_t))
{
	int ret = 0;
	int parent, node = 0;

	parent = fdt_path_offset(fdt, "/cpus");
	if (parent < 0) {
		if (parent == -FDT_ERR_NOTFOUND) {
			parent = 0;
		}

		return parent;
	}

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

		uintptr_t mpidr = 0U;

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

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

		ret = callback(fdt, node, mpidr);
		if (ret < 0) {
			break;
		}
	}

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

	return ret;
}
/*
 * For every CPU node (`/cpus/cpu@n`) in an FDT, executes a callback passing a
 * pointer to the FDT and the offset of the CPU node. If the return value of the
 * callback is negative, it is treated as an error and the loop is aborted. In
 * this situation, the value of the callback is returned from the function.
 *
 * Returns `0` on success, or a negative integer representing an error code.
 */
For every CPU node (`/cpus/cpu@n`) in an FDT, executes a callback passing a
pointer to the FDT and the offset of the CPU node. If the return value of the
callback is negative, it is treated as an error and the loop is aborted. In
this situation, the value of the callback is returned from the function.

Returns `0` on success, or a negative integer representing an error code.
For every CPU node ( ` / cpus / cpu@n ` ) in an FDT executes a callback passing a pointer to the FDT and the offset of the CPU node . If the return value of the callback is negative it is treated as an error and the loop is aborted . In this situation the value of the callback is returned from the function . Returns ` 0 ` on success or a negative integer representing an error code .
static int amu_fconf_foreach_cpu(const void *fdt,
				 int (*callback)(const void *, int, uintptr_t))
{
	int ret = 0;
	int parent, node = 0;
	parent = fdt_path_offset(fdt, "/cpus");
	if (parent < 0) {
		if (parent == -FDT_ERR_NOTFOUND) {
			parent = 0;
		}
		return parent;
	}
	fdt_for_each_subnode(node, fdt, parent) {
		const char *name;
		int len;
		uintptr_t mpidr = 0U;
		name = fdt_get_name(fdt, node, &len);
		if (strncmp(name, "cpu@", 4) != 0) {
			continue;
		}
		ret = fdt_get_reg_props_by_index(fdt, node, 0, &mpidr, NULL);
		if (ret < 0) {
			break;
		}
		ret = callback(fdt, node, mpidr);
		if (ret < 0) {
			break;
		}
	}
	if ((node < 0) && (node != -FDT_ERR_NOTFOUND)) {
		return node;
	}
	return ret;
}
static int amu_fconf_foreach_cpu ( const void * fdt , int ( * callback ) ( const void * , int , uintptr_t ) ) { int ret = 0 ; int parent , node = 0 ; parent = fdt_path_offset ( fdt , " " ) ; if ( parent < 0 ) { if ( parent == - FDT_ERR_NOTFOUND ) { parent = 0 ; } return parent ; } fdt_for_each_subnode ( node , fdt , parent ) { const char * name ; int len ; uintptr_t mpidr = 0U ; name = fdt_get_name ( fdt , node , & len ) ; if ( strncmp ( name , " " , 4 ) != 0 ) { continue ; } ret = fdt_get_reg_props_by_index ( fdt , node , 0 , & mpidr , NULL ) ; if ( ret < 0 ) { break ; } ret = callback ( fdt , node , mpidr ) ; if ( ret < 0 ) { break ; } } if ( ( node < 0 ) && ( node != - FDT_ERR_NOTFOUND ) ) { return node ; } return ret ; }
For every CPU node (`/cpus/cpu@n`) in an FDT, executes a callback passing a
 pointer to the FDT and the offset of the CPU node.
For every CPU node ( ` / cpus / cpu@n ` ) in an FDT executes a callback passing a pointer to the FDT and the offset of the CPU node .