/* convert gpio offset to gpio index taking into account gpio holes into gpio bank  */
int stm32_offset_to_index(struct udevice *dev, unsigned int offset)
/* convert gpio offset to gpio index taking into account gpio holes into gpio bank  */
int stm32_offset_to_index(struct udevice *dev, unsigned int offset)
{
	struct stm32_gpio_priv *priv = dev_get_priv(dev);
	unsigned int idx = 0;
	int i;
	for (i = 0; i < STM32_GPIOS_PER_BANK; i++) {
		if (priv->gpio_range & BIT(i)) {
			if (idx == offset)
				return idx;
			idx++;
		}
	}
	return -EINVAL;
}