Skip to content

Commit b93a8b2

Browse files
committed
gpio: dln2: make irq_chip immutable
Since recently, the kernel is nagging about mutable irq_chips: "not an immutable chip, please consider fixing it!" Drop the unneeded copy, flag it as IRQCHIP_IMMUTABLE, add the new helper functions and call the appropriate gpiolib functions. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
1 parent f1138da commit b93a8b2

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

drivers/gpio/gpio-dln2.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
struct dln2_gpio {
4747
struct platform_device *pdev;
4848
struct gpio_chip gpio;
49-
struct irq_chip irqchip;
5049

5150
/*
5251
* Cache pin direction to save us one transfer, since the hardware has
@@ -306,6 +305,7 @@ static void dln2_irq_unmask(struct irq_data *irqd)
306305
struct dln2_gpio *dln2 = gpiochip_get_data(gc);
307306
int pin = irqd_to_hwirq(irqd);
308307

308+
gpiochip_enable_irq(gc, pin);
309309
set_bit(pin, dln2->unmasked_irqs);
310310
}
311311

@@ -316,6 +316,7 @@ static void dln2_irq_mask(struct irq_data *irqd)
316316
int pin = irqd_to_hwirq(irqd);
317317

318318
clear_bit(pin, dln2->unmasked_irqs);
319+
gpiochip_disable_irq(gc, pin);
319320
}
320321

321322
static int dln2_irq_set_type(struct irq_data *irqd, unsigned type)
@@ -384,6 +385,17 @@ static void dln2_irq_bus_unlock(struct irq_data *irqd)
384385
mutex_unlock(&dln2->irq_lock);
385386
}
386387

388+
static const struct irq_chip dln2_irqchip = {
389+
.name = "dln2-irq",
390+
.irq_mask = dln2_irq_mask,
391+
.irq_unmask = dln2_irq_unmask,
392+
.irq_set_type = dln2_irq_set_type,
393+
.irq_bus_lock = dln2_irq_bus_lock,
394+
.irq_bus_sync_unlock = dln2_irq_bus_unlock,
395+
.flags = IRQCHIP_IMMUTABLE,
396+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
397+
};
398+
387399
static void dln2_gpio_event(struct platform_device *pdev, u16 echo,
388400
const void *data, int len)
389401
{
@@ -465,15 +477,8 @@ static int dln2_gpio_probe(struct platform_device *pdev)
465477
dln2->gpio.direction_output = dln2_gpio_direction_output;
466478
dln2->gpio.set_config = dln2_gpio_set_config;
467479

468-
dln2->irqchip.name = "dln2-irq",
469-
dln2->irqchip.irq_mask = dln2_irq_mask,
470-
dln2->irqchip.irq_unmask = dln2_irq_unmask,
471-
dln2->irqchip.irq_set_type = dln2_irq_set_type,
472-
dln2->irqchip.irq_bus_lock = dln2_irq_bus_lock,
473-
dln2->irqchip.irq_bus_sync_unlock = dln2_irq_bus_unlock,
474-
475480
girq = &dln2->gpio.irq;
476-
girq->chip = &dln2->irqchip;
481+
gpio_irq_chip_set_chip(girq, &dln2_irqchip);
477482
/* The event comes from the outside so no parent handler */
478483
girq->parent_handler = NULL;
479484
girq->num_parents = 0;

0 commit comments

Comments
 (0)