Merge tag 'gpio-v3.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[firefly-linux-kernel-4.4.55.git] / drivers / gpio / gpiolib.c
index 6e00c82be1421e7a4dec378b1ea305fa8304a0d6..e8e98ca25ec7e468c95164a791866ae477f74f2b 100644 (file)
@@ -414,12 +414,12 @@ void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip,
                                 "chip that may sleep\n");
                        return;
                }
-               irq_set_chained_handler(parent_irq, parent_handler);
                /*
                 * The parent irqchip is already using the chip_data for this
                 * irqchip, so our callbacks simply use the handler_data.
                 */
                irq_set_handler_data(parent_irq, gpiochip);
+               irq_set_chained_handler(parent_irq, parent_handler);
        }
 
        /* Set the parent IRQ for all affected IRQs */
@@ -1692,7 +1692,7 @@ struct gpio_desc *__must_check __gpiod_get_index(struct device *dev,
                set_bit(FLAG_OPEN_SOURCE, &desc->flags);
 
        /* No particular flag request, return here... */
-       if (flags & GPIOD_FLAGS_BIT_DIR_SET)
+       if (!(flags & GPIOD_FLAGS_BIT_DIR_SET))
                return desc;
 
        /* Process flags */