Skip to content

Commit

Permalink
pinctrl-sunxi: don't call pinctrl_gpio_direction()
Browse files Browse the repository at this point in the history
Set the direction directly without calling pinctrl_gpio_direction().
This avoids the mutex_lock() calls in that function, which would
invalid the can_sleep = false.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Link: https://lore.kernel.org/r/20211206131648.1521868-4-hverkuil-cisco@xs4all.nl
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Hans Verkuil authored and Linus Walleij committed Dec 16, 2021
1 parent 1a4541b commit 8df89a7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/pinctrl/sunxi/pinctrl-sunxi.c
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,9 @@ static const struct pinmux_ops sunxi_pmx_ops = {
static int sunxi_pinctrl_gpio_direction_input(struct gpio_chip *chip,
unsigned offset)
{
return pinctrl_gpio_direction_input(chip->base + offset);
struct sunxi_pinctrl *pctl = gpiochip_get_data(chip);

return sunxi_pmx_gpio_set_direction(pctl->pctl_dev, NULL, offset, true);
}

static int sunxi_pinctrl_gpio_get(struct gpio_chip *chip, unsigned offset)
Expand Down Expand Up @@ -885,8 +887,10 @@ static void sunxi_pinctrl_gpio_set(struct gpio_chip *chip,
static int sunxi_pinctrl_gpio_direction_output(struct gpio_chip *chip,
unsigned offset, int value)
{
struct sunxi_pinctrl *pctl = gpiochip_get_data(chip);

sunxi_pinctrl_gpio_set(chip, offset, value);
return pinctrl_gpio_direction_output(chip->base + offset);
return sunxi_pmx_gpio_set_direction(pctl->pctl_dev, NULL, offset, false);
}

static int sunxi_pinctrl_gpio_of_xlate(struct gpio_chip *gc,
Expand Down

0 comments on commit 8df89a7

Please sign in to comment.