Skip to content

Commit 289e42d

Browse files
MrVanBartosz Golaszewski
authored andcommitted
gpio: lpc18xx: Make irq_chip immutable
Kernel warns about mutable irq_chips: "not an immutable chip, please consider fixing!" Constify lpc18xx_gpio_pin_ic, flag the irq_chip as IRQCHIP_IMMUTABLE, add the new helper functions, and call the appropriate gpiolib functions. Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent a30be40 commit 289e42d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

drivers/gpio/gpio-lpc18xx.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ struct lpc18xx_gpio_pin_ic {
4242
void __iomem *base;
4343
struct irq_domain *domain;
4444
struct raw_spinlock lock;
45+
struct gpio_chip *gpio;
4546
};
4647

4748
struct lpc18xx_gpio_chip {
@@ -74,6 +75,7 @@ static void lpc18xx_gpio_pin_ic_mask(struct irq_data *d)
7475
{
7576
struct lpc18xx_gpio_pin_ic *ic = d->chip_data;
7677
u32 type = irqd_get_trigger_type(d);
78+
irq_hw_number_t hwirq = irqd_to_hwirq(d);
7779

7880
raw_spin_lock(&ic->lock);
7981

@@ -88,12 +90,17 @@ static void lpc18xx_gpio_pin_ic_mask(struct irq_data *d)
8890
raw_spin_unlock(&ic->lock);
8991

9092
irq_chip_mask_parent(d);
93+
94+
gpiochip_disable_irq(ic->gpio, hwirq);
9195
}
9296

9397
static void lpc18xx_gpio_pin_ic_unmask(struct irq_data *d)
9498
{
9599
struct lpc18xx_gpio_pin_ic *ic = d->chip_data;
96100
u32 type = irqd_get_trigger_type(d);
101+
irq_hw_number_t hwirq = irqd_to_hwirq(d);
102+
103+
gpiochip_enable_irq(ic->gpio, hwirq);
97104

98105
raw_spin_lock(&ic->lock);
99106

@@ -149,13 +156,14 @@ static int lpc18xx_gpio_pin_ic_set_type(struct irq_data *d, unsigned int type)
149156
return 0;
150157
}
151158

152-
static struct irq_chip lpc18xx_gpio_pin_ic = {
159+
static const struct irq_chip lpc18xx_gpio_pin_ic = {
153160
.name = "LPC18xx GPIO pin",
154161
.irq_mask = lpc18xx_gpio_pin_ic_mask,
155162
.irq_unmask = lpc18xx_gpio_pin_ic_unmask,
156163
.irq_eoi = lpc18xx_gpio_pin_ic_eoi,
157164
.irq_set_type = lpc18xx_gpio_pin_ic_set_type,
158-
.flags = IRQCHIP_SET_TYPE_MASKED,
165+
.flags = IRQCHIP_IMMUTABLE | IRQCHIP_SET_TYPE_MASKED,
166+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
159167
};
160168

161169
static int lpc18xx_gpio_pin_ic_domain_alloc(struct irq_domain *domain,
@@ -251,6 +259,7 @@ static int lpc18xx_gpio_pin_ic_probe(struct lpc18xx_gpio_chip *gc)
251259
goto free_iomap;
252260
}
253261

262+
ic->gpio = &gc->gpio;
254263
gc->pin_ic = ic;
255264

256265
return 0;

0 commit comments

Comments
 (0)