On Wed, Feb 27, 2013 at 4:52 PM, Grant Likely <grant.lik...@secretlab.ca> wrote: > While you're working on that, I'd like you to keep the following in > mind. I'm getting concerned with the level of overhead that the gpio > access routines are incuring. They're doing a lot of checks right now > when with GPIOs we want it to be as fast as possible for the case of > mmio gpios. (i2c and spi gpios are always going to be slow, so I'm not > so concerned here). gpio_get, gpio_set and gpio_direction all need to > be fast. > > Basically, I think the model should be that if you've got a gpio_desc > pointer, then you've got a valid gpio.
Yes, that's what I had in mind as well. Since the only way to obtain a GPIO descriptor is through the gpiod_get() function(s), we can safely issues descriptors are valid. There should be no gpiod_is_valid() function. > A lot of the checks that are > currently performed in the gpiod_ versions of functions can be moved > to the gpio_ versions where a lookup has to be performed anyway. For > example, right now gpiod_direction_output() is 61 lines long. Madness! > :-) There is certainly room to optimize things and avoid redundant tests in the legacy GPIO API. Will be worth having a look at this once we have a clean gpiod implementation. > I've been playing with an idea of pulling in some basic MMIO gpio > access directly into gpiolib so that when appropriate gpiolib itself > can have a fast path for doing the register access and shadow register > management. Appealing. :) Alex. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/