[PATCH RFC v2 4/4] gpio: loongson-64bit: remove gpio_to_irq() handler

From: Miao Wang via B4 Relay

Date: Thu Oct 01 2026 - 14:14:36 EST


From: Miao Wang <shankerwangmiao@xxxxxxxxx>

As pointed out in the previous commit, gpio_to_irq() should not be used
because it should not be used to manipulate the registers to enable
interrupts.

Signed-off-by: Miao Wang <shankerwangmiao@xxxxxxxxx>
---
drivers/gpio/gpio-loongson-64bit.c | 20 --------------------
1 file changed, 20 deletions(-)

diff --git a/drivers/gpio/gpio-loongson-64bit.c b/drivers/gpio/gpio-loongson-64bit.c
index 40ff845e21db18fa513d2d3b328bcb7ad16baf6a..4e6a490d524ef107e51729abd26cc4d2cbb00c41 100644
--- a/drivers/gpio/gpio-loongson-64bit.c
+++ b/drivers/gpio/gpio-loongson-64bit.c
@@ -141,24 +141,6 @@ static int loongson_gpio_set(struct gpio_chip *chip, unsigned int pin, int value
return 0;
}

-static int loongson_gpio_to_irq(struct gpio_chip *chip, unsigned int offset)
-{
- unsigned int u;
- struct platform_device *pdev = to_platform_device(chip->parent);
- struct loongson_gpio_chip *lgpio = to_loongson_gpio_chip(chip);
-
- if (lgpio->chip_data->mode == BIT_CTRL_MODE) {
- /* Get the register index from offset then multiply by bytes per register */
- u = readl(lgpio->reg_base + lgpio->chip_data->inten_offset + (offset / 32) * 4);
- u |= BIT(offset % 32);
- writel(u, lgpio->reg_base + lgpio->chip_data->inten_offset + (offset / 32) * 4);
- } else {
- writeb(1, lgpio->reg_base + lgpio->chip_data->inten_offset + offset);
- }
-
- return platform_get_irq(pdev, offset);
-}
-
static void loongson_gpio_irq_ack(struct irq_data *data)
{
struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
@@ -943,8 +925,6 @@ static int loongson_gpio_init(struct platform_device *pdev, struct loongson_gpio
dev_warn(&pdev->dev, "no parent IRQs ha been found, GPIO IRQs will not be available\n");
gpio_irq_chip_set_chip(&lgpio->chip.gc.irq, NULL);
}
- } else if (lgpio->chip_data->inten_offset) {
- lgpio->chip.gc.to_irq = loongson_gpio_to_irq;
}

return devm_gpiochip_add_data(&pdev->dev, &lgpio->chip.gc, lgpio);

--
2.55.0