/* Rather than call the GPIO framework every time, cache the last-programmed value. This speeds up sequential accesses (which are by far the most common type). We rely on the GPIO framework to treat non-zero value as high so that we don't have to normalize the bits.  */
static void gf_set_gpios(struct async_state *state, unsigned long ofs)
/* Rather than call the GPIO framework every time, cache the last-programmed value. This speeds up sequential accesses (which are by far the most common type). We rely on the GPIO framework to treat non-zero value as high so that we don't have to normalize the bits.  */
static void gf_set_gpios(struct async_state *state, unsigned long ofs)
{
	size_t i = 0;
	int value;
	ofs /= state->win_size;
	do {
		value = ofs & (1 << i);
		if (state->gpio_values[i] != value) {
			gpio_set_value(state->gpio_addrs[i], value);
			state->gpio_values[i] = value;
		}
	} while (++i < state->gpio_count);
}