/* This is simple translation function, suitable for the most 1:1 mapped gpio chips. This function performs only one sanity check: whether gpio is less than ngpios (that is specified in the gpio_chip).  */
int of_gpio_simple_xlate(struct of_gpio_chip *of_gc, struct device_node *np, const void *gpio_spec, enum of_gpio_flags *flags)
/* This is simple translation function, suitable for the most 1:1 mapped gpio chips. This function performs only one sanity check: whether gpio is less than ngpios (that is specified in the gpio_chip).  */
int of_gpio_simple_xlate(struct of_gpio_chip *of_gc, struct device_node *np, const void *gpio_spec, enum of_gpio_flags *flags)
{
	const u32 *gpio = gpio_spec;
	if (of_gc->gpio_cells < 2) {
		WARN_ON(1);
		return -EINVAL;
	}
	if (*gpio > of_gc->gc.ngpio)
		return -EINVAL;
	if (flags)
		*flags = gpio[1];
	return *gpio;
}