gpio: eic-sprd: use atomic notifiers to notify all chips about irqs
Calling gpiochip_find() from interrupt handler in this driver is an abuse of the GPIO API. It only happens to work because nobody added a might_sleep() to it and the lock used by GPIOLIB is a spinlock. Both will soon be changed as we're limiting both the number of interfaces allowed to be called from atomic context as well as making struct gpio_chip private to the GPIO code that owns it. We'll also switch to protecting the global GPIO device list with a mutex as there is no reason to allow changes to it from interrupt handlers. Instead of iterating over all SPRD chips and looking up each corresponding GPIO chip, let's make each SPRD GPIO controller register with a notifier chain. The chain will be called at interrupt so that every chip that already probed will be notified. The rest of the interrupt handling remains the same. This should result in faster code as we're avoiding iterating over the list of all GPIO devices. Signed-off-by:Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by:
Chunyan Zhang <zhang.lyra@gmail.com> Tested-by:
Wenhua Lin <wenhua.lin@unisoc.com>
Showing
Please register or sign in to comment