Skip to content

Commit fa1329f

Browse files
William Breathitt Graybrgl
authored andcommitted
gpio: 104-idi-48: 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: William Breathitt Gray <william.gray@linaro.org> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
1 parent 35f0aa7 commit fa1329f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/gpio/gpio-104-idi-48.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ static void idi_48_irq_mask(struct irq_data *data)
113113
spin_lock_irqsave(&idi48gpio->lock, flags);
114114

115115
idi48gpio->irq_mask[boundary] &= ~mask;
116+
gpiochip_disable_irq(chip, offset);
116117

117118
/* Exit early if there are still input lines with IRQ unmasked */
118119
if (idi48gpio->irq_mask[boundary])
@@ -140,6 +141,7 @@ static void idi_48_irq_unmask(struct irq_data *data)
140141

141142
prev_irq_mask = idi48gpio->irq_mask[boundary];
142143

144+
gpiochip_enable_irq(chip, offset);
143145
idi48gpio->irq_mask[boundary] |= mask;
144146

145147
/* Exit early if IRQ was already unmasked for this boundary */
@@ -164,12 +166,14 @@ static int idi_48_irq_set_type(struct irq_data *data, unsigned int flow_type)
164166
return 0;
165167
}
166168

167-
static struct irq_chip idi_48_irqchip = {
169+
static const struct irq_chip idi_48_irqchip = {
168170
.name = "104-idi-48",
169171
.irq_ack = idi_48_irq_ack,
170172
.irq_mask = idi_48_irq_mask,
171173
.irq_unmask = idi_48_irq_unmask,
172-
.irq_set_type = idi_48_irq_set_type
174+
.irq_set_type = idi_48_irq_set_type,
175+
.flags = IRQCHIP_IMMUTABLE,
176+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
173177
};
174178

175179
static irqreturn_t idi_48_irq_handler(int irq, void *dev_id)
@@ -267,7 +271,7 @@ static int idi_48_probe(struct device *dev, unsigned int id)
267271
idi48gpio->chip.get_multiple = idi_48_gpio_get_multiple;
268272

269273
girq = &idi48gpio->chip.irq;
270-
girq->chip = &idi_48_irqchip;
274+
gpio_irq_chip_set_chip(girq, &idi_48_irqchip);
271275
/* This will let us handle the parent IRQ in the driver */
272276
girq->parent_handler = NULL;
273277
girq->num_parents = 0;

0 commit comments

Comments
 (0)