Skip to content

Commit 1a4541b

Browse files
Hans VerkuilLinus Walleij
authored andcommitted
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: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20211206131648.1521868-3-hverkuil-cisco@xs4all.nl Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent dc1b242 commit 1a4541b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/pinctrl/bcm/pinctrl-bcm2835.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,10 @@ static inline void bcm2835_pinctrl_fsel_set(
313313

314314
static int bcm2835_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
315315
{
316-
return pinctrl_gpio_direction_input(chip->base + offset);
316+
struct bcm2835_pinctrl *pc = gpiochip_get_data(chip);
317+
318+
bcm2835_pinctrl_fsel_set(pc, offset, BCM2835_FSEL_GPIO_IN);
319+
return 0;
317320
}
318321

319322
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)
348351
static int bcm2835_gpio_direction_output(struct gpio_chip *chip,
349352
unsigned offset, int value)
350353
{
351-
bcm2835_gpio_set(chip, offset, value);
352-
return pinctrl_gpio_direction_output(chip->base + offset);
354+
struct bcm2835_pinctrl *pc = gpiochip_get_data(chip);
355+
356+
bcm2835_gpio_set_bit(pc, value ? GPSET0 : GPCLR0, offset);
357+
bcm2835_pinctrl_fsel_set(pc, offset, BCM2835_FSEL_GPIO_OUT);
358+
return 0;
353359
}
354360

355361
static const struct gpio_chip bcm2835_gpio_chip = {

0 commit comments

Comments
 (0)