• Linus Walleij's avatar
    soc: fsl: qe: Avoid using gpio_to_desc() · 84582f9e
    Linus Walleij authored
    The qe gpio driver is a custom API combined GPIO and pin control
    driver that exist outside of the pin control subsystem for historical
    reasons.
    
    We want to get rid of the old GPIO numberspace, so instead of
    calling gpio_to_desc() we get the gpio descriptor for the requested
    line from the device tree directly without passing through the
    GPIO numberspace, and then we get the gpiochip from the descriptor.
    
    Using the reference counting inside the gpio descriptor we can drop
    the reference counting code in this driver. A second gpiod_get()
    will not succeed.
    
    To obtain the local hardware offset of the GPIO line, the driver
    need to include the header from the gpiolib internals. This isn't
    pretty but it is the lesser evil compared to keeping the code
    as a roadblock to gpiolib refactoring. A proper solution would be
    to rewrite the driver as a real pin control driver with a
    built-in gpio_chip.
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    Cc: Bartosz Golaszewski <brgl@bgdev.pl>
    Cc: linux-gpio@vger.kernel.org
    Link: https://lore.kernel.org/r/20221027081108.174662-1-linus.walleij@linaro.org'
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    84582f9e
gpio.c 8.52 KB