aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorabdoulaye berthe <berthe.ab@gmail.com>2014-07-12 16:30:12 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-07-22 10:39:26 -0400
commit9f5132ae82fdbb047cc187bf689a81c8cc0de7fa (patch)
tree3d5ce5c1a1ff25fdbec52416ad21eb1ad14ca25f /drivers/gpio
parent38ed0187d2da7f219f9f84d8921b5c95b266b34b (diff)
gpio: remove all usage of gpio_remove retval in driver/gpio
Signed-off-by: abdoulaye berthe <berthe.ab@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-74x164.c8
-rw-r--r--drivers/gpio/gpio-adnp.c9
-rw-r--r--drivers/gpio/gpio-adp5520.c8
-rw-r--r--drivers/gpio/gpio-adp5588.c6
-rw-r--r--drivers/gpio/gpio-amd8111.c3
-rw-r--r--drivers/gpio/gpio-arizona.c3
-rw-r--r--drivers/gpio/gpio-cs5535.c8
-rw-r--r--drivers/gpio/gpio-da9052.c3
-rw-r--r--drivers/gpio/gpio-da9055.c3
-rw-r--r--drivers/gpio/gpio-dwapb.c2
-rw-r--r--drivers/gpio/gpio-em.c5
-rw-r--r--drivers/gpio/gpio-f7188x.c18
-rw-r--r--drivers/gpio/gpio-generic.c3
-rw-r--r--drivers/gpio/gpio-grgpio.c4
-rw-r--r--drivers/gpio/gpio-ich.c9
-rw-r--r--drivers/gpio/gpio-it8761e.c6
-rw-r--r--drivers/gpio/gpio-janz-ttl.c8
-rw-r--r--drivers/gpio/gpio-kempld.c3
-rw-r--r--drivers/gpio/gpio-lp3943.c3
-rw-r--r--drivers/gpio/gpio-lynxpoint.c5
-rw-r--r--drivers/gpio/gpio-max730x.c13
-rw-r--r--drivers/gpio/gpio-max732x.c7
-rw-r--r--drivers/gpio/gpio-mc33880.c11
-rw-r--r--drivers/gpio/gpio-mc9s08dz60.c3
-rw-r--r--drivers/gpio/gpio-mcp23s08.c26
-rw-r--r--drivers/gpio/gpio-ml-ioh.c8
-rw-r--r--drivers/gpio/gpio-msm-v2.c5
-rw-r--r--drivers/gpio/gpio-mxc.c2
-rw-r--r--drivers/gpio/gpio-octeon.c3
-rw-r--r--drivers/gpio/gpio-palmas.c3
-rw-r--r--drivers/gpio/gpio-pca953x.c7
-rw-r--r--drivers/gpio/gpio-pcf857x.c4
-rw-r--r--drivers/gpio/gpio-pch.c10
-rw-r--r--drivers/gpio/gpio-rc5t583.c3
-rw-r--r--drivers/gpio/gpio-rcar.c5
-rw-r--r--drivers/gpio/gpio-rdc321x.c7
-rw-r--r--drivers/gpio/gpio-sch.c16
-rw-r--r--drivers/gpio/gpio-sch311x.c6
-rw-r--r--drivers/gpio/gpio-sodaville.c4
-rw-r--r--drivers/gpio/gpio-stmpe.c8
-rw-r--r--drivers/gpio/gpio-sx150x.c7
-rw-r--r--drivers/gpio/gpio-syscon.c3
-rw-r--r--drivers/gpio/gpio-tb10x.c5
-rw-r--r--drivers/gpio/gpio-tc3589x.c8
-rw-r--r--drivers/gpio/gpio-timberdale.c5
-rw-r--r--drivers/gpio/gpio-tps6586x.c3
-rw-r--r--drivers/gpio/gpio-tps65910.c3
-rw-r--r--drivers/gpio/gpio-tps65912.c3
-rw-r--r--drivers/gpio/gpio-ts5500.c6
-rw-r--r--drivers/gpio/gpio-twl4030.c4
-rw-r--r--drivers/gpio/gpio-twl6040.c3
-rw-r--r--drivers/gpio/gpio-ucb1400.c2
-rw-r--r--drivers/gpio/gpio-viperboard.c10
-rw-r--r--drivers/gpio/gpio-vx855.c3
-rw-r--r--drivers/gpio/gpio-wm831x.c3
-rw-r--r--drivers/gpio/gpio-wm8350.c3
-rw-r--r--drivers/gpio/gpio-wm8994.c3
57 files changed, 100 insertions, 242 deletions
diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c
index e4ae29824c32..e3d968f751f1 100644
--- a/drivers/gpio/gpio-74x164.c
+++ b/drivers/gpio/gpio-74x164.c
@@ -167,13 +167,11 @@ exit_destroy:
167static int gen_74x164_remove(struct spi_device *spi) 167static int gen_74x164_remove(struct spi_device *spi)
168{ 168{
169 struct gen_74x164_chip *chip = spi_get_drvdata(spi); 169 struct gen_74x164_chip *chip = spi_get_drvdata(spi);
170 int ret;
171 170
172 ret = gpiochip_remove(&chip->gpio_chip); 171 gpiochip_remove(&chip->gpio_chip);
173 if (!ret) 172 mutex_destroy(&chip->lock);
174 mutex_destroy(&chip->lock);
175 173
176 return ret; 174 return 0;
177} 175}
178 176
179static const struct of_device_id gen_74x164_dt_ids[] = { 177static const struct of_device_id gen_74x164_dt_ids[] = {
diff --git a/drivers/gpio/gpio-adnp.c b/drivers/gpio/gpio-adnp.c
index b2239d678d01..416b2200d4f1 100644
--- a/drivers/gpio/gpio-adnp.c
+++ b/drivers/gpio/gpio-adnp.c
@@ -585,15 +585,8 @@ static int adnp_i2c_remove(struct i2c_client *client)
585{ 585{
586 struct adnp *adnp = i2c_get_clientdata(client); 586 struct adnp *adnp = i2c_get_clientdata(client);
587 struct device_node *np = client->dev.of_node; 587 struct device_node *np = client->dev.of_node;
588 int err;
589
590 err = gpiochip_remove(&adnp->gpio);
591 if (err < 0) {
592 dev_err(&client->dev, "%s failed: %d\n", "gpiochip_remove()",
593 err);
594 return err;
595 }
596 588
589 gpiochip_remove(&adnp->gpio);
597 if (of_find_property(np, "interrupt-controller", NULL)) 590 if (of_find_property(np, "interrupt-controller", NULL))
598 adnp_irq_teardown(adnp); 591 adnp_irq_teardown(adnp);
599 592
diff --git a/drivers/gpio/gpio-adp5520.c b/drivers/gpio/gpio-adp5520.c
index f1ade8fa3218..b08bd169e568 100644
--- a/drivers/gpio/gpio-adp5520.c
+++ b/drivers/gpio/gpio-adp5520.c
@@ -167,15 +167,9 @@ err:
167static int adp5520_gpio_remove(struct platform_device *pdev) 167static int adp5520_gpio_remove(struct platform_device *pdev)
168{ 168{
169 struct adp5520_gpio *dev; 169 struct adp5520_gpio *dev;
170 int ret;
171 170
172 dev = platform_get_drvdata(pdev); 171 dev = platform_get_drvdata(pdev);
173 ret = gpiochip_remove(&dev->gpio_chip); 172 gpiochip_remove(&dev->gpio_chip);
174 if (ret) {
175 dev_err(&pdev->dev, "%s failed, %d\n",
176 "gpiochip_remove()", ret);
177 return ret;
178 }
179 173
180 return 0; 174 return 0;
181} 175}
diff --git a/drivers/gpio/gpio-adp5588.c b/drivers/gpio/gpio-adp5588.c
index ef19bc33f2bd..3beed6ea8c65 100644
--- a/drivers/gpio/gpio-adp5588.c
+++ b/drivers/gpio/gpio-adp5588.c
@@ -470,11 +470,7 @@ static int adp5588_gpio_remove(struct i2c_client *client)
470 if (dev->irq_base) 470 if (dev->irq_base)
471 free_irq(dev->client->irq, dev); 471 free_irq(dev->client->irq, dev);
472 472
473 ret = gpiochip_remove(&dev->gpio_chip); 473 gpiochip_remove(&dev->gpio_chip);
474 if (ret) {
475 dev_err(&client->dev, "gpiochip_remove failed %d\n", ret);
476 return ret;
477 }
478 474
479 kfree(dev); 475 kfree(dev);
480 return 0; 476 return 0;
diff --git a/drivers/gpio/gpio-amd8111.c b/drivers/gpio/gpio-amd8111.c
index 94e9992f8904..3c09f1a6872a 100644
--- a/drivers/gpio/gpio-amd8111.c
+++ b/drivers/gpio/gpio-amd8111.c
@@ -232,8 +232,7 @@ out:
232 232
233static void __exit amd_gpio_exit(void) 233static void __exit amd_gpio_exit(void)
234{ 234{
235 int err = gpiochip_remove(&gp.chip); 235 gpiochip_remove(&gp.chip);
236 WARN_ON(err);
237 ioport_unmap(gp.pm); 236 ioport_unmap(gp.pm);
238 release_region(gp.pmbase + PMBASE_OFFSET, PMBASE_SIZE); 237 release_region(gp.pmbase + PMBASE_OFFSET, PMBASE_SIZE);
239} 238}
diff --git a/drivers/gpio/gpio-arizona.c b/drivers/gpio/gpio-arizona.c
index 29bdff558981..fe369f5c7fa6 100644
--- a/drivers/gpio/gpio-arizona.c
+++ b/drivers/gpio/gpio-arizona.c
@@ -149,7 +149,8 @@ static int arizona_gpio_remove(struct platform_device *pdev)
149{ 149{
150 struct arizona_gpio *arizona_gpio = platform_get_drvdata(pdev); 150 struct arizona_gpio *arizona_gpio = platform_get_drvdata(pdev);
151 151
152 return gpiochip_remove(&arizona_gpio->gpio_chip); 152 gpiochip_remove(&arizona_gpio->gpio_chip);
153 return 0;
153} 154}
154 155
155static struct platform_driver arizona_gpio_driver = { 156static struct platform_driver arizona_gpio_driver = {
diff --git a/drivers/gpio/gpio-cs5535.c b/drivers/gpio/gpio-cs5535.c
index c0a3aeba6f21..92ec58fa9236 100644
--- a/drivers/gpio/gpio-cs5535.c
+++ b/drivers/gpio/gpio-cs5535.c
@@ -358,14 +358,8 @@ done:
358static int cs5535_gpio_remove(struct platform_device *pdev) 358static int cs5535_gpio_remove(struct platform_device *pdev)
359{ 359{
360 struct resource *r; 360 struct resource *r;
361 int err;
362 361
363 err = gpiochip_remove(&cs5535_gpio_chip.chip); 362 gpiochip_remove(&cs5535_gpio_chip.chip);
364 if (err) {
365 /* uhh? */
366 dev_err(&pdev->dev, "unable to remove gpio_chip?\n");
367 return err;
368 }
369 363
370 r = platform_get_resource(pdev, IORESOURCE_IO, 0); 364 r = platform_get_resource(pdev, IORESOURCE_IO, 0);
371 release_region(r->start, resource_size(r)); 365 release_region(r->start, resource_size(r));
diff --git a/drivers/gpio/gpio-da9052.c b/drivers/gpio/gpio-da9052.c
index 416cdf786b05..c5bccd4dec96 100644
--- a/drivers/gpio/gpio-da9052.c
+++ b/drivers/gpio/gpio-da9052.c
@@ -237,7 +237,8 @@ static int da9052_gpio_remove(struct platform_device *pdev)
237{ 237{
238 struct da9052_gpio *gpio = platform_get_drvdata(pdev); 238 struct da9052_gpio *gpio = platform_get_drvdata(pdev);
239 239
240 return gpiochip_remove(&gpio->gp); 240 gpiochip_remove(&gpio->gp);
241 return 0;
241} 242}
242 243
243static struct platform_driver da9052_gpio_driver = { 244static struct platform_driver da9052_gpio_driver = {
diff --git a/drivers/gpio/gpio-da9055.c b/drivers/gpio/gpio-da9055.c
index f992997bc301..9167c4331081 100644
--- a/drivers/gpio/gpio-da9055.c
+++ b/drivers/gpio/gpio-da9055.c
@@ -174,7 +174,8 @@ static int da9055_gpio_remove(struct platform_device *pdev)
174{ 174{
175 struct da9055_gpio *gpio = platform_get_drvdata(pdev); 175 struct da9055_gpio *gpio = platform_get_drvdata(pdev);
176 176
177 return gpiochip_remove(&gpio->gp); 177 gpiochip_remove(&gpio->gp);
178 return 0;
178} 179}
179 180
180static struct platform_driver da9055_gpio_driver = { 181static struct platform_driver da9055_gpio_driver = {
diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index cd3b81435274..d6618a6e2399 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -359,7 +359,7 @@ static void dwapb_gpio_unregister(struct dwapb_gpio *gpio)
359 359
360 for (m = 0; m < gpio->nr_ports; ++m) 360 for (m = 0; m < gpio->nr_ports; ++m)
361 if (gpio->ports[m].is_registered) 361 if (gpio->ports[m].is_registered)
362 WARN_ON(gpiochip_remove(&gpio->ports[m].bgc.gc)); 362 gpiochip_remove(&gpio->ports[m].bgc.gc);
363} 363}
364 364
365static int dwapb_gpio_probe(struct platform_device *pdev) 365static int dwapb_gpio_probe(struct platform_device *pdev)
diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
index cde36054c387..fe49ec3cdb7d 100644
--- a/drivers/gpio/gpio-em.c
+++ b/drivers/gpio/gpio-em.c
@@ -409,11 +409,8 @@ err0:
409static int em_gio_remove(struct platform_device *pdev) 409static int em_gio_remove(struct platform_device *pdev)
410{ 410{
411 struct em_gio_priv *p = platform_get_drvdata(pdev); 411 struct em_gio_priv *p = platform_get_drvdata(pdev);
412 int ret;
413 412
414 ret = gpiochip_remove(&p->gpio_chip); 413 gpiochip_remove(&p->gpio_chip);
415 if (ret)
416 return ret;
417 414
418 irq_domain_remove(p->irq_domain); 415 irq_domain_remove(p->irq_domain);
419 return 0; 416 return 0;
diff --git a/drivers/gpio/gpio-f7188x.c b/drivers/gpio/gpio-f7188x.c
index 8f73ee093739..fd3202f968ff 100644
--- a/drivers/gpio/gpio-f7188x.c
+++ b/drivers/gpio/gpio-f7188x.c
@@ -317,13 +317,7 @@ static int f7188x_gpio_probe(struct platform_device *pdev)
317err_gpiochip: 317err_gpiochip:
318 for (i = i - 1; i >= 0; i--) { 318 for (i = i - 1; i >= 0; i--) {
319 struct f7188x_gpio_bank *bank = &data->bank[i]; 319 struct f7188x_gpio_bank *bank = &data->bank[i];
320 int tmp; 320 gpiochip_remove(&bank->chip);
321
322 tmp = gpiochip_remove(&bank->chip);
323 if (tmp < 0)
324 dev_err(&pdev->dev,
325 "Failed to remove gpiochip %d: %d\n",
326 i, tmp);
327 } 321 }
328 322
329 return err; 323 return err;
@@ -331,20 +325,12 @@ err_gpiochip:
331 325
332static int f7188x_gpio_remove(struct platform_device *pdev) 326static int f7188x_gpio_remove(struct platform_device *pdev)
333{ 327{
334 int err;
335 int i; 328 int i;
336 struct f7188x_gpio_data *data = platform_get_drvdata(pdev); 329 struct f7188x_gpio_data *data = platform_get_drvdata(pdev);
337 330
338 for (i = 0; i < data->nr_bank; i++) { 331 for (i = 0; i < data->nr_bank; i++) {
339 struct f7188x_gpio_bank *bank = &data->bank[i]; 332 struct f7188x_gpio_bank *bank = &data->bank[i];
340 333 gpiochip_remove(&bank->chip);
341 err = gpiochip_remove(&bank->chip);
342 if (err) {
343 dev_err(&pdev->dev,
344 "Failed to remove GPIO gpiochip %d: %d\n",
345 i, err);
346 return err;
347 }
348 } 334 }
349 335
350 return 0; 336 return 0;
diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
index fea8c82bb8fc..16f6115e5bdb 100644
--- a/drivers/gpio/gpio-generic.c
+++ b/drivers/gpio/gpio-generic.c
@@ -398,7 +398,8 @@ static int bgpio_request(struct gpio_chip *chip, unsigned gpio_pin)
398 398
399int bgpio_remove(struct bgpio_chip *bgc) 399int bgpio_remove(struct bgpio_chip *bgc)
400{ 400{
401 return gpiochip_remove(&bgc->gc); 401 gpiochip_remove(&bgc->gc);
402 return 0;
402} 403}
403EXPORT_SYMBOL_GPL(bgpio_remove); 404EXPORT_SYMBOL_GPL(bgpio_remove);
404 405
diff --git a/drivers/gpio/gpio-grgpio.c b/drivers/gpio/gpio-grgpio.c
index 3c3f515b7916..66ad3df9d9cf 100644
--- a/drivers/gpio/gpio-grgpio.c
+++ b/drivers/gpio/gpio-grgpio.c
@@ -468,9 +468,7 @@ static int grgpio_remove(struct platform_device *ofdev)
468 } 468 }
469 } 469 }
470 470
471 ret = gpiochip_remove(&priv->bgc.gc); 471 gpiochip_remove(&priv->bgc.gc);
472 if (ret)
473 goto out;
474 472
475 if (priv->domain) 473 if (priv->domain)
476 irq_domain_remove(priv->domain); 474 irq_domain_remove(priv->domain);
diff --git a/drivers/gpio/gpio-ich.c b/drivers/gpio/gpio-ich.c
index 70304220a479..3784e81e7762 100644
--- a/drivers/gpio/gpio-ich.c
+++ b/drivers/gpio/gpio-ich.c
@@ -514,14 +514,7 @@ add_err:
514 514
515static int ichx_gpio_remove(struct platform_device *pdev) 515static int ichx_gpio_remove(struct platform_device *pdev)
516{ 516{
517 int err; 517 gpiochip_remove(&ichx_priv.chip);
518
519 err = gpiochip_remove(&ichx_priv.chip);
520 if (err) {
521 dev_err(&pdev->dev, "%s failed, %d\n",
522 "gpiochip_remove()", err);
523 return err;
524 }
525 518
526 ichx_gpio_release_regions(ichx_priv.gpio_base, ichx_priv.use_gpio); 519 ichx_gpio_release_regions(ichx_priv.gpio_base, ichx_priv.use_gpio);
527 if (ichx_priv.pm_base) 520 if (ichx_priv.pm_base)
diff --git a/drivers/gpio/gpio-it8761e.c b/drivers/gpio/gpio-it8761e.c
index 278b81317010..dadfc245cf09 100644
--- a/drivers/gpio/gpio-it8761e.c
+++ b/drivers/gpio/gpio-it8761e.c
@@ -217,11 +217,7 @@ gpiochip_add_err:
217static void __exit it8761e_gpio_exit(void) 217static void __exit it8761e_gpio_exit(void)
218{ 218{
219 if (gpio_ba) { 219 if (gpio_ba) {
220 int ret = gpiochip_remove(&it8761e_gpio_chip); 220 gpiochip_remove(&it8761e_gpio_chip);
221
222 WARN(ret, "%s(): gpiochip_remove() failed, ret=%d\n",
223 __func__, ret);
224
225 release_region(gpio_ba, GPIO_IOSIZE); 221 release_region(gpio_ba, GPIO_IOSIZE);
226 gpio_ba = 0; 222 gpio_ba = 0;
227 } 223 }
diff --git a/drivers/gpio/gpio-janz-ttl.c b/drivers/gpio/gpio-janz-ttl.c
index 42852eaaf020..29ffe22ad97a 100644
--- a/drivers/gpio/gpio-janz-ttl.c
+++ b/drivers/gpio/gpio-janz-ttl.c
@@ -194,14 +194,8 @@ static int ttl_probe(struct platform_device *pdev)
194static int ttl_remove(struct platform_device *pdev) 194static int ttl_remove(struct platform_device *pdev)
195{ 195{
196 struct ttl_module *mod = platform_get_drvdata(pdev); 196 struct ttl_module *mod = platform_get_drvdata(pdev);
197 struct device *dev = &pdev->dev;
198 int ret;
199 197
200 ret = gpiochip_remove(&mod->gpio); 198 gpiochip_remove(&mod->gpio);
201 if (ret) {
202 dev_err(dev, "unable to remove GPIO chip\n");
203 return ret;
204 }
205 199
206 return 0; 200 return 0;
207} 201}
diff --git a/drivers/gpio/gpio-kempld.c b/drivers/gpio/gpio-kempld.c
index 1e5e51987d31..fd150adeebf9 100644
--- a/drivers/gpio/gpio-kempld.c
+++ b/drivers/gpio/gpio-kempld.c
@@ -199,7 +199,8 @@ static int kempld_gpio_remove(struct platform_device *pdev)
199{ 199{
200 struct kempld_gpio_data *gpio = platform_get_drvdata(pdev); 200 struct kempld_gpio_data *gpio = platform_get_drvdata(pdev);
201 201
202 return gpiochip_remove(&gpio->chip); 202 gpiochip_remove(&gpio->chip);
203 return 0;
203} 204}
204 205
205static struct platform_driver kempld_gpio_driver = { 206static struct platform_driver kempld_gpio_driver = {
diff --git a/drivers/gpio/gpio-lp3943.c b/drivers/gpio/gpio-lp3943.c
index a0341c92bcb4..6bbdad805b78 100644
--- a/drivers/gpio/gpio-lp3943.c
+++ b/drivers/gpio/gpio-lp3943.c
@@ -216,7 +216,8 @@ static int lp3943_gpio_remove(struct platform_device *pdev)
216{ 216{
217 struct lp3943_gpio *lp3943_gpio = platform_get_drvdata(pdev); 217 struct lp3943_gpio *lp3943_gpio = platform_get_drvdata(pdev);
218 218
219 return gpiochip_remove(&lp3943_gpio->chip); 219 gpiochip_remove(&lp3943_gpio->chip);
220 return 0;
220} 221}
221 222
222static const struct of_device_id lp3943_gpio_of_match[] = { 223static const struct of_device_id lp3943_gpio_of_match[] = {
diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c
index 2bea89b72508..7c141dd850a1 100644
--- a/drivers/gpio/gpio-lynxpoint.c
+++ b/drivers/gpio/gpio-lynxpoint.c
@@ -465,11 +465,8 @@ MODULE_DEVICE_TABLE(acpi, lynxpoint_gpio_acpi_match);
465static int lp_gpio_remove(struct platform_device *pdev) 465static int lp_gpio_remove(struct platform_device *pdev)
466{ 466{
467 struct lp_gpio *lg = platform_get_drvdata(pdev); 467 struct lp_gpio *lg = platform_get_drvdata(pdev);
468 int err;
469 pm_runtime_disable(&pdev->dev); 468 pm_runtime_disable(&pdev->dev);
470 err = gpiochip_remove(&lg->chip); 469 gpiochip_remove(&lg->chip);
471 if (err)
472 dev_warn(&pdev->dev, "failed to remove gpio_chip.\n");
473 return 0; 470 return 0;
474} 471}
475 472
diff --git a/drivers/gpio/gpio-max730x.c b/drivers/gpio/gpio-max730x.c
index 0814584fcdc1..18ab89e20806 100644
--- a/drivers/gpio/gpio-max730x.c
+++ b/drivers/gpio/gpio-max730x.c
@@ -228,21 +228,16 @@ EXPORT_SYMBOL_GPL(__max730x_probe);
228int __max730x_remove(struct device *dev) 228int __max730x_remove(struct device *dev)
229{ 229{
230 struct max7301 *ts = dev_get_drvdata(dev); 230 struct max7301 *ts = dev_get_drvdata(dev);
231 int ret;
232 231
233 if (ts == NULL) 232 if (ts == NULL)
234 return -ENODEV; 233 return -ENODEV;
235 234
236 /* Power down the chip and disable IRQ output */ 235 /* Power down the chip and disable IRQ output */
237 ts->write(dev, 0x04, 0x00); 236 ts->write(dev, 0x04, 0x00);
238 237 gpiochip_remove(&ts->chip);
239 ret = gpiochip_remove(&ts->chip); 238 mutex_destroy(&ts->lock);
240 if (!ret) 239 kfree(ts);
241 mutex_destroy(&ts->lock); 240 return 0;
242 else
243 dev_err(dev, "Failed to remove GPIO controller: %d\n", ret);
244
245 return ret;
246} 241}
247EXPORT_SYMBOL_GPL(__max730x_remove); 242EXPORT_SYMBOL_GPL(__max730x_remove);
248 243
diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
index 7c36f2b0983d..6c676225b886 100644
--- a/drivers/gpio/gpio-max732x.c
+++ b/drivers/gpio/gpio-max732x.c
@@ -676,12 +676,7 @@ static int max732x_remove(struct i2c_client *client)
676 } 676 }
677 } 677 }
678 678
679 ret = gpiochip_remove(&chip->gpio_chip); 679 gpiochip_remove(&chip->gpio_chip);
680 if (ret) {
681 dev_err(&client->dev, "%s failed, %d\n",
682 "gpiochip_remove()", ret);
683 return ret;
684 }
685 680
686 max732x_irq_teardown(chip); 681 max732x_irq_teardown(chip);
687 682
diff --git a/drivers/gpio/gpio-mc33880.c b/drivers/gpio/gpio-mc33880.c
index 553a80a5eaf3..4e3e160e5db2 100644
--- a/drivers/gpio/gpio-mc33880.c
+++ b/drivers/gpio/gpio-mc33880.c
@@ -149,20 +149,15 @@ exit_destroy:
149static int mc33880_remove(struct spi_device *spi) 149static int mc33880_remove(struct spi_device *spi)
150{ 150{
151 struct mc33880 *mc; 151 struct mc33880 *mc;
152 int ret;
153 152
154 mc = spi_get_drvdata(spi); 153 mc = spi_get_drvdata(spi);
155 if (mc == NULL) 154 if (mc == NULL)
156 return -ENODEV; 155 return -ENODEV;
157 156
158 ret = gpiochip_remove(&mc->chip); 157 gpiochip_remove(&mc->chip);
159 if (!ret) 158 mutex_destroy(&mc->lock);
160 mutex_destroy(&mc->lock);
161 else
162 dev_err(&spi->dev, "Failed to remove the GPIO controller: %d\n",
163 ret);
164 159
165 return ret; 160 return 0;
166} 161}
167 162
168static struct spi_driver mc33880_driver = { 163static struct spi_driver mc33880_driver = {
diff --git a/drivers/gpio/gpio-mc9s08dz60.c b/drivers/gpio/gpio-mc9s08dz60.c
index dce35ff00db7..d62b4f8182bf 100644
--- a/drivers/gpio/gpio-mc9s08dz60.c
+++ b/drivers/gpio/gpio-mc9s08dz60.c
@@ -118,7 +118,8 @@ static int mc9s08dz60_remove(struct i2c_client *client)
118 118
119 mc9s = i2c_get_clientdata(client); 119 mc9s = i2c_get_clientdata(client);
120 120
121 return gpiochip_remove(&mc9s->chip); 121 gpiochip_remove(&mc9s->chip);
122 return 0;
122} 123}
123 124
124static const struct i2c_device_id mc9s08dz60_id[] = { 125static const struct i2c_device_id mc9s08dz60_id[] = {
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
index fe7c0e211f9a..4fe07864fa03 100644
--- a/drivers/gpio/gpio-mcp23s08.c
+++ b/drivers/gpio/gpio-mcp23s08.c
@@ -812,16 +812,14 @@ fail:
812static int mcp230xx_remove(struct i2c_client *client) 812static int mcp230xx_remove(struct i2c_client *client)
813{ 813{
814 struct mcp23s08 *mcp = i2c_get_clientdata(client); 814 struct mcp23s08 *mcp = i2c_get_clientdata(client);
815 int status;
816 815
817 if (client->irq && mcp->irq_controller) 816 if (client->irq && mcp->irq_controller)
818 mcp23s08_irq_teardown(mcp); 817 mcp23s08_irq_teardown(mcp);
819 818
820 status = gpiochip_remove(&mcp->chip); 819 gpiochip_remove(&mcp->chip);
821 if (status == 0) 820 kfree(mcp);
822 kfree(mcp);
823 821
824 return status; 822 return 0;
825} 823}
826 824
827static const struct i2c_device_id mcp230xx_id[] = { 825static const struct i2c_device_id mcp230xx_id[] = {
@@ -966,13 +964,10 @@ static int mcp23s08_probe(struct spi_device *spi)
966 964
967fail: 965fail:
968 for (addr = 0; addr < ARRAY_SIZE(data->mcp); addr++) { 966 for (addr = 0; addr < ARRAY_SIZE(data->mcp); addr++) {
969 int tmp;
970 967
971 if (!data->mcp[addr]) 968 if (!data->mcp[addr])
972 continue; 969 continue;
973 tmp = gpiochip_remove(&data->mcp[addr]->chip); 970 gpiochip_remove(&data->mcp[addr]->chip);
974 if (tmp < 0)
975 dev_err(&spi->dev, "%s --> %d\n", "remove", tmp);
976 } 971 }
977 kfree(data); 972 kfree(data);
978 return status; 973 return status;
@@ -982,23 +977,16 @@ static int mcp23s08_remove(struct spi_device *spi)
982{ 977{
983 struct mcp23s08_driver_data *data = spi_get_drvdata(spi); 978 struct mcp23s08_driver_data *data = spi_get_drvdata(spi);
984 unsigned addr; 979 unsigned addr;
985 int status = 0;
986 980
987 for (addr = 0; addr < ARRAY_SIZE(data->mcp); addr++) { 981 for (addr = 0; addr < ARRAY_SIZE(data->mcp); addr++) {
988 int tmp;
989 982
990 if (!data->mcp[addr]) 983 if (!data->mcp[addr])
991 continue; 984 continue;
992 985
993 tmp = gpiochip_remove(&data->mcp[addr]->chip); 986 gpiochip_remove(&data->mcp[addr]->chip);
994 if (tmp < 0) {
995 dev_err(&spi->dev, "%s --> %d\n", "remove", tmp);
996 status = tmp;
997 }
998 } 987 }
999 if (status == 0) 988 kfree(data);
1000 kfree(data); 989 return 0;
1001 return status;
1002} 990}
1003 991
1004static const struct spi_device_id mcp23s08_ids[] = { 992static const struct spi_device_id mcp23s08_ids[] = {
diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c
index d51329d23d38..5536108aa9db 100644
--- a/drivers/gpio/gpio-ml-ioh.c
+++ b/drivers/gpio/gpio-ml-ioh.c
@@ -497,8 +497,7 @@ err_irq_alloc_descs:
497err_gpiochip_add: 497err_gpiochip_add:
498 while (--i >= 0) { 498 while (--i >= 0) {
499 chip--; 499 chip--;
500 if (gpiochip_remove(&chip->gpio)) 500 gpiochip_remove(&chip->gpio);
501 dev_err(&pdev->dev, "Failed gpiochip_remove(%d)\n", i);
502 } 501 }
503 kfree(chip_save); 502 kfree(chip_save);
504 503
@@ -519,7 +518,6 @@ err_pci_enable:
519 518
520static void ioh_gpio_remove(struct pci_dev *pdev) 519static void ioh_gpio_remove(struct pci_dev *pdev)
521{ 520{
522 int err;
523 int i; 521 int i;
524 struct ioh_gpio *chip = pci_get_drvdata(pdev); 522 struct ioh_gpio *chip = pci_get_drvdata(pdev);
525 void *chip_save; 523 void *chip_save;
@@ -530,9 +528,7 @@ static void ioh_gpio_remove(struct pci_dev *pdev)
530 528
531 for (i = 0; i < 8; i++, chip++) { 529 for (i = 0; i < 8; i++, chip++) {
532 irq_free_descs(chip->irq_base, num_ports[i]); 530 irq_free_descs(chip->irq_base, num_ports[i]);
533 err = gpiochip_remove(&chip->gpio); 531 gpiochip_remove(&chip->gpio);
534 if (err)
535 dev_err(&pdev->dev, "Failed gpiochip_remove\n");
536 } 532 }
537 533
538 chip = chip_save; 534 chip = chip_save;
diff --git a/drivers/gpio/gpio-msm-v2.c b/drivers/gpio/gpio-msm-v2.c
index a3351acd4963..94f57670df9a 100644
--- a/drivers/gpio/gpio-msm-v2.c
+++ b/drivers/gpio/gpio-msm-v2.c
@@ -438,10 +438,7 @@ MODULE_DEVICE_TABLE(of, msm_gpio_of_match);
438 438
439static int msm_gpio_remove(struct platform_device *dev) 439static int msm_gpio_remove(struct platform_device *dev)
440{ 440{
441 int ret = gpiochip_remove(&msm_gpio.gpio_chip); 441 gpiochip_remove(&msm_gpio.gpio_chip);
442
443 if (ret < 0)
444 return ret;
445 442
446 irq_set_handler(msm_gpio.summary_irq, NULL); 443 irq_set_handler(msm_gpio.summary_irq, NULL);
447 444
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index db83b3c0a449..f4e54a92e04a 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -485,7 +485,7 @@ static int mxc_gpio_probe(struct platform_device *pdev)
485out_irqdesc_free: 485out_irqdesc_free:
486 irq_free_descs(irq_base, 32); 486 irq_free_descs(irq_base, 32);
487out_gpiochip_remove: 487out_gpiochip_remove:
488 WARN_ON(gpiochip_remove(&port->bgc.gc) < 0); 488 gpiochip_remove(&port->bgc.gc);
489out_bgpio_remove: 489out_bgpio_remove:
490 bgpio_remove(&port->bgc); 490 bgpio_remove(&port->bgc);
491out_bgio: 491out_bgio:
diff --git a/drivers/gpio/gpio-octeon.c b/drivers/gpio/gpio-octeon.c
index dbb08546b9ec..5c5770c99c80 100644
--- a/drivers/gpio/gpio-octeon.c
+++ b/drivers/gpio/gpio-octeon.c
@@ -129,7 +129,8 @@ out:
129static int octeon_gpio_remove(struct platform_device *pdev) 129static int octeon_gpio_remove(struct platform_device *pdev)
130{ 130{
131 struct gpio_chip *chip = pdev->dev.platform_data; 131 struct gpio_chip *chip = pdev->dev.platform_data;
132 return gpiochip_remove(chip); 132 gpiochip_remove(chip);
133 return 0;
133} 134}
134 135
135static struct of_device_id octeon_gpio_match[] = { 136static struct of_device_id octeon_gpio_match[] = {
diff --git a/drivers/gpio/gpio-palmas.c b/drivers/gpio/gpio-palmas.c
index 86bdbe362068..171a6389f9ce 100644
--- a/drivers/gpio/gpio-palmas.c
+++ b/drivers/gpio/gpio-palmas.c
@@ -210,7 +210,8 @@ static int palmas_gpio_remove(struct platform_device *pdev)
210{ 210{
211 struct palmas_gpio *palmas_gpio = platform_get_drvdata(pdev); 211 struct palmas_gpio *palmas_gpio = platform_get_drvdata(pdev);
212 212
213 return gpiochip_remove(&palmas_gpio->gpio_chip); 213 gpiochip_remove(&palmas_gpio->gpio_chip);
214 return 0;
214} 215}
215 216
216static struct platform_driver palmas_gpio_driver = { 217static struct platform_driver palmas_gpio_driver = {
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index e721a37c3473..f9961eea2120 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -765,12 +765,7 @@ static int pca953x_remove(struct i2c_client *client)
765 } 765 }
766 } 766 }
767 767
768 ret = gpiochip_remove(&chip->gpio_chip); 768 gpiochip_remove(&chip->gpio_chip);
769 if (ret) {
770 dev_err(&client->dev, "%s failed, %d\n",
771 "gpiochip_remove()", ret);
772 return ret;
773 }
774 769
775 return 0; 770 return 0;
776} 771}
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c
index 27b46751ea7e..236708ad0a5b 100644
--- a/drivers/gpio/gpio-pcf857x.c
+++ b/drivers/gpio/gpio-pcf857x.c
@@ -444,9 +444,7 @@ static int pcf857x_remove(struct i2c_client *client)
444 if (client->irq) 444 if (client->irq)
445 pcf857x_irq_domain_cleanup(gpio); 445 pcf857x_irq_domain_cleanup(gpio);
446 446
447 status = gpiochip_remove(&gpio->chip); 447 gpiochip_remove(&gpio->chip);
448 if (status)
449 dev_err(&client->dev, "%s --> %d\n", "remove", status);
450 return status; 448 return status;
451} 449}
452 450
diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c
index d6eac9b17db9..e0ac549dccb5 100644
--- a/drivers/gpio/gpio-pch.c
+++ b/drivers/gpio/gpio-pch.c
@@ -426,9 +426,7 @@ end:
426 426
427err_request_irq: 427err_request_irq:
428 irq_free_descs(irq_base, gpio_pins[chip->ioh]); 428 irq_free_descs(irq_base, gpio_pins[chip->ioh]);
429 429 gpiochip_remove(&chip->gpio);
430 if (gpiochip_remove(&chip->gpio))
431 dev_err(&pdev->dev, "%s gpiochip_remove failed\n", __func__);
432 430
433err_gpiochip_add: 431err_gpiochip_add:
434 pci_iounmap(pdev, chip->base); 432 pci_iounmap(pdev, chip->base);
@@ -447,7 +445,6 @@ err_pci_enable:
447 445
448static void pch_gpio_remove(struct pci_dev *pdev) 446static void pch_gpio_remove(struct pci_dev *pdev)
449{ 447{
450 int err;
451 struct pch_gpio *chip = pci_get_drvdata(pdev); 448 struct pch_gpio *chip = pci_get_drvdata(pdev);
452 449
453 if (chip->irq_base != -1) { 450 if (chip->irq_base != -1) {
@@ -456,10 +453,7 @@ static void pch_gpio_remove(struct pci_dev *pdev)
456 irq_free_descs(chip->irq_base, gpio_pins[chip->ioh]); 453 irq_free_descs(chip->irq_base, gpio_pins[chip->ioh]);
457 } 454 }
458 455
459 err = gpiochip_remove(&chip->gpio); 456 gpiochip_remove(&chip->gpio);
460 if (err)
461 dev_err(&pdev->dev, "Failed gpiochip_remove\n");
462
463 pci_iounmap(pdev, chip->base); 457 pci_iounmap(pdev, chip->base);
464 pci_release_regions(pdev); 458 pci_release_regions(pdev);
465 pci_disable_device(pdev); 459 pci_disable_device(pdev);
diff --git a/drivers/gpio/gpio-rc5t583.c b/drivers/gpio/gpio-rc5t583.c
index 562b0c4d9cc8..769233d2da6d 100644
--- a/drivers/gpio/gpio-rc5t583.c
+++ b/drivers/gpio/gpio-rc5t583.c
@@ -148,7 +148,8 @@ static int rc5t583_gpio_remove(struct platform_device *pdev)
148{ 148{
149 struct rc5t583_gpio *rc5t583_gpio = platform_get_drvdata(pdev); 149 struct rc5t583_gpio *rc5t583_gpio = platform_get_drvdata(pdev);
150 150
151 return gpiochip_remove(&rc5t583_gpio->gpio_chip); 151 gpiochip_remove(&rc5t583_gpio->gpio_chip);
152 return 0;
152} 153}
153 154
154static struct platform_driver rc5t583_gpio_driver = { 155static struct platform_driver rc5t583_gpio_driver = {
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 7c621211e17b..c96e2afdad78 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -471,11 +471,8 @@ err0:
471static int gpio_rcar_remove(struct platform_device *pdev) 471static int gpio_rcar_remove(struct platform_device *pdev)
472{ 472{
473 struct gpio_rcar_priv *p = platform_get_drvdata(pdev); 473 struct gpio_rcar_priv *p = platform_get_drvdata(pdev);
474 int ret;
475 474
476 ret = gpiochip_remove(&p->gpio_chip); 475 gpiochip_remove(&p->gpio_chip);
477 if (ret)
478 return ret;
479 476
480 irq_domain_remove(p->irq_domain); 477 irq_domain_remove(p->irq_domain);
481 pm_runtime_put(&pdev->dev); 478 pm_runtime_put(&pdev->dev);
diff --git a/drivers/gpio/gpio-rdc321x.c b/drivers/gpio/gpio-rdc321x.c
index 9fa7e53331c9..d729bc8a554d 100644
--- a/drivers/gpio/gpio-rdc321x.c
+++ b/drivers/gpio/gpio-rdc321x.c
@@ -199,14 +199,11 @@ static int rdc321x_gpio_probe(struct platform_device *pdev)
199 199
200static int rdc321x_gpio_remove(struct platform_device *pdev) 200static int rdc321x_gpio_remove(struct platform_device *pdev)
201{ 201{
202 int ret;
203 struct rdc321x_gpio *rdc321x_gpio_dev = platform_get_drvdata(pdev); 202 struct rdc321x_gpio *rdc321x_gpio_dev = platform_get_drvdata(pdev);
204 203
205 ret = gpiochip_remove(&rdc321x_gpio_dev->chip); 204 gpiochip_remove(&rdc321x_gpio_dev->chip);
206 if (ret)
207 dev_err(&pdev->dev, "failed to unregister chip\n");
208 205
209 return ret; 206 return 0;
210} 207}
211 208
212static struct platform_driver rdc321x_gpio_driver = { 209static struct platform_driver rdc321x_gpio_driver = {
diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c
index a9b1cd16c848..41e91d70301e 100644
--- a/drivers/gpio/gpio-sch.c
+++ b/drivers/gpio/gpio-sch.c
@@ -290,8 +290,7 @@ static int sch_gpio_probe(struct platform_device *pdev)
290 return 0; 290 return 0;
291 291
292err_sch_gpio_resume: 292err_sch_gpio_resume:
293 if (gpiochip_remove(&sch_gpio_core)) 293 gpiochip_remove(&sch_gpio_core);
294 dev_err(&pdev->dev, "%s gpiochip_remove failed\n", __func__);
295 294
296err_sch_gpio_core: 295err_sch_gpio_core:
297 release_region(res->start, resource_size(res)); 296 release_region(res->start, resource_size(res));
@@ -304,23 +303,14 @@ static int sch_gpio_remove(struct platform_device *pdev)
304{ 303{
305 struct resource *res; 304 struct resource *res;
306 if (gpio_ba) { 305 if (gpio_ba) {
307 int err;
308 306
309 err = gpiochip_remove(&sch_gpio_core); 307 gpiochip_remove(&sch_gpio_core);
310 if (err) 308 gpiochip_remove(&sch_gpio_resume);
311 dev_err(&pdev->dev, "%s failed, %d\n",
312 "gpiochip_remove()", err);
313 err = gpiochip_remove(&sch_gpio_resume);
314 if (err)
315 dev_err(&pdev->dev, "%s failed, %d\n",
316 "gpiochip_remove()", err);
317 309
318 res = platform_get_resource(pdev, IORESOURCE_IO, 0); 310 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
319 311
320 release_region(res->start, resource_size(res)); 312 release_region(res->start, resource_size(res));
321 gpio_ba = 0; 313 gpio_ba = 0;
322
323 return err;
324 } 314 }
325 315
326 return 0; 316 return 0;
diff --git a/drivers/gpio/gpio-sch311x.c b/drivers/gpio/gpio-sch311x.c
index f942b80ee403..0cb11413e814 100644
--- a/drivers/gpio/gpio-sch311x.c
+++ b/drivers/gpio/gpio-sch311x.c
@@ -291,14 +291,12 @@ static int sch311x_gpio_remove(struct platform_device *pdev)
291{ 291{
292 struct sch311x_pdev_data *pdata = pdev->dev.platform_data; 292 struct sch311x_pdev_data *pdata = pdev->dev.platform_data;
293 struct sch311x_gpio_priv *priv = platform_get_drvdata(pdev); 293 struct sch311x_gpio_priv *priv = platform_get_drvdata(pdev);
294 int err, i; 294 int i;
295 295
296 release_region(pdata->runtime_reg + GP1, 6); 296 release_region(pdata->runtime_reg + GP1, 6);
297 297
298 for (i = 0; i < ARRAY_SIZE(priv->blocks); i++) { 298 for (i = 0; i < ARRAY_SIZE(priv->blocks); i++) {
299 err = gpiochip_remove(&priv->blocks[i].chip); 299 gpiochip_remove(&priv->blocks[i].chip);
300 if (err)
301 return err;
302 dev_info(&pdev->dev, 300 dev_info(&pdev->dev,
303 "SMSC SCH311x GPIO block %d unregistered.\n", i); 301 "SMSC SCH311x GPIO block %d unregistered.\n", i);
304 } 302 }
diff --git a/drivers/gpio/gpio-sodaville.c b/drivers/gpio/gpio-sodaville.c
index 7c6c518929bc..d8da36cd8123 100644
--- a/drivers/gpio/gpio-sodaville.c
+++ b/drivers/gpio/gpio-sodaville.c
@@ -265,9 +265,7 @@ static void sdv_gpio_remove(struct pci_dev *pdev)
265 free_irq(pdev->irq, sd); 265 free_irq(pdev->irq, sd);
266 irq_free_descs(sd->irq_base, SDV_NUM_PUB_GPIOS); 266 irq_free_descs(sd->irq_base, SDV_NUM_PUB_GPIOS);
267 267
268 if (gpiochip_remove(&sd->bgpio.gc)) 268 gpiochip_remove(&sd->bgpio.gc);
269 dev_err(&pdev->dev, "gpiochip_remove() failed.\n");
270
271 pci_release_region(pdev, GPIO_BAR); 269 pci_release_region(pdev, GPIO_BAR);
272 iounmap(sd->gpio_pub_base); 270 iounmap(sd->gpio_pub_base);
273 pci_disable_device(pdev); 271 pci_disable_device(pdev);
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
index ed90adbdb128..845025a57240 100644
--- a/drivers/gpio/gpio-stmpe.c
+++ b/drivers/gpio/gpio-stmpe.c
@@ -353,17 +353,11 @@ static int stmpe_gpio_remove(struct platform_device *pdev)
353 struct stmpe_gpio *stmpe_gpio = platform_get_drvdata(pdev); 353 struct stmpe_gpio *stmpe_gpio = platform_get_drvdata(pdev);
354 struct stmpe *stmpe = stmpe_gpio->stmpe; 354 struct stmpe *stmpe = stmpe_gpio->stmpe;
355 struct stmpe_gpio_platform_data *pdata = stmpe->pdata->gpio; 355 struct stmpe_gpio_platform_data *pdata = stmpe->pdata->gpio;
356 int ret;
357 356
358 if (pdata && pdata->remove) 357 if (pdata && pdata->remove)
359 pdata->remove(stmpe, stmpe_gpio->chip.base); 358 pdata->remove(stmpe, stmpe_gpio->chip.base);
360 359
361 ret = gpiochip_remove(&stmpe_gpio->chip); 360 gpiochip_remove(&stmpe_gpio->chip);
362 if (ret < 0) {
363 dev_err(stmpe_gpio->dev,
364 "unable to remove gpiochip: %d\n", ret);
365 return ret;
366 }
367 361
368 stmpe_disable(stmpe, STMPE_BLOCK_GPIO); 362 stmpe_disable(stmpe, STMPE_BLOCK_GPIO);
369 363
diff --git a/drivers/gpio/gpio-sx150x.c b/drivers/gpio/gpio-sx150x.c
index b51ca9f5c140..bce6c6108f20 100644
--- a/drivers/gpio/gpio-sx150x.c
+++ b/drivers/gpio/gpio-sx150x.c
@@ -615,19 +615,16 @@ static int sx150x_probe(struct i2c_client *client,
615 615
616 return 0; 616 return 0;
617probe_fail_post_gpiochip_add: 617probe_fail_post_gpiochip_add:
618 WARN_ON(gpiochip_remove(&chip->gpio_chip) < 0); 618 gpiochip_remove(&chip->gpio_chip);
619 return rc; 619 return rc;
620} 620}
621 621
622static int sx150x_remove(struct i2c_client *client) 622static int sx150x_remove(struct i2c_client *client)
623{ 623{
624 struct sx150x_chip *chip; 624 struct sx150x_chip *chip;
625 int rc;
626 625
627 chip = i2c_get_clientdata(client); 626 chip = i2c_get_clientdata(client);
628 rc = gpiochip_remove(&chip->gpio_chip); 627 gpiochip_remove(&chip->gpio_chip);
629 if (rc < 0)
630 return rc;
631 628
632 if (chip->irq_summary >= 0) 629 if (chip->irq_summary >= 0)
633 sx150x_remove_irq_chip(chip); 630 sx150x_remove_irq_chip(chip);
diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c
index b50fe1297748..30884fbc750d 100644
--- a/drivers/gpio/gpio-syscon.c
+++ b/drivers/gpio/gpio-syscon.c
@@ -172,7 +172,8 @@ static int syscon_gpio_remove(struct platform_device *pdev)
172{ 172{
173 struct syscon_gpio_priv *priv = platform_get_drvdata(pdev); 173 struct syscon_gpio_priv *priv = platform_get_drvdata(pdev);
174 174
175 return gpiochip_remove(&priv->chip); 175 gpiochip_remove(&priv->chip);
176 return 0;
176} 177}
177 178
178static struct platform_driver syscon_gpio_driver = { 179static struct platform_driver syscon_gpio_driver = {
diff --git a/drivers/gpio/gpio-tb10x.c b/drivers/gpio/gpio-tb10x.c
index 07bce97647a6..9e615be8032c 100644
--- a/drivers/gpio/gpio-tb10x.c
+++ b/drivers/gpio/gpio-tb10x.c
@@ -291,7 +291,6 @@ fail_ioremap:
291static int __exit tb10x_gpio_remove(struct platform_device *pdev) 291static int __exit tb10x_gpio_remove(struct platform_device *pdev)
292{ 292{
293 struct tb10x_gpio *tb10x_gpio = platform_get_drvdata(pdev); 293 struct tb10x_gpio *tb10x_gpio = platform_get_drvdata(pdev);
294 int ret;
295 294
296 if (tb10x_gpio->gc.to_irq) { 295 if (tb10x_gpio->gc.to_irq) {
297 irq_remove_generic_chip(tb10x_gpio->domain->gc->gc[0], 296 irq_remove_generic_chip(tb10x_gpio->domain->gc->gc[0],
@@ -300,9 +299,7 @@ static int __exit tb10x_gpio_remove(struct platform_device *pdev)
300 irq_domain_remove(tb10x_gpio->domain); 299 irq_domain_remove(tb10x_gpio->domain);
301 free_irq(tb10x_gpio->irq, tb10x_gpio); 300 free_irq(tb10x_gpio->irq, tb10x_gpio);
302 } 301 }
303 ret = gpiochip_remove(&tb10x_gpio->gc); 302 gpiochip_remove(&tb10x_gpio->gc);
304 if (ret)
305 return ret;
306 303
307 return 0; 304 return 0;
308} 305}
diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
index 51f7cbd9ff71..7324869c38e0 100644
--- a/drivers/gpio/gpio-tc3589x.c
+++ b/drivers/gpio/gpio-tc3589x.c
@@ -313,17 +313,11 @@ static int tc3589x_gpio_remove(struct platform_device *pdev)
313 struct tc3589x_gpio *tc3589x_gpio = platform_get_drvdata(pdev); 313 struct tc3589x_gpio *tc3589x_gpio = platform_get_drvdata(pdev);
314 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x; 314 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x;
315 struct tc3589x_gpio_platform_data *pdata = tc3589x->pdata->gpio; 315 struct tc3589x_gpio_platform_data *pdata = tc3589x->pdata->gpio;
316 int ret;
317 316
318 if (pdata && pdata->remove) 317 if (pdata && pdata->remove)
319 pdata->remove(tc3589x, tc3589x_gpio->chip.base); 318 pdata->remove(tc3589x, tc3589x_gpio->chip.base);
320 319
321 ret = gpiochip_remove(&tc3589x_gpio->chip); 320 gpiochip_remove(&tc3589x_gpio->chip);
322 if (ret < 0) {
323 dev_err(tc3589x_gpio->dev,
324 "unable to remove gpiochip: %d\n", ret);
325 return ret;
326 }
327 321
328 return 0; 322 return 0;
329} 323}
diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c
index efc7c129016d..a685a3cbbc81 100644
--- a/drivers/gpio/gpio-timberdale.c
+++ b/drivers/gpio/gpio-timberdale.c
@@ -307,7 +307,6 @@ static int timbgpio_probe(struct platform_device *pdev)
307 307
308static int timbgpio_remove(struct platform_device *pdev) 308static int timbgpio_remove(struct platform_device *pdev)
309{ 309{
310 int err;
311 struct timbgpio_platform_data *pdata = dev_get_platdata(&pdev->dev); 310 struct timbgpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
312 struct timbgpio *tgpio = platform_get_drvdata(pdev); 311 struct timbgpio *tgpio = platform_get_drvdata(pdev);
313 int irq = platform_get_irq(pdev, 0); 312 int irq = platform_get_irq(pdev, 0);
@@ -323,9 +322,7 @@ static int timbgpio_remove(struct platform_device *pdev)
323 irq_set_handler_data(irq, NULL); 322 irq_set_handler_data(irq, NULL);
324 } 323 }
325 324
326 err = gpiochip_remove(&tgpio->gpio); 325 gpiochip_remove(&tgpio->gpio);
327 if (err)
328 printk(KERN_ERR DRIVER_NAME": failed to remove gpio_chip\n");
329 326
330 return 0; 327 return 0;
331} 328}
diff --git a/drivers/gpio/gpio-tps6586x.c b/drivers/gpio/gpio-tps6586x.c
index a69fbea41253..9c9238e838a9 100644
--- a/drivers/gpio/gpio-tps6586x.c
+++ b/drivers/gpio/gpio-tps6586x.c
@@ -137,7 +137,8 @@ static int tps6586x_gpio_remove(struct platform_device *pdev)
137{ 137{
138 struct tps6586x_gpio *tps6586x_gpio = platform_get_drvdata(pdev); 138 struct tps6586x_gpio *tps6586x_gpio = platform_get_drvdata(pdev);
139 139
140 return gpiochip_remove(&tps6586x_gpio->gpio_chip); 140 gpiochip_remove(&tps6586x_gpio->gpio_chip);
141 return 0;
141} 142}
142 143
143static struct platform_driver tps6586x_gpio_driver = { 144static struct platform_driver tps6586x_gpio_driver = {
diff --git a/drivers/gpio/gpio-tps65910.c b/drivers/gpio/gpio-tps65910.c
index e2f8cda235ea..88f1f5ff4e96 100644
--- a/drivers/gpio/gpio-tps65910.c
+++ b/drivers/gpio/gpio-tps65910.c
@@ -190,7 +190,8 @@ static int tps65910_gpio_remove(struct platform_device *pdev)
190{ 190{
191 struct tps65910_gpio *tps65910_gpio = platform_get_drvdata(pdev); 191 struct tps65910_gpio *tps65910_gpio = platform_get_drvdata(pdev);
192 192
193 return gpiochip_remove(&tps65910_gpio->gpio_chip); 193 gpiochip_remove(&tps65910_gpio->gpio_chip);
194 return 0;
194} 195}
195 196
196static struct platform_driver tps65910_gpio_driver = { 197static struct platform_driver tps65910_gpio_driver = {
diff --git a/drivers/gpio/gpio-tps65912.c b/drivers/gpio/gpio-tps65912.c
index 59ee486cb8b9..22052d84c63b 100644
--- a/drivers/gpio/gpio-tps65912.c
+++ b/drivers/gpio/gpio-tps65912.c
@@ -117,7 +117,8 @@ static int tps65912_gpio_remove(struct platform_device *pdev)
117{ 117{
118 struct tps65912_gpio_data *tps65912_gpio = platform_get_drvdata(pdev); 118 struct tps65912_gpio_data *tps65912_gpio = platform_get_drvdata(pdev);
119 119
120 return gpiochip_remove(&tps65912_gpio->gpio_chip); 120 gpiochip_remove(&tps65912_gpio->gpio_chip);
121 return 0;
121} 122}
122 123
123static struct platform_driver tps65912_gpio_driver = { 124static struct platform_driver tps65912_gpio_driver = {
diff --git a/drivers/gpio/gpio-ts5500.c b/drivers/gpio/gpio-ts5500.c
index 3df3ebdb3e52..de18591ff11e 100644
--- a/drivers/gpio/gpio-ts5500.c
+++ b/drivers/gpio/gpio-ts5500.c
@@ -427,8 +427,7 @@ static int ts5500_dio_probe(struct platform_device *pdev)
427 427
428 return 0; 428 return 0;
429cleanup: 429cleanup:
430 if (gpiochip_remove(&priv->gpio_chip)) 430 gpiochip_remove(&priv->gpio_chip);
431 dev_err(dev, "failed to remove gpio chip\n");
432 return ret; 431 return ret;
433} 432}
434 433
@@ -437,7 +436,8 @@ static int ts5500_dio_remove(struct platform_device *pdev)
437 struct ts5500_priv *priv = platform_get_drvdata(pdev); 436 struct ts5500_priv *priv = platform_get_drvdata(pdev);
438 437
439 ts5500_disable_irq(priv); 438 ts5500_disable_irq(priv);
440 return gpiochip_remove(&priv->gpio_chip); 439 gpiochip_remove(&priv->gpio_chip);
440 return 0;
441} 441}
442 442
443static struct platform_device_id ts5500_dio_ids[] = { 443static struct platform_device_id ts5500_dio_ids[] = {
diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
index 826da37052d7..118828b3736f 100644
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@ -583,9 +583,7 @@ static int gpio_twl4030_remove(struct platform_device *pdev)
583 } 583 }
584 } 584 }
585 585
586 status = gpiochip_remove(&priv->gpio_chip); 586 gpiochip_remove(&priv->gpio_chip);
587 if (status < 0)
588 return status;
589 587
590 if (is_module()) 588 if (is_module())
591 return 0; 589 return 0;
diff --git a/drivers/gpio/gpio-twl6040.c b/drivers/gpio/gpio-twl6040.c
index 0caf5cd1b47d..f28e04b88aa9 100644
--- a/drivers/gpio/gpio-twl6040.c
+++ b/drivers/gpio/gpio-twl6040.c
@@ -111,7 +111,8 @@ static int gpo_twl6040_probe(struct platform_device *pdev)
111 111
112static int gpo_twl6040_remove(struct platform_device *pdev) 112static int gpo_twl6040_remove(struct platform_device *pdev)
113{ 113{
114 return gpiochip_remove(&twl6040gpo_chip); 114 gpiochip_remove(&twl6040gpo_chip);
115 return 0;
115} 116}
116 117
117/* Note: this hardware lives inside an I2C-based multi-function device. */ 118/* Note: this hardware lives inside an I2C-based multi-function device. */
diff --git a/drivers/gpio/gpio-ucb1400.c b/drivers/gpio/gpio-ucb1400.c
index d520dc9ed709..d502825159b9 100644
--- a/drivers/gpio/gpio-ucb1400.c
+++ b/drivers/gpio/gpio-ucb1400.c
@@ -89,7 +89,7 @@ static int ucb1400_gpio_remove(struct platform_device *dev)
89 return err; 89 return err;
90 } 90 }
91 91
92 err = gpiochip_remove(&ucb->gc); 92 gpiochip_remove(&ucb->gc);
93 return err; 93 return err;
94} 94}
95 95
diff --git a/drivers/gpio/gpio-viperboard.c b/drivers/gpio/gpio-viperboard.c
index 79e3b5836712..e2a11f27807f 100644
--- a/drivers/gpio/gpio-viperboard.c
+++ b/drivers/gpio/gpio-viperboard.c
@@ -446,8 +446,7 @@ static int vprbrd_gpio_probe(struct platform_device *pdev)
446 return ret; 446 return ret;
447 447
448err_gpiob: 448err_gpiob:
449 if (gpiochip_remove(&vb_gpio->gpioa)) 449 gpiochip_remove(&vb_gpio->gpioa);
450 dev_err(&pdev->dev, "%s gpiochip_remove failed\n", __func__);
451 450
452err_gpioa: 451err_gpioa:
453 return ret; 452 return ret;
@@ -456,13 +455,10 @@ err_gpioa:
456static int vprbrd_gpio_remove(struct platform_device *pdev) 455static int vprbrd_gpio_remove(struct platform_device *pdev)
457{ 456{
458 struct vprbrd_gpio *vb_gpio = platform_get_drvdata(pdev); 457 struct vprbrd_gpio *vb_gpio = platform_get_drvdata(pdev);
459 int ret;
460 458
461 ret = gpiochip_remove(&vb_gpio->gpiob); 459 gpiochip_remove(&vb_gpio->gpiob);
462 if (ret == 0)
463 ret = gpiochip_remove(&vb_gpio->gpioa);
464 460
465 return ret; 461 return 0;
466} 462}
467 463
468static struct platform_driver vprbrd_gpio_driver = { 464static struct platform_driver vprbrd_gpio_driver = {
diff --git a/drivers/gpio/gpio-vx855.c b/drivers/gpio/gpio-vx855.c
index 0fd23b6a753d..85971d4e23c1 100644
--- a/drivers/gpio/gpio-vx855.c
+++ b/drivers/gpio/gpio-vx855.c
@@ -288,8 +288,7 @@ static int vx855gpio_remove(struct platform_device *pdev)
288 struct vx855_gpio *vg = platform_get_drvdata(pdev); 288 struct vx855_gpio *vg = platform_get_drvdata(pdev);
289 struct resource *res; 289 struct resource *res;
290 290
291 if (gpiochip_remove(&vg->gpio)) 291 gpiochip_remove(&vg->gpio);
292 dev_err(&pdev->dev, "unable to remove gpio_chip?\n");
293 292
294 if (vg->gpi_reserved) { 293 if (vg->gpi_reserved) {
295 res = platform_get_resource(pdev, IORESOURCE_IO, 0); 294 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
diff --git a/drivers/gpio/gpio-wm831x.c b/drivers/gpio/gpio-wm831x.c
index b18a1a26425e..58ce75c188b7 100644
--- a/drivers/gpio/gpio-wm831x.c
+++ b/drivers/gpio/gpio-wm831x.c
@@ -279,7 +279,8 @@ static int wm831x_gpio_remove(struct platform_device *pdev)
279{ 279{
280 struct wm831x_gpio *wm831x_gpio = platform_get_drvdata(pdev); 280 struct wm831x_gpio *wm831x_gpio = platform_get_drvdata(pdev);
281 281
282 return gpiochip_remove(&wm831x_gpio->gpio_chip); 282 gpiochip_remove(&wm831x_gpio->gpio_chip);
283 return 0;
283} 284}
284 285
285static struct platform_driver wm831x_gpio_driver = { 286static struct platform_driver wm831x_gpio_driver = {
diff --git a/drivers/gpio/gpio-wm8350.c b/drivers/gpio/gpio-wm8350.c
index 2487f9d575d3..060b89303bb6 100644
--- a/drivers/gpio/gpio-wm8350.c
+++ b/drivers/gpio/gpio-wm8350.c
@@ -145,7 +145,8 @@ static int wm8350_gpio_remove(struct platform_device *pdev)
145{ 145{
146 struct wm8350_gpio_data *wm8350_gpio = platform_get_drvdata(pdev); 146 struct wm8350_gpio_data *wm8350_gpio = platform_get_drvdata(pdev);
147 147
148 return gpiochip_remove(&wm8350_gpio->gpio_chip); 148 gpiochip_remove(&wm8350_gpio->gpio_chip);
149 return 0;
149} 150}
150 151
151static struct platform_driver wm8350_gpio_driver = { 152static struct platform_driver wm8350_gpio_driver = {
diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c
index d93b6b581677..6f5e42db4b9e 100644
--- a/drivers/gpio/gpio-wm8994.c
+++ b/drivers/gpio/gpio-wm8994.c
@@ -285,7 +285,8 @@ static int wm8994_gpio_remove(struct platform_device *pdev)
285{ 285{
286 struct wm8994_gpio *wm8994_gpio = platform_get_drvdata(pdev); 286 struct wm8994_gpio *wm8994_gpio = platform_get_drvdata(pdev);
287 287
288 return gpiochip_remove(&wm8994_gpio->gpio_chip); 288 gpiochip_remove(&wm8994_gpio->gpio_chip);
289 return 0;
289} 290}
290 291
291static struct platform_driver wm8994_gpio_driver = { 292static struct platform_driver wm8994_gpio_driver = {