Skip to content

Commit 655dada

Browse files
committed
pinctrl: sirf: lock IRQs when starting them
This uses the new API for tagging GPIO lines as in use by IRQs. This enforces a few semantic checks on how the underlying GPIO line is used. Also assign the gpio_chip.dev pointer to be used for error messages. Cc: Barry Song <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent b07ddcd commit 655dada

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/pinctrl/sirf/pinctrl-sirf.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,12 +594,34 @@ static int sirfsoc_gpio_irq_type(struct irq_data *d, unsigned type)
594594
return 0;
595595
}
596596

597+
static unsigned int sirfsoc_gpio_irq_startup(struct irq_data *d)
598+
{
599+
struct sirfsoc_gpio_bank *bank = irq_data_get_irq_chip_data(d);
600+
601+
if (gpio_lock_as_irq(&bank->chip.gc, d->hwirq))
602+
dev_err(bank->chip.gc.dev,
603+
"unable to lock HW IRQ %lu for IRQ\n",
604+
d->hwirq);
605+
sirfsoc_gpio_irq_unmask(d);
606+
return 0;
607+
}
608+
609+
static void sirfsoc_gpio_irq_shutdown(struct irq_data *d)
610+
{
611+
struct sirfsoc_gpio_bank *bank = irq_data_get_irq_chip_data(d);
612+
613+
sirfsoc_gpio_irq_mask(d);
614+
gpio_unlock_as_irq(&bank->chip.gc, d->hwirq);
615+
}
616+
597617
static struct irq_chip sirfsoc_irq_chip = {
598618
.name = "sirf-gpio-irq",
599619
.irq_ack = sirfsoc_gpio_irq_ack,
600620
.irq_mask = sirfsoc_gpio_irq_mask,
601621
.irq_unmask = sirfsoc_gpio_irq_unmask,
602622
.irq_set_type = sirfsoc_gpio_irq_type,
623+
.irq_startup = sirfsoc_gpio_irq_startup,
624+
.irq_shutdown = sirfsoc_gpio_irq_shutdown,
603625
};
604626

605627
static void sirfsoc_gpio_handle_irq(unsigned int irq, struct irq_desc *desc)
@@ -877,6 +899,7 @@ static int sirfsoc_gpio_probe(struct device_node *np)
877899
bank->chip.gc.of_node = np;
878900
bank->chip.gc.of_xlate = sirfsoc_gpio_of_xlate;
879901
bank->chip.gc.of_gpio_n_cells = 2;
902+
bank->chip.gc.dev = &pdev->dev;
880903
bank->chip.regs = regs;
881904
bank->id = i;
882905
bank->is_marco = is_marco;

0 commit comments

Comments
 (0)