/* @gpio: The numeric representation of the GPIO @desc: Returns description (desc->flags will always be 0)  */
static int gpio_to_device(unsigned int gpio, struct gpio_desc *desc)
/* @gpio: The numeric representation of the GPIO @desc: Returns description (desc->flags will always be 0)  */
static int gpio_to_device(unsigned int gpio, struct gpio_desc *desc)
{
	struct gpio_dev_priv *uc_priv;
	struct udevice *dev;
	int ret;
	for (ret = uclass_first_device(UCLASS_GPIO, &dev);
	     dev;
	     ret = uclass_next_device(&dev)) {
		uc_priv = dev_get_uclass_priv(dev);
		if (gpio >= uc_priv->gpio_base &&
		    gpio < uc_priv->gpio_base + uc_priv->gpio_count) {
			gpio_desc_init(desc, dev, gpio - uc_priv->gpio_base);
			return 0;
		}
	}
	return ret ? ret : -ENOENT;
}