Skip to content

Commit 718b972

Browse files
geertubrgl
authored andcommitted
gpio: rcar: Make the irqchip immutable
Commit 6c846d0 ("gpio: Don't fiddle with irqchips marked as immutable") added a warning to indicate if the gpiolib is altering the internals of irqchips. Following this change the following warning is now observed for the gpio-rcar driver: gpio gpiochip0: (e6050000.gpio): not an immutable chip, please consider fixing it! Fix this by making the irqchip in the gpio-rcar driver immutable. Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 61550be commit 718b972

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

drivers/gpio/gpio-rcar.c

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ struct gpio_rcar_priv {
4444
spinlock_t lock;
4545
struct device *dev;
4646
struct gpio_chip gpio_chip;
47-
struct irq_chip irq_chip;
4847
unsigned int irq_parent;
4948
atomic_t wakeup_path;
5049
struct gpio_rcar_info info;
@@ -96,16 +95,20 @@ static void gpio_rcar_irq_disable(struct irq_data *d)
9695
{
9796
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
9897
struct gpio_rcar_priv *p = gpiochip_get_data(gc);
98+
irq_hw_number_t hwirq = irqd_to_hwirq(d);
9999

100-
gpio_rcar_write(p, INTMSK, ~BIT(irqd_to_hwirq(d)));
100+
gpio_rcar_write(p, INTMSK, ~BIT(hwirq));
101+
gpiochip_disable_irq(gc, hwirq);
101102
}
102103

103104
static void gpio_rcar_irq_enable(struct irq_data *d)
104105
{
105106
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
106107
struct gpio_rcar_priv *p = gpiochip_get_data(gc);
108+
irq_hw_number_t hwirq = irqd_to_hwirq(d);
107109

108-
gpio_rcar_write(p, MSKCLR, BIT(irqd_to_hwirq(d)));
110+
gpiochip_enable_irq(gc, hwirq);
111+
gpio_rcar_write(p, MSKCLR, BIT(hwirq));
109112
}
110113

111114
static void gpio_rcar_config_interrupt_input_mode(struct gpio_rcar_priv *p,
@@ -203,6 +206,17 @@ static int gpio_rcar_irq_set_wake(struct irq_data *d, unsigned int on)
203206
return 0;
204207
}
205208

209+
static const struct irq_chip gpio_rcar_irq_chip = {
210+
.name = "gpio-rcar",
211+
.irq_mask = gpio_rcar_irq_disable,
212+
.irq_unmask = gpio_rcar_irq_enable,
213+
.irq_set_type = gpio_rcar_irq_set_type,
214+
.irq_set_wake = gpio_rcar_irq_set_wake,
215+
.flags = IRQCHIP_IMMUTABLE | IRQCHIP_SET_TYPE_MASKED |
216+
IRQCHIP_MASK_ON_SUSPEND,
217+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
218+
};
219+
206220
static irqreturn_t gpio_rcar_irq_handler(int irq, void *dev_id)
207221
{
208222
struct gpio_rcar_priv *p = dev_id;
@@ -481,7 +495,6 @@ static int gpio_rcar_probe(struct platform_device *pdev)
481495
{
482496
struct gpio_rcar_priv *p;
483497
struct gpio_chip *gpio_chip;
484-
struct irq_chip *irq_chip;
485498
struct gpio_irq_chip *girq;
486499
struct device *dev = &pdev->dev;
487500
const char *name = dev_name(dev);
@@ -531,16 +544,8 @@ static int gpio_rcar_probe(struct platform_device *pdev)
531544
gpio_chip->base = -1;
532545
gpio_chip->ngpio = npins;
533546

534-
irq_chip = &p->irq_chip;
535-
irq_chip->name = "gpio-rcar";
536-
irq_chip->irq_mask = gpio_rcar_irq_disable;
537-
irq_chip->irq_unmask = gpio_rcar_irq_enable;
538-
irq_chip->irq_set_type = gpio_rcar_irq_set_type;
539-
irq_chip->irq_set_wake = gpio_rcar_irq_set_wake;
540-
irq_chip->flags = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_MASK_ON_SUSPEND;
541-
542547
girq = &gpio_chip->irq;
543-
girq->chip = irq_chip;
548+
gpio_irq_chip_set_chip(girq, &gpio_rcar_irq_chip);
544549
/* This will let us handle the parent IRQ in the driver */
545550
girq->parent_handler = NULL;
546551
girq->num_parents = 0;

0 commit comments

Comments
 (0)