Commit b93a8b2c authored by Andy Shevchenko's avatar Andy Shevchenko
Browse files

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent f1138dac
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@
struct dln2_gpio {
	struct platform_device *pdev;
	struct gpio_chip gpio;
	struct irq_chip irqchip;

	/*
	 * 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)
	struct dln2_gpio *dln2 = gpiochip_get_data(gc);
	int pin = irqd_to_hwirq(irqd);

	gpiochip_enable_irq(gc, pin);
	set_bit(pin, dln2->unmasked_irqs);
}

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

	clear_bit(pin, dln2->unmasked_irqs);
	gpiochip_disable_irq(gc, pin);
}

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)
	mutex_unlock(&dln2->irq_lock);
}

static const struct irq_chip dln2_irqchip = {
	.name = "dln2-irq",
	.irq_mask = dln2_irq_mask,
	.irq_unmask = dln2_irq_unmask,
	.irq_set_type = dln2_irq_set_type,
	.irq_bus_lock = dln2_irq_bus_lock,
	.irq_bus_sync_unlock = dln2_irq_bus_unlock,
	.flags = IRQCHIP_IMMUTABLE,
	GPIOCHIP_IRQ_RESOURCE_HELPERS,
};

static void dln2_gpio_event(struct platform_device *pdev, u16 echo,
			    const void *data, int len)
{
@@ -465,15 +477,8 @@ static int dln2_gpio_probe(struct platform_device *pdev)
	dln2->gpio.direction_output = dln2_gpio_direction_output;
	dln2->gpio.set_config = dln2_gpio_set_config;

	dln2->irqchip.name = "dln2-irq",
	dln2->irqchip.irq_mask = dln2_irq_mask,
	dln2->irqchip.irq_unmask = dln2_irq_unmask,
	dln2->irqchip.irq_set_type = dln2_irq_set_type,
	dln2->irqchip.irq_bus_lock = dln2_irq_bus_lock,
	dln2->irqchip.irq_bus_sync_unlock = dln2_irq_bus_unlock,

	girq = &dln2->gpio.irq;
	girq->chip = &dln2->irqchip;
	gpio_irq_chip_set_chip(girq, &dln2_irqchip);
	/* The event comes from the outside so no parent handler */
	girq->parent_handler = NULL;
	girq->num_parents = 0;