diff options
Diffstat (limited to 'drivers/gpio/gpio-davinci.c')
-rw-r--r-- | drivers/gpio/gpio-davinci.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c index 14d1729927d3..121a7948f785 100644 --- a/drivers/gpio/gpio-davinci.c +++ b/drivers/gpio/gpio-davinci.c | |||
@@ -165,7 +165,7 @@ of_err: | |||
165 | 165 | ||
166 | static int davinci_gpio_probe(struct platform_device *pdev) | 166 | static int davinci_gpio_probe(struct platform_device *pdev) |
167 | { | 167 | { |
168 | int gpio, bank, i, ret = 0; | 168 | int bank, i, ret = 0; |
169 | unsigned int ngpio, nbank, nirq; | 169 | unsigned int ngpio, nbank, nirq; |
170 | struct davinci_gpio_controller *chips; | 170 | struct davinci_gpio_controller *chips; |
171 | struct davinci_gpio_platform_data *pdata; | 171 | struct davinci_gpio_platform_data *pdata; |
@@ -204,10 +204,7 @@ static int davinci_gpio_probe(struct platform_device *pdev) | |||
204 | else | 204 | else |
205 | nirq = DIV_ROUND_UP(ngpio, 16); | 205 | nirq = DIV_ROUND_UP(ngpio, 16); |
206 | 206 | ||
207 | nbank = DIV_ROUND_UP(ngpio, 32); | 207 | chips = devm_kzalloc(dev, sizeof(*chips), GFP_KERNEL); |
208 | chips = devm_kcalloc(dev, | ||
209 | nbank, sizeof(struct davinci_gpio_controller), | ||
210 | GFP_KERNEL); | ||
211 | if (!chips) | 208 | if (!chips) |
212 | return -ENOMEM; | 209 | return -ENOMEM; |
213 | 210 | ||
@@ -247,7 +244,8 @@ static int davinci_gpio_probe(struct platform_device *pdev) | |||
247 | #endif | 244 | #endif |
248 | spin_lock_init(&chips->lock); | 245 | spin_lock_init(&chips->lock); |
249 | 246 | ||
250 | for (gpio = 0, bank = 0; gpio < ngpio; gpio += 32, bank++) | 247 | nbank = DIV_ROUND_UP(ngpio, 32); |
248 | for (bank = 0; bank < nbank; bank++) | ||
251 | chips->regs[bank] = gpio_base + offset_array[bank]; | 249 | chips->regs[bank] = gpio_base + offset_array[bank]; |
252 | 250 | ||
253 | ret = devm_gpiochip_add_data(dev, &chips->chip, chips); | 251 | ret = devm_gpiochip_add_data(dev, &chips->chip, chips); |