Skip to content

Commit 410a504

Browse files
William Breathitt Graybrgl
authored andcommitted
gpio: 104-idio-16: 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 fa1329f commit 410a504

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

drivers/gpio/gpio-104-idio-16.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,11 @@ static void idio_16_irq_mask(struct irq_data *data)
174174
{
175175
struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
176176
struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip);
177-
const unsigned long mask = BIT(irqd_to_hwirq(data));
177+
const unsigned long offset = irqd_to_hwirq(data);
178178
unsigned long flags;
179179

180-
idio16gpio->irq_mask &= ~mask;
180+
idio16gpio->irq_mask &= ~BIT(offset);
181+
gpiochip_disable_irq(chip, offset);
181182

182183
if (!idio16gpio->irq_mask) {
183184
raw_spin_lock_irqsave(&idio16gpio->lock, flags);
@@ -192,11 +193,12 @@ static void idio_16_irq_unmask(struct irq_data *data)
192193
{
193194
struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
194195
struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip);
195-
const unsigned long mask = BIT(irqd_to_hwirq(data));
196+
const unsigned long offset = irqd_to_hwirq(data);
196197
const unsigned long prev_irq_mask = idio16gpio->irq_mask;
197198
unsigned long flags;
198199

199-
idio16gpio->irq_mask |= mask;
200+
gpiochip_enable_irq(chip, offset);
201+
idio16gpio->irq_mask |= BIT(offset);
200202

201203
if (!prev_irq_mask) {
202204
raw_spin_lock_irqsave(&idio16gpio->lock, flags);
@@ -217,12 +219,14 @@ static int idio_16_irq_set_type(struct irq_data *data, unsigned int flow_type)
217219
return 0;
218220
}
219221

220-
static struct irq_chip idio_16_irqchip = {
222+
static const struct irq_chip idio_16_irqchip = {
221223
.name = "104-idio-16",
222224
.irq_ack = idio_16_irq_ack,
223225
.irq_mask = idio_16_irq_mask,
224226
.irq_unmask = idio_16_irq_unmask,
225-
.irq_set_type = idio_16_irq_set_type
227+
.irq_set_type = idio_16_irq_set_type,
228+
.flags = IRQCHIP_IMMUTABLE,
229+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
226230
};
227231

228232
static irqreturn_t idio_16_irq_handler(int irq, void *dev_id)
@@ -299,7 +303,7 @@ static int idio_16_probe(struct device *dev, unsigned int id)
299303
idio16gpio->out_state = 0xFFFF;
300304

301305
girq = &idio16gpio->chip.irq;
302-
girq->chip = &idio_16_irqchip;
306+
gpio_irq_chip_set_chip(girq, &idio_16_irqchip);
303307
/* This will let us handle the parent IRQ in the driver */
304308
girq->parent_handler = NULL;
305309
girq->num_parents = 0;

0 commit comments

Comments
 (0)