[PATCH 6/8] gpio: tqmx86: store IRQ triggers without offsetting index

From: Matthias Schiffer
Date: Wed May 29 2024 - 03:47:57 EST


This will allow us to move all offset handling into a single place in
the following commits. The additional irq_type indices remain unused,
but the tqmx86_gpio_data size increase is insignificant.

No functional change intended.

Fixes: b868db94a6a7 ("gpio: tqmx86: Add GPIO from for this IO controller")
Signed-off-by: Matthias Schiffer <matthias.schiffer@xxxxxxxxxxxxxxx>
---
drivers/gpio/gpio-tqmx86.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-tqmx86.c b/drivers/gpio/gpio-tqmx86.c
index d6e77f604f4df..4b37cc3bdd455 100644
--- a/drivers/gpio/gpio-tqmx86.c
+++ b/drivers/gpio/gpio-tqmx86.c
@@ -44,7 +44,7 @@ struct tqmx86_gpio_data {
int irq;
raw_spinlock_t spinlock;
DECLARE_BITMAP(output, TQMX86_NGPIO);
- u8 irq_type[TQMX86_NGPI];
+ u8 irq_type[TQMX86_NGPIO];
};

static u8 tqmx86_gpio_read(struct tqmx86_gpio_data *gd, unsigned int reg)
@@ -146,7 +146,7 @@ static void tqmx86_gpio_irq_unmask(struct irq_data *data)
gpiochip_enable_irq(&gpio->chip, irqd_to_hwirq(data));

mask = TQMX86_GPII_MASK(offset);
- val = TQMX86_GPII_CONFIG(offset, gpio->irq_type[offset]);
+ val = TQMX86_GPII_CONFIG(offset, gpio->irq_type[data->hwirq]);
raw_spin_lock_irqsave(&gpio->spinlock, flags);
_tqmx86_gpio_update_bits(gpio, TQMX86_GPIIC, mask, val);
raw_spin_unlock_irqrestore(&gpio->spinlock, flags);
@@ -175,7 +175,7 @@ static int tqmx86_gpio_irq_set_type(struct irq_data *data, unsigned int type)
return -EINVAL; /* not supported */
}

- gpio->irq_type[offset] = new_type;
+ gpio->irq_type[data->hwirq] = new_type;

mask = TQMX86_GPII_MASK(offset);
val = TQMX86_GPII_CONFIG(offset, new_type);
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/