Commit 35f0aa77 authored by William Breathitt Gray's avatar William Breathitt Gray Committed by Bartosz Golaszewski

gpio: 104-dio-48e: Make irq_chip immutable

Kernel warns about mutable irq_chips:

    "not an immutable chip, please consider fixing!"

Make the struct irq_chip const, flag it as IRQCHIP_IMMUTABLE, add the
new helper functions, and call the appropriate gpiolib functions.
Signed-off-by: default avatarWilliam Breathitt Gray <william.gray@linaro.org>
Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
parent ee0175b3
...@@ -164,6 +164,7 @@ static void dio48e_irq_mask(struct irq_data *data) ...@@ -164,6 +164,7 @@ static void dio48e_irq_mask(struct irq_data *data)
dio48egpio->irq_mask &= ~BIT(0); dio48egpio->irq_mask &= ~BIT(0);
else else
dio48egpio->irq_mask &= ~BIT(1); dio48egpio->irq_mask &= ~BIT(1);
gpiochip_disable_irq(chip, offset);
if (!dio48egpio->irq_mask) if (!dio48egpio->irq_mask)
/* disable interrupts */ /* disable interrupts */
...@@ -191,6 +192,7 @@ static void dio48e_irq_unmask(struct irq_data *data) ...@@ -191,6 +192,7 @@ static void dio48e_irq_unmask(struct irq_data *data)
iowrite8(0x00, &dio48egpio->reg->enable_interrupt); iowrite8(0x00, &dio48egpio->reg->enable_interrupt);
} }
gpiochip_enable_irq(chip, offset);
if (offset == 19) if (offset == 19)
dio48egpio->irq_mask |= BIT(0); dio48egpio->irq_mask |= BIT(0);
else else
...@@ -213,12 +215,14 @@ static int dio48e_irq_set_type(struct irq_data *data, unsigned int flow_type) ...@@ -213,12 +215,14 @@ static int dio48e_irq_set_type(struct irq_data *data, unsigned int flow_type)
return 0; return 0;
} }
static struct irq_chip dio48e_irqchip = { static const struct irq_chip dio48e_irqchip = {
.name = "104-dio-48e", .name = "104-dio-48e",
.irq_ack = dio48e_irq_ack, .irq_ack = dio48e_irq_ack,
.irq_mask = dio48e_irq_mask, .irq_mask = dio48e_irq_mask,
.irq_unmask = dio48e_irq_unmask, .irq_unmask = dio48e_irq_unmask,
.irq_set_type = dio48e_irq_set_type .irq_set_type = dio48e_irq_set_type,
.flags = IRQCHIP_IMMUTABLE,
GPIOCHIP_IRQ_RESOURCE_HELPERS,
}; };
static irqreturn_t dio48e_irq_handler(int irq, void *dev_id) static irqreturn_t dio48e_irq_handler(int irq, void *dev_id)
...@@ -322,7 +326,7 @@ static int dio48e_probe(struct device *dev, unsigned int id) ...@@ -322,7 +326,7 @@ static int dio48e_probe(struct device *dev, unsigned int id)
dio48egpio->chip.set_multiple = dio48e_gpio_set_multiple; dio48egpio->chip.set_multiple = dio48e_gpio_set_multiple;
girq = &dio48egpio->chip.irq; girq = &dio48egpio->chip.irq;
girq->chip = &dio48e_irqchip; gpio_irq_chip_set_chip(girq, &dio48e_irqchip);
/* This will let us handle the parent IRQ in the driver */ /* This will let us handle the parent IRQ in the driver */
girq->parent_handler = NULL; girq->parent_handler = NULL;
girq->num_parents = 0; girq->num_parents = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment