mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 13:23:02 -04:00
pinctrl: npcm8xx: move GPIO IRQ setup into request_resources
npcmgpio_irq_startup() calls pinctrl_gpio_direction_input(), which may sleep while taking the pinctrl core mutex. That makes IRQ startup trip lockdep when CONFIG_PROVE_LOCKING is enabled. Move the direction change into irq_request_resources() and keep startup limited to the ack and unmask operations that are safe in atomic context. Signed-off-by: Tomer Maimon <tmaimon77@gmail.com> Signed-off-by: Linus Walleij <linusw@kernel.org>
This commit is contained in:
committed by
Linus Walleij
parent
565d368597
commit
b8edfde12e
@@ -297,17 +297,33 @@ static void npcmgpio_irq_unmask(struct irq_data *d)
|
||||
|
||||
static unsigned int npcmgpio_irq_startup(struct irq_data *d)
|
||||
{
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||
unsigned int gpio = irqd_to_hwirq(d);
|
||||
|
||||
/* active-high, input, clear interrupt, enable interrupt */
|
||||
npcmgpio_direction_input(gc, gpio);
|
||||
npcmgpio_irq_ack(d);
|
||||
npcmgpio_irq_unmask(d);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int npcmgpio_irq_request_resources(struct irq_data *d)
|
||||
{
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||
unsigned int gpio = irqd_to_hwirq(d);
|
||||
int ret;
|
||||
|
||||
ret = npcmgpio_direction_input(gc, gpio);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return gpiochip_reqres_irq(gc, gpio);
|
||||
}
|
||||
|
||||
static void npcmgpio_irq_release_resources(struct irq_data *d)
|
||||
{
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||
unsigned int gpio = irqd_to_hwirq(d);
|
||||
|
||||
gpiochip_relres_irq(gc, gpio);
|
||||
}
|
||||
|
||||
static struct irq_chip npcmgpio_irqchip = {
|
||||
.name = "NPCM8XX-GPIO-IRQ",
|
||||
.irq_ack = npcmgpio_irq_ack,
|
||||
@@ -315,8 +331,9 @@ static struct irq_chip npcmgpio_irqchip = {
|
||||
.irq_mask = npcmgpio_irq_mask,
|
||||
.irq_set_type = npcmgpio_set_irq_type,
|
||||
.irq_startup = npcmgpio_irq_startup,
|
||||
.irq_request_resources = npcmgpio_irq_request_resources,
|
||||
.irq_release_resources = npcmgpio_irq_release_resources,
|
||||
.flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE,
|
||||
GPIOCHIP_IRQ_RESOURCE_HELPERS,
|
||||
};
|
||||
|
||||
static const int gpi36_pins[] = { 36 };
|
||||
|
||||
Reference in New Issue
Block a user