• Masahiro Yamada's avatar
    gpio: of: remove of_gpiochip_and_xlate() and struct gg_data · 762c2e46
    Masahiro Yamada authored
    The usage of gpiochip_find(&gg_data, of_gpiochip_and_xlate) is odd.
    
    Usually gpiochip_find() is used to find a gpio_chip.  Here, however,
    the return value from gpiochip_find() is just discarded.  Instead,
    gpiochip_find(&gg_data, of_gpiochip_and_xlate) is called for the
    side-effect of the match function.
    
    The match function, of_gpiochip_find_and_xlate(), fills the given
    struct gg_data, but a match function should be simply called to
    judge the matching.
    
    This commit fixes this distortion and makes the code more readable.
    Remove of_gpiochip_find_and_xlate() and struct gg_data.  Instead,
    this adds a very simple helper function of_find_gpiochip_by_node().
    Now, of_get_named_gpiod_flags() is implemented more straight-forward.
    Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    762c2e46
gpiolib-of.c 11.9 KB