Skip to content

Commit 0b7344a

Browse files
committed
Merge tag 'pinctrl-v5.17-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pin control fixes from Linus Walleij: "These two fixes should fix the issues seen on the OrangePi, first we needed the correct offset when calling pinctrl_gpio_direction(), and fixing that made a lockdep issue explode in our face. Both now fixed" * tag 'pinctrl-v5.17-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: pinctrl: sunxi: Use unique lockdep classes for IRQs pinctrl-sunxi: sunxi_pinctrl_gpio_direction_in/output: use correct offset
2 parents 0708a0a + bac129d commit 0b7344a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

drivers/pinctrl/sunxi/pinctrl-sunxi.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@
3636
#include "../core.h"
3737
#include "pinctrl-sunxi.h"
3838

39+
/*
40+
* These lock classes tell lockdep that GPIO IRQs are in a different
41+
* category than their parents, so it won't report false recursion.
42+
*/
43+
static struct lock_class_key sunxi_pinctrl_irq_lock_class;
44+
static struct lock_class_key sunxi_pinctrl_irq_request_class;
45+
3946
static struct irq_chip sunxi_pinctrl_edge_irq_chip;
4047
static struct irq_chip sunxi_pinctrl_level_irq_chip;
4148

@@ -837,7 +844,8 @@ static int sunxi_pinctrl_gpio_direction_input(struct gpio_chip *chip,
837844
{
838845
struct sunxi_pinctrl *pctl = gpiochip_get_data(chip);
839846

840-
return sunxi_pmx_gpio_set_direction(pctl->pctl_dev, NULL, offset, true);
847+
return sunxi_pmx_gpio_set_direction(pctl->pctl_dev, NULL,
848+
chip->base + offset, true);
841849
}
842850

843851
static int sunxi_pinctrl_gpio_get(struct gpio_chip *chip, unsigned offset)
@@ -890,7 +898,8 @@ static int sunxi_pinctrl_gpio_direction_output(struct gpio_chip *chip,
890898
struct sunxi_pinctrl *pctl = gpiochip_get_data(chip);
891899

892900
sunxi_pinctrl_gpio_set(chip, offset, value);
893-
return sunxi_pmx_gpio_set_direction(pctl->pctl_dev, NULL, offset, false);
901+
return sunxi_pmx_gpio_set_direction(pctl->pctl_dev, NULL,
902+
chip->base + offset, false);
894903
}
895904

896905
static int sunxi_pinctrl_gpio_of_xlate(struct gpio_chip *gc,
@@ -1555,6 +1564,8 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,
15551564
for (i = 0; i < (pctl->desc->irq_banks * IRQ_PER_BANK); i++) {
15561565
int irqno = irq_create_mapping(pctl->domain, i);
15571566

1567+
irq_set_lockdep_class(irqno, &sunxi_pinctrl_irq_lock_class,
1568+
&sunxi_pinctrl_irq_request_class);
15581569
irq_set_chip_and_handler(irqno, &sunxi_pinctrl_edge_irq_chip,
15591570
handle_edge_irq);
15601571
irq_set_chip_data(irqno, pctl);

0 commit comments

Comments
 (0)