[PATCH 08/10] gpio: mt7621: Switch to dynamic chip name output

Marc Zyngier
2022-02-09T16:26:45Z

Instead of overloading the name field, use the relevant callback to
output the device name.

Signed-off-by: Marc Zyngier <maz@kernel.org>
---
drivers/gpio/gpio-mt7621.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-mt7621.c b/drivers/gpio/gpio-mt7621.c
index d8a26e503ca5..14ba4bc141c9 100644
--- a/drivers/gpio/gpio-mt7621.c
+++ b/drivers/gpio/gpio-mt7621.c
@@ -11,6 +11,7 @@
#include <linux/module.h>
#include <linux/of_irq.h>
#include <linux/platform_device.h>
+#include <linux/seq_file.h>
#include <linux/spinlock.h>

#define MTK_BANK_CNT 3
@@ -188,6 +189,15 @@ mediatek_gpio_irq_type(struct irq_data *d, unsigned int type)
return 0;
}

+static void mediatek_irq_print_chip(struct irq_data *d, struct seq_file *p)
+{
+ struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+ struct mtk_gc *rg = to_mediatek_gpio(gc);
+ struct mtk *mtk = container_of(rg - rg->bank, struct mtk, gc_map[0]);
+
+ seq_printf(p, dev_name(mtk->dev));
+}
+
static int
mediatek_gpio_xlate(struct gpio_chip *chip,
const struct of_phandle_args *spec, u32 *flags)
@@ -238,11 +248,11 @@ mediatek_gpio_bank_probe(struct device *dev, int bank)
return -ENOMEM;

rg->chip.offset = bank * MTK_BANK_WIDTH;
- rg->irq_chip.name = dev_name(dev);
rg->irq_chip.irq_unmask = mediatek_gpio_irq_unmask;
rg->irq_chip.irq_mask = mediatek_gpio_irq_mask;
rg->irq_chip.irq_mask_ack = mediatek_gpio_irq_mask;
rg->irq_chip.irq_set_type = mediatek_gpio_irq_type;
+ rg->irq_chip.irq_print_chip = mediatek_gpio_irq_print_chip;

if (mtk->gpio_irq) {
struct gpio_irq_chip *girq;
--
2.30.2