Skip to content

Commit

Permalink
gpio: sprd: Make the irqchip immutable
Browse files Browse the repository at this point in the history
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: Cixi Geng <cixi.geng1@unisoc.com>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
  • Loading branch information
Cixi Geng authored and Bartosz Golaszewski committed Dec 30, 2022
1 parent be43eea commit 9883ddf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/gpio/gpio-sprd.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ static void sprd_gpio_irq_mask(struct irq_data *data)
u32 offset = irqd_to_hwirq(data);

sprd_gpio_update(chip, offset, SPRD_GPIO_IE, 0);
gpiochip_disable_irq(chip, offset);
}

static void sprd_gpio_irq_ack(struct irq_data *data)
Expand All @@ -136,6 +137,7 @@ static void sprd_gpio_irq_unmask(struct irq_data *data)
u32 offset = irqd_to_hwirq(data);

sprd_gpio_update(chip, offset, SPRD_GPIO_IE, 1);
gpiochip_enable_irq(chip, offset);
}

static int sprd_gpio_irq_set_type(struct irq_data *data,
Expand Down Expand Up @@ -205,13 +207,14 @@ static void sprd_gpio_irq_handler(struct irq_desc *desc)
chained_irq_exit(ic, desc);
}

static struct irq_chip sprd_gpio_irqchip = {
static const struct irq_chip sprd_gpio_irqchip = {
.name = "sprd-gpio",
.irq_ack = sprd_gpio_irq_ack,
.irq_mask = sprd_gpio_irq_mask,
.irq_unmask = sprd_gpio_irq_unmask,
.irq_set_type = sprd_gpio_irq_set_type,
.flags = IRQCHIP_SKIP_SET_WAKE,
.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_IMMUTABLE,
GPIOCHIP_IRQ_RESOURCE_HELPERS,
};

static int sprd_gpio_probe(struct platform_device *pdev)
Expand Down Expand Up @@ -245,7 +248,7 @@ static int sprd_gpio_probe(struct platform_device *pdev)
sprd_gpio->chip.direction_output = sprd_gpio_direction_output;

irq = &sprd_gpio->chip.irq;
irq->chip = &sprd_gpio_irqchip;
gpio_irq_chip_set_chip(irq, &sprd_gpio_irqchip);
irq->handler = handle_bad_irq;
irq->default_type = IRQ_TYPE_NONE;
irq->parent_handler = sprd_gpio_irq_handler;
Expand Down

0 comments on commit 9883ddf

Please sign in to comment.