drivers: lora: sx1276: check gpio controller when looking for triggered DIO

So far only GPIO pin number of registered DIO line was compared with
arguments passed to GPIO callback. This is not enough when multiple gpio
controllers are used for DIO lines. As an example when DIO0 is on PA1
and DIO1 is on PB1, then DIO0 handler is called all the time.

Compare GPIO controller (in addition to pin number) of DIO lines with
the argument passed to gpio callback, so proper DIO handler is used.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
This commit is contained in:
Marcin Niestroj 2020-04-06 14:25:50 +02:00 committed by Kumar Gala
commit 2c23465dbc

View file

@ -164,7 +164,8 @@ static void sx1276_irq_callback(struct device *dev,
pin = find_lsb_set(pins) - 1;
for (i = 0; i < SX1276_MAX_DIO; i++) {
if (pin == sx1276_dios[i].pin) {
if (dev == dev_data.dio_dev[i] &&
pin == sx1276_dios[i].pin) {
(*DioIrq[i])(NULL);
}
}