davinci: tnetv107x: fix register indexing for GPIOs numbers > 31

This patch fix a bug in the register indexing for GPIOs numbers > 31
to get the relevant hardware registers of tnetv107x to control the GPIOs.

In the structure tnetv107x_gpio_regs:

struct tnetv107x_gpio_regs {
u32 idver;
u32 data_in[3];
u32 data_out[3];
u32 direction[3];
u32 enable[3];
};

The GPIO hardware register addresses of tnetv107x are stored.
The chip implements 3 registers of each entity to serve 96 GPIOs,
each register provides a subset of 32 GPIOs.
The driver provides these macros: gpio_reg_set_bit, gpio_reg_get_bit
and gpio_reg_clear_bit.

The bug implied the use of macros to access the relevant hardware
register e.g. the driver code used the macro like this:
'gpio_reg_clear_bit(&reg->data_out, gpio)'

But it has to be used like this:
'gpio_reg_clear_bit(reg->data_out, gpio)'.

The different results are shown here:
- &reg->data_out + 1 (it will add the full array size of data_out i.e. 12 bytes)
- reg->data_out + 1 (it will increment only the size of data_out i.e. only 4 bytes)

Acked-by: Cyril Chemparathy <cyril@ti.com>
Signed-off-by: Hirosh Dabui <hirosh.dabui@snom.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>

authored by Hirosh Dabui and committed by Kevin Hilman c284d9fa b3d1ffb2

+9 -9
+9 -9
arch/arm/mach-davinci/gpio-tnetv107x.c
··· 58 59 spin_lock_irqsave(&ctlr->lock, flags); 60 61 - gpio_reg_set_bit(&regs->enable, gpio); 62 63 spin_unlock_irqrestore(&ctlr->lock, flags); 64 ··· 74 75 spin_lock_irqsave(&ctlr->lock, flags); 76 77 - gpio_reg_clear_bit(&regs->enable, gpio); 78 79 spin_unlock_irqrestore(&ctlr->lock, flags); 80 } ··· 88 89 spin_lock_irqsave(&ctlr->lock, flags); 90 91 - gpio_reg_set_bit(&regs->direction, gpio); 92 93 spin_unlock_irqrestore(&ctlr->lock, flags); 94 ··· 106 spin_lock_irqsave(&ctlr->lock, flags); 107 108 if (value) 109 - gpio_reg_set_bit(&regs->data_out, gpio); 110 else 111 - gpio_reg_clear_bit(&regs->data_out, gpio); 112 113 - gpio_reg_clear_bit(&regs->direction, gpio); 114 115 spin_unlock_irqrestore(&ctlr->lock, flags); 116 ··· 124 unsigned gpio = chip->base + offset; 125 int ret; 126 127 - ret = gpio_reg_get_bit(&regs->data_in, gpio); 128 129 return ret ? 1 : 0; 130 } ··· 140 spin_lock_irqsave(&ctlr->lock, flags); 141 142 if (value) 143 - gpio_reg_set_bit(&regs->data_out, gpio); 144 else 145 - gpio_reg_clear_bit(&regs->data_out, gpio); 146 147 spin_unlock_irqrestore(&ctlr->lock, flags); 148 }
··· 58 59 spin_lock_irqsave(&ctlr->lock, flags); 60 61 + gpio_reg_set_bit(regs->enable, gpio); 62 63 spin_unlock_irqrestore(&ctlr->lock, flags); 64 ··· 74 75 spin_lock_irqsave(&ctlr->lock, flags); 76 77 + gpio_reg_clear_bit(regs->enable, gpio); 78 79 spin_unlock_irqrestore(&ctlr->lock, flags); 80 } ··· 88 89 spin_lock_irqsave(&ctlr->lock, flags); 90 91 + gpio_reg_set_bit(regs->direction, gpio); 92 93 spin_unlock_irqrestore(&ctlr->lock, flags); 94 ··· 106 spin_lock_irqsave(&ctlr->lock, flags); 107 108 if (value) 109 + gpio_reg_set_bit(regs->data_out, gpio); 110 else 111 + gpio_reg_clear_bit(regs->data_out, gpio); 112 113 + gpio_reg_clear_bit(regs->direction, gpio); 114 115 spin_unlock_irqrestore(&ctlr->lock, flags); 116 ··· 124 unsigned gpio = chip->base + offset; 125 int ret; 126 127 + ret = gpio_reg_get_bit(regs->data_in, gpio); 128 129 return ret ? 1 : 0; 130 } ··· 140 spin_lock_irqsave(&ctlr->lock, flags); 141 142 if (value) 143 + gpio_reg_set_bit(regs->data_out, gpio); 144 else 145 + gpio_reg_clear_bit(regs->data_out, gpio); 146 147 spin_unlock_irqrestore(&ctlr->lock, flags); 148 }