Commit 1a4541b6 authored by Hans Verkuil's avatar Hans Verkuil Committed by Linus Walleij

pinctrl-bcm2835: don't call pinctrl_gpio_direction()

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: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20211206131648.1521868-3-hverkuil-cisco@xs4all.nlSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent dc1b2424
...@@ -313,7 +313,10 @@ static inline void bcm2835_pinctrl_fsel_set( ...@@ -313,7 +313,10 @@ static inline void bcm2835_pinctrl_fsel_set(
static int bcm2835_gpio_direction_input(struct gpio_chip *chip, unsigned offset) static int bcm2835_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
{ {
return pinctrl_gpio_direction_input(chip->base + offset); struct bcm2835_pinctrl *pc = gpiochip_get_data(chip);
bcm2835_pinctrl_fsel_set(pc, offset, BCM2835_FSEL_GPIO_IN);
return 0;
} }
static int bcm2835_gpio_get(struct gpio_chip *chip, unsigned offset) static int bcm2835_gpio_get(struct gpio_chip *chip, unsigned offset)
...@@ -348,8 +351,11 @@ static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) ...@@ -348,8 +351,11 @@ static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
static int bcm2835_gpio_direction_output(struct gpio_chip *chip, static int bcm2835_gpio_direction_output(struct gpio_chip *chip,
unsigned offset, int value) unsigned offset, int value)
{ {
bcm2835_gpio_set(chip, offset, value); struct bcm2835_pinctrl *pc = gpiochip_get_data(chip);
return pinctrl_gpio_direction_output(chip->base + offset);
bcm2835_gpio_set_bit(pc, value ? GPSET0 : GPCLR0, offset);
bcm2835_pinctrl_fsel_set(pc, offset, BCM2835_FSEL_GPIO_OUT);
return 0;
} }
static const struct gpio_chip bcm2835_gpio_chip = { static const struct gpio_chip bcm2835_gpio_chip = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment