gpio: max732x: Convert to immutable irq_chip
Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier <maz@kernel.org> Acked-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
5bfff76d27
commit
706cdfc517
@ -351,6 +351,7 @@ static void max732x_irq_mask(struct irq_data *d)
|
||||
struct max732x_chip *chip = gpiochip_get_data(gc);
|
||||
|
||||
chip->irq_mask_cur &= ~(1 << d->hwirq);
|
||||
gpiochip_disable_irq(gc, irqd_to_hwirq(d));
|
||||
}
|
||||
|
||||
static void max732x_irq_unmask(struct irq_data *d)
|
||||
@ -358,6 +359,7 @@ static void max732x_irq_unmask(struct irq_data *d)
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||
struct max732x_chip *chip = gpiochip_get_data(gc);
|
||||
|
||||
gpiochip_enable_irq(gc, irqd_to_hwirq(d));
|
||||
chip->irq_mask_cur |= 1 << d->hwirq;
|
||||
}
|
||||
|
||||
@ -429,7 +431,7 @@ static int max732x_irq_set_wake(struct irq_data *data, unsigned int on)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct irq_chip max732x_irq_chip = {
|
||||
static const struct irq_chip max732x_irq_chip = {
|
||||
.name = "max732x",
|
||||
.irq_mask = max732x_irq_mask,
|
||||
.irq_unmask = max732x_irq_unmask,
|
||||
@ -437,6 +439,8 @@ static struct irq_chip max732x_irq_chip = {
|
||||
.irq_bus_sync_unlock = max732x_irq_bus_sync_unlock,
|
||||
.irq_set_type = max732x_irq_set_type,
|
||||
.irq_set_wake = max732x_irq_set_wake,
|
||||
.flags = IRQCHIP_IMMUTABLE,
|
||||
GPIOCHIP_IRQ_RESOURCE_HELPERS,
|
||||
};
|
||||
|
||||
static uint8_t max732x_irq_pending(struct max732x_chip *chip)
|
||||
@ -517,7 +521,7 @@ static int max732x_irq_setup(struct max732x_chip *chip,
|
||||
}
|
||||
|
||||
girq = &chip->gpio_chip.irq;
|
||||
girq->chip = &max732x_irq_chip;
|
||||
gpio_irq_chip_set_chip(girq, &max732x_irq_chip);
|
||||
/* This will let us handle the parent IRQ in the driver */
|
||||
girq->parent_handler = NULL;
|
||||
girq->num_parents = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user