Skip to content

Commit

Permalink
gpio: remove all usage of gpio_remove retval in driver/gpio
Browse files Browse the repository at this point in the history
Signed-off-by: abdoulaye berthe <berthe.ab@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
abdoulaye berthe authored and linusw committed Jul 22, 2014
1 parent 38ed018 commit 9f5132a
Show file tree
Hide file tree
Showing 57 changed files with 100 additions and 242 deletions.
8 changes: 3 additions & 5 deletions drivers/gpio/gpio-74x164.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,11 @@ static int gen_74x164_probe(struct spi_device *spi)
static int gen_74x164_remove(struct spi_device *spi)
{
struct gen_74x164_chip *chip = spi_get_drvdata(spi);
int ret;

ret = gpiochip_remove(&chip->gpio_chip);
if (!ret)
mutex_destroy(&chip->lock);
gpiochip_remove(&chip->gpio_chip);
mutex_destroy(&chip->lock);

return ret;
return 0;
}

static const struct of_device_id gen_74x164_dt_ids[] = {
Expand Down
9 changes: 1 addition & 8 deletions drivers/gpio/gpio-adnp.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,15 +585,8 @@ static int adnp_i2c_remove(struct i2c_client *client)
{
struct adnp *adnp = i2c_get_clientdata(client);
struct device_node *np = client->dev.of_node;
int err;

err = gpiochip_remove(&adnp->gpio);
if (err < 0) {
dev_err(&client->dev, "%s failed: %d\n", "gpiochip_remove()",
err);
return err;
}

gpiochip_remove(&adnp->gpio);
if (of_find_property(np, "interrupt-controller", NULL))
adnp_irq_teardown(adnp);

Expand Down
8 changes: 1 addition & 7 deletions drivers/gpio/gpio-adp5520.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,9 @@ static int adp5520_gpio_probe(struct platform_device *pdev)
static int adp5520_gpio_remove(struct platform_device *pdev)
{
struct adp5520_gpio *dev;
int ret;

dev = platform_get_drvdata(pdev);
ret = gpiochip_remove(&dev->gpio_chip);
if (ret) {
dev_err(&pdev->dev, "%s failed, %d\n",
"gpiochip_remove()", ret);
return ret;
}
gpiochip_remove(&dev->gpio_chip);

return 0;
}
Expand Down
6 changes: 1 addition & 5 deletions drivers/gpio/gpio-adp5588.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,7 @@ static int adp5588_gpio_remove(struct i2c_client *client)
if (dev->irq_base)
free_irq(dev->client->irq, dev);

ret = gpiochip_remove(&dev->gpio_chip);
if (ret) {
dev_err(&client->dev, "gpiochip_remove failed %d\n", ret);
return ret;
}
gpiochip_remove(&dev->gpio_chip);

kfree(dev);
return 0;
Expand Down
3 changes: 1 addition & 2 deletions drivers/gpio/gpio-amd8111.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ static int __init amd_gpio_init(void)

static void __exit amd_gpio_exit(void)
{
int err = gpiochip_remove(&gp.chip);
WARN_ON(err);
gpiochip_remove(&gp.chip);
ioport_unmap(gp.pm);
release_region(gp.pmbase + PMBASE_OFFSET, PMBASE_SIZE);
}
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpio/gpio-arizona.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ static int arizona_gpio_remove(struct platform_device *pdev)
{
struct arizona_gpio *arizona_gpio = platform_get_drvdata(pdev);

return gpiochip_remove(&arizona_gpio->gpio_chip);
gpiochip_remove(&arizona_gpio->gpio_chip);
return 0;
}

static struct platform_driver arizona_gpio_driver = {
Expand Down
8 changes: 1 addition & 7 deletions drivers/gpio/gpio-cs5535.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,14 +358,8 @@ static int cs5535_gpio_probe(struct platform_device *pdev)
static int cs5535_gpio_remove(struct platform_device *pdev)
{
struct resource *r;
int err;

err = gpiochip_remove(&cs5535_gpio_chip.chip);
if (err) {
/* uhh? */
dev_err(&pdev->dev, "unable to remove gpio_chip?\n");
return err;
}
gpiochip_remove(&cs5535_gpio_chip.chip);

r = platform_get_resource(pdev, IORESOURCE_IO, 0);
release_region(r->start, resource_size(r));
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpio/gpio-da9052.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ static int da9052_gpio_remove(struct platform_device *pdev)
{
struct da9052_gpio *gpio = platform_get_drvdata(pdev);

return gpiochip_remove(&gpio->gp);
gpiochip_remove(&gpio->gp);
return 0;
}

static struct platform_driver da9052_gpio_driver = {
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpio/gpio-da9055.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ static int da9055_gpio_remove(struct platform_device *pdev)
{
struct da9055_gpio *gpio = platform_get_drvdata(pdev);

return gpiochip_remove(&gpio->gp);
gpiochip_remove(&gpio->gp);
return 0;
}

static struct platform_driver da9055_gpio_driver = {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-dwapb.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ static void dwapb_gpio_unregister(struct dwapb_gpio *gpio)

for (m = 0; m < gpio->nr_ports; ++m)
if (gpio->ports[m].is_registered)
WARN_ON(gpiochip_remove(&gpio->ports[m].bgc.gc));
gpiochip_remove(&gpio->ports[m].bgc.gc);
}

static int dwapb_gpio_probe(struct platform_device *pdev)
Expand Down
5 changes: 1 addition & 4 deletions drivers/gpio/gpio-em.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,8 @@ static int em_gio_probe(struct platform_device *pdev)
static int em_gio_remove(struct platform_device *pdev)
{
struct em_gio_priv *p = platform_get_drvdata(pdev);
int ret;

ret = gpiochip_remove(&p->gpio_chip);
if (ret)
return ret;
gpiochip_remove(&p->gpio_chip);

irq_domain_remove(p->irq_domain);
return 0;
Expand Down
18 changes: 2 additions & 16 deletions drivers/gpio/gpio-f7188x.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,34 +317,20 @@ static int f7188x_gpio_probe(struct platform_device *pdev)
err_gpiochip:
for (i = i - 1; i >= 0; i--) {
struct f7188x_gpio_bank *bank = &data->bank[i];
int tmp;

tmp = gpiochip_remove(&bank->chip);
if (tmp < 0)
dev_err(&pdev->dev,
"Failed to remove gpiochip %d: %d\n",
i, tmp);
gpiochip_remove(&bank->chip);
}

return err;
}

static int f7188x_gpio_remove(struct platform_device *pdev)
{
int err;
int i;
struct f7188x_gpio_data *data = platform_get_drvdata(pdev);

for (i = 0; i < data->nr_bank; i++) {
struct f7188x_gpio_bank *bank = &data->bank[i];

err = gpiochip_remove(&bank->chip);
if (err) {
dev_err(&pdev->dev,
"Failed to remove GPIO gpiochip %d: %d\n",
i, err);
return err;
}
gpiochip_remove(&bank->chip);
}

return 0;
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpio/gpio-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ static int bgpio_request(struct gpio_chip *chip, unsigned gpio_pin)

int bgpio_remove(struct bgpio_chip *bgc)
{
return gpiochip_remove(&bgc->gc);
gpiochip_remove(&bgc->gc);
return 0;
}
EXPORT_SYMBOL_GPL(bgpio_remove);

Expand Down
4 changes: 1 addition & 3 deletions drivers/gpio/gpio-grgpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,7 @@ static int grgpio_remove(struct platform_device *ofdev)
}
}

ret = gpiochip_remove(&priv->bgc.gc);
if (ret)
goto out;
gpiochip_remove(&priv->bgc.gc);

if (priv->domain)
irq_domain_remove(priv->domain);
Expand Down
9 changes: 1 addition & 8 deletions drivers/gpio/gpio-ich.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,14 +514,7 @@ static int ichx_gpio_probe(struct platform_device *pdev)

static int ichx_gpio_remove(struct platform_device *pdev)
{
int err;

err = gpiochip_remove(&ichx_priv.chip);
if (err) {
dev_err(&pdev->dev, "%s failed, %d\n",
"gpiochip_remove()", err);
return err;
}
gpiochip_remove(&ichx_priv.chip);

ichx_gpio_release_regions(ichx_priv.gpio_base, ichx_priv.use_gpio);
if (ichx_priv.pm_base)
Expand Down
6 changes: 1 addition & 5 deletions drivers/gpio/gpio-it8761e.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,7 @@ static int __init it8761e_gpio_init(void)
static void __exit it8761e_gpio_exit(void)
{
if (gpio_ba) {
int ret = gpiochip_remove(&it8761e_gpio_chip);

WARN(ret, "%s(): gpiochip_remove() failed, ret=%d\n",
__func__, ret);

gpiochip_remove(&it8761e_gpio_chip);
release_region(gpio_ba, GPIO_IOSIZE);
gpio_ba = 0;
}
Expand Down
8 changes: 1 addition & 7 deletions drivers/gpio/gpio-janz-ttl.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,8 @@ static int ttl_probe(struct platform_device *pdev)
static int ttl_remove(struct platform_device *pdev)
{
struct ttl_module *mod = platform_get_drvdata(pdev);
struct device *dev = &pdev->dev;
int ret;

ret = gpiochip_remove(&mod->gpio);
if (ret) {
dev_err(dev, "unable to remove GPIO chip\n");
return ret;
}
gpiochip_remove(&mod->gpio);

return 0;
}
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpio/gpio-kempld.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ static int kempld_gpio_remove(struct platform_device *pdev)
{
struct kempld_gpio_data *gpio = platform_get_drvdata(pdev);

return gpiochip_remove(&gpio->chip);
gpiochip_remove(&gpio->chip);
return 0;
}

static struct platform_driver kempld_gpio_driver = {
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpio/gpio-lp3943.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ static int lp3943_gpio_remove(struct platform_device *pdev)
{
struct lp3943_gpio *lp3943_gpio = platform_get_drvdata(pdev);

return gpiochip_remove(&lp3943_gpio->chip);
gpiochip_remove(&lp3943_gpio->chip);
return 0;
}

static const struct of_device_id lp3943_gpio_of_match[] = {
Expand Down
5 changes: 1 addition & 4 deletions drivers/gpio/gpio-lynxpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,11 +465,8 @@ MODULE_DEVICE_TABLE(acpi, lynxpoint_gpio_acpi_match);
static int lp_gpio_remove(struct platform_device *pdev)
{
struct lp_gpio *lg = platform_get_drvdata(pdev);
int err;
pm_runtime_disable(&pdev->dev);
err = gpiochip_remove(&lg->chip);
if (err)
dev_warn(&pdev->dev, "failed to remove gpio_chip.\n");
gpiochip_remove(&lg->chip);
return 0;
}

Expand Down
13 changes: 4 additions & 9 deletions drivers/gpio/gpio-max730x.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,16 @@ EXPORT_SYMBOL_GPL(__max730x_probe);
int __max730x_remove(struct device *dev)
{
struct max7301 *ts = dev_get_drvdata(dev);
int ret;

if (ts == NULL)
return -ENODEV;

/* Power down the chip and disable IRQ output */
ts->write(dev, 0x04, 0x00);

ret = gpiochip_remove(&ts->chip);
if (!ret)
mutex_destroy(&ts->lock);
else
dev_err(dev, "Failed to remove GPIO controller: %d\n", ret);

return ret;
gpiochip_remove(&ts->chip);
mutex_destroy(&ts->lock);
kfree(ts);
return 0;
}
EXPORT_SYMBOL_GPL(__max730x_remove);

Expand Down
7 changes: 1 addition & 6 deletions drivers/gpio/gpio-max732x.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,12 +676,7 @@ static int max732x_remove(struct i2c_client *client)
}
}

ret = gpiochip_remove(&chip->gpio_chip);
if (ret) {
dev_err(&client->dev, "%s failed, %d\n",
"gpiochip_remove()", ret);
return ret;
}
gpiochip_remove(&chip->gpio_chip);

max732x_irq_teardown(chip);

Expand Down
11 changes: 3 additions & 8 deletions drivers/gpio/gpio-mc33880.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,20 +149,15 @@ static int mc33880_probe(struct spi_device *spi)
static int mc33880_remove(struct spi_device *spi)
{
struct mc33880 *mc;
int ret;

mc = spi_get_drvdata(spi);
if (mc == NULL)
return -ENODEV;

ret = gpiochip_remove(&mc->chip);
if (!ret)
mutex_destroy(&mc->lock);
else
dev_err(&spi->dev, "Failed to remove the GPIO controller: %d\n",
ret);
gpiochip_remove(&mc->chip);
mutex_destroy(&mc->lock);

return ret;
return 0;
}

static struct spi_driver mc33880_driver = {
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpio/gpio-mc9s08dz60.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ static int mc9s08dz60_remove(struct i2c_client *client)

mc9s = i2c_get_clientdata(client);

return gpiochip_remove(&mc9s->chip);
gpiochip_remove(&mc9s->chip);
return 0;
}

static const struct i2c_device_id mc9s08dz60_id[] = {
Expand Down
Loading

0 comments on commit 9f5132a

Please sign in to comment.