/* Returns 0 on success, or a negative FDT error code on error.  */
int fdt_set_phy_handle(void *fdt, char *compat, phys_addr_t addr, const char *alias)
/* Returns 0 on success, or a negative FDT error code on error.  */
int fdt_set_phy_handle(void *fdt, char *compat, phys_addr_t addr, const char *alias)
{
	int offset;
	unsigned int ph;
	const char *path;
	path = fdt_get_alias(fdt, alias);
	if (!path)
		return -FDT_ERR_BADPATH;
	offset = fdt_path_offset(fdt, path);
	if (offset < 0)
		return offset;
	ph = fdt_create_phandle(fdt, offset);
	if (!ph)
		return -FDT_ERR_BADPHANDLE;
	ph = cpu_to_fdt32(ph);
	offset = fdt_node_offset_by_compat_reg(fdt, compat, addr);
	if (offset < 0)
		return offset;
	return fdt_setprop(fdt, offset, "phy-handle", &ph, sizeof(ph));
}