/* Find the udevice that either has the name passed in as devname or has an alias named devname.  */
struct udevice* eth_get_dev_by_name(const char *devname)
/* Find the udevice that either has the name passed in as devname or has an alias named devname.  */
struct udevice* eth_get_dev_by_name(const char *devname)
{
	int seq = -1;
	char *endp = NULL;
	const char *startp = NULL;
	struct udevice *it;
	struct uclass *uc;
	int len = strlen("eth");
	if (!strncmp(devname, "eth", len) && strlen(devname) > len) {
		startp = devname + len;
		seq = simple_strtoul(startp, &endp, 10);
	}
	uclass_get(UCLASS_ETH, &uc);
	uclass_foreach_dev(it, uc) {
		if (device_probe(it))
			continue;
		if (strcmp(it->name, devname) == 0 ||
		    (endp > startp && it->seq == seq))
			return it;
	}
	return NULL;
}