Re: [PATCH 3/7] gpio: separate gpio driver from pinctrl-rockchip driver
From: Linus Walleij
Date: Mon May 24 2021 - 20:07:01 EST
On Mon, May 10, 2021 at 8:36 AM Jianqun Xu <jay.xu@xxxxxxxxxxxxxx> wrote:
> Separate the gpio driver from the pinctrl driver.
>
> Signed-off-by: Jianqun Xu <jay.xu@xxxxxxxxxxxxxx>
Overall this is very good and should be applied.
> +#include "../pinctrl/core.h"
> +#include "../pinctrl/pinctrl-rockchip.h"
Please explain in a comment exactly why you need to include
these files. I think it should be the goal to get rid of this dependency.
It seems that the driver can be further simplified using GPIO_GENERIC
but we can deal with this later, once it is separate.
> +static int rockchip_gpio_set_config(struct gpio_chip *gc, unsigned int offset,
> + unsigned long config)
> +{
> + enum pin_config_param param = pinconf_to_config_param(config);
> +
> + switch (param) {
> + case PIN_CONFIG_INPUT_DEBOUNCE:
> + rockchip_gpio_set_debounce(gc, offset, true);
(...)
> + .set_config = rockchip_gpio_set_config,
Can't you just use gpiochip_generic_config() and rely on the pinctrl
back-end to deal with this?
> + .to_irq = rockchip_gpio_to_irq,
Normally this should not be needed with GPIOLIB_IRQCHIP but
since you are refactoring an existing driver it is acceptable to
keep for now.
Yours,
Linus Walleij