/* @dev: pin controller device @pin: the pin name to look up  */
static int pinctrl_pin_name_to_selector(struct udevice *dev, const char *pin)
/* @dev: pin controller device @pin: the pin name to look up  */
static int pinctrl_pin_name_to_selector(struct udevice *dev, const char *pin)
{
	const struct pinctrl_ops *ops = pinctrl_get_ops(dev);
	unsigned npins, selector;
	if (!ops->get_pins_count || !ops->get_pin_name) {
		dev_dbg(dev, "get_pins_count or get_pin_name missing\n");
		return -ENOSYS;
	}
	npins = ops->get_pins_count(dev);
	for (selector = 0; selector < npins; selector++) {
		const char *pname = ops->get_pin_name(dev, selector);
		if (!strcmp(pin, pname))
			return selector;
	}
	return -ENOSYS;
}