Skip to content

Commit 9883ddf

Browse files
Cixi GengBartosz Golaszewski
authored andcommitted
gpio: sprd: Make the irqchip immutable
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: Cixi Geng <[email protected]> Reported-by: kernel test robot <[email protected]> Reported-by: Julia Lawall <[email protected]> Reviewed-by: Baolin Wang <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent be43eea commit 9883ddf

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/gpio/gpio-sprd.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ static void sprd_gpio_irq_mask(struct irq_data *data)
120120
u32 offset = irqd_to_hwirq(data);
121121

122122
sprd_gpio_update(chip, offset, SPRD_GPIO_IE, 0);
123+
gpiochip_disable_irq(chip, offset);
123124
}
124125

125126
static void sprd_gpio_irq_ack(struct irq_data *data)
@@ -136,6 +137,7 @@ static void sprd_gpio_irq_unmask(struct irq_data *data)
136137
u32 offset = irqd_to_hwirq(data);
137138

138139
sprd_gpio_update(chip, offset, SPRD_GPIO_IE, 1);
140+
gpiochip_enable_irq(chip, offset);
139141
}
140142

141143
static int sprd_gpio_irq_set_type(struct irq_data *data,
@@ -205,13 +207,14 @@ static void sprd_gpio_irq_handler(struct irq_desc *desc)
205207
chained_irq_exit(ic, desc);
206208
}
207209

208-
static struct irq_chip sprd_gpio_irqchip = {
210+
static const struct irq_chip sprd_gpio_irqchip = {
209211
.name = "sprd-gpio",
210212
.irq_ack = sprd_gpio_irq_ack,
211213
.irq_mask = sprd_gpio_irq_mask,
212214
.irq_unmask = sprd_gpio_irq_unmask,
213215
.irq_set_type = sprd_gpio_irq_set_type,
214-
.flags = IRQCHIP_SKIP_SET_WAKE,
216+
.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_IMMUTABLE,
217+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
215218
};
216219

217220
static int sprd_gpio_probe(struct platform_device *pdev)
@@ -245,7 +248,7 @@ static int sprd_gpio_probe(struct platform_device *pdev)
245248
sprd_gpio->chip.direction_output = sprd_gpio_direction_output;
246249

247250
irq = &sprd_gpio->chip.irq;
248-
irq->chip = &sprd_gpio_irqchip;
251+
gpio_irq_chip_set_chip(irq, &sprd_gpio_irqchip);
249252
irq->handler = handle_bad_irq;
250253
irq->default_type = IRQ_TYPE_NONE;
251254
irq->parent_handler = sprd_gpio_irq_handler;

0 commit comments

Comments
 (0)