Merge branch 'devm_gpiochip' of https://github.com/ldewangan/linux-upstream into...
authorLinus Walleij <linus.walleij@linaro.org>
Thu, 25 Feb 2016 13:22:10 +0000 (14:22 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 25 Feb 2016 13:22:10 +0000 (14:22 +0100)
62 files changed:
Documentation/driver-model/devres.txt
README.md [new file with mode: 0644]
drivers/gpio/gpio-74xx-mmio.c
drivers/gpio/gpio-adnp.c
drivers/gpio/gpio-adp5520.c
drivers/gpio/gpio-adp5588.c
drivers/gpio/gpio-altera.c
drivers/gpio/gpio-arizona.c
drivers/gpio/gpio-bcm-kona.c
drivers/gpio/gpio-clps711x.c
drivers/gpio/gpio-crystalcove.c
drivers/gpio/gpio-cs5535.c
drivers/gpio/gpio-da9052.c
drivers/gpio/gpio-da9055.c
drivers/gpio/gpio-davinci.c
drivers/gpio/gpio-dln2.c
drivers/gpio/gpio-ep93xx.c
drivers/gpio/gpio-f7188x.c
drivers/gpio/gpio-ge.c
drivers/gpio/gpio-generic.c
drivers/gpio/gpio-iop.c
drivers/gpio/gpio-janz-ttl.c
drivers/gpio/gpio-kempld.c
drivers/gpio/gpio-lp3943.c
drivers/gpio/gpio-lpc32xx.c
drivers/gpio/gpio-lynxpoint.c
drivers/gpio/gpio-mc9s08dz60.c
drivers/gpio/gpio-moxart.c
drivers/gpio/gpio-mvebu.c
drivers/gpio/gpio-mxc.c
drivers/gpio/gpio-octeon.c
drivers/gpio/gpio-palmas.c
drivers/gpio/gpio-pca953x.c
drivers/gpio/gpio-pcf857x.c
drivers/gpio/gpio-rc5t583.c
drivers/gpio/gpio-rdc321x.c
drivers/gpio/gpio-sch.c
drivers/gpio/gpio-spear-spics.c
drivers/gpio/gpio-sta2x11.c
drivers/gpio/gpio-stp-xway.c
drivers/gpio/gpio-sx150x.c
drivers/gpio/gpio-syscon.c
drivers/gpio/gpio-tb10x.c
drivers/gpio/gpio-tc3589x.c
drivers/gpio/gpio-tegra.c
drivers/gpio/gpio-timberdale.c
drivers/gpio/gpio-tps6586x.c
drivers/gpio/gpio-tps65910.c
drivers/gpio/gpio-tps65912.c
drivers/gpio/gpio-ts4800.c
drivers/gpio/gpio-ts5500.c
drivers/gpio/gpio-twl6040.c
drivers/gpio/gpio-ucb1400.c
drivers/gpio/gpio-viperboard.c
drivers/gpio/gpio-vx855.c
drivers/gpio/gpio-wm831x.c
drivers/gpio/gpio-wm8350.c
drivers/gpio/gpio-wm8994.c
drivers/gpio/gpio-xgene-sb.c
drivers/gpio/gpio-xgene.c
drivers/gpio/gpiolib.c
include/linux/gpio/driver.h

index 831a5363f6be37756b0016c1c30fc0f46055aff8..73b98dfbcea49a0d97b81583263a8e5944a3e7df 100644 (file)
@@ -252,6 +252,11 @@ GPIO
   devm_gpiod_get_index_optional()
   devm_gpiod_get_optional()
   devm_gpiod_put()
+  devm_gpiochip_add_data()
+  devm_gpiochip_remove()
+  devm_gpio_request()
+  devm_gpio_request_one()
+  devm_gpio_free()
 
 IIO
   devm_iio_device_alloc()
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..1301bb1
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# linux-upstream
+This is for sharing upstreaming activities.
index 372b0e01adc6cb31e79eb5534661c3170242954e..0475e8ec96d0170ff2c6de7c543596bc773104d9 100644 (file)
@@ -140,15 +140,7 @@ static int mmio_74xx_gpio_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, priv);
 
-       return gpiochip_add_data(&priv->gc, priv);
-}
-
-static int mmio_74xx_gpio_remove(struct platform_device *pdev)
-{
-       struct mmio_74xx_gpio_priv *priv = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&priv->gc);
-       return 0;
+       return devm_gpiochip_add_data(&pdev->dev, &priv->gc, priv);
 }
 
 static struct platform_driver mmio_74xx_gpio_driver = {
@@ -157,7 +149,6 @@ static struct platform_driver mmio_74xx_gpio_driver = {
                .of_match_table = mmio_74xx_gpio_ids,
        },
        .probe  = mmio_74xx_gpio_probe,
-       .remove = mmio_74xx_gpio_remove,
 };
 module_platform_driver(mmio_74xx_gpio_driver);
 
index fb5b47b69f141035f50ef8f64631f67b432bb0e8..8ff7b0d3eac6f1c50dbe2afbbf65773df22941a2 100644 (file)
@@ -265,7 +265,7 @@ static int adnp_gpio_setup(struct adnp *adnp, unsigned int num_gpios)
        chip->of_node = chip->parent->of_node;
        chip->owner = THIS_MODULE;
 
-       err = gpiochip_add_data(chip, adnp);
+       err = devm_gpiochip_add_data(&adnp->client->dev, chip, adnp);
        if (err)
                return err;
 
@@ -520,14 +520,6 @@ static int adnp_i2c_probe(struct i2c_client *client,
        return 0;
 }
 
-static int adnp_i2c_remove(struct i2c_client *client)
-{
-       struct adnp *adnp = i2c_get_clientdata(client);
-
-       gpiochip_remove(&adnp->gpio);
-       return 0;
-}
-
 static const struct i2c_device_id adnp_i2c_id[] = {
        { "gpio-adnp" },
        { },
@@ -546,7 +538,6 @@ static struct i2c_driver adnp_i2c_driver = {
                .of_match_table = adnp_of_match,
        },
        .probe = adnp_i2c_probe,
-       .remove = adnp_i2c_remove,
        .id_table = adnp_i2c_id,
 };
 module_i2c_driver(adnp_i2c_driver);
index 4fa7ff1fec9ae870a5d45ccbd01a2f3f5fcb3f44..abf1996095465d6be5f8ec4caccbbcfaf1af1066 100644 (file)
@@ -153,7 +153,7 @@ static int adp5520_gpio_probe(struct platform_device *pdev)
                goto err;
        }
 
-       ret = gpiochip_add_data(&dev->gpio_chip, dev);
+       ret = devm_gpiochip_add_data(&pdev->dev, &dev->gpio_chip, dev);
        if (ret)
                goto err;
 
@@ -164,22 +164,11 @@ err:
        return ret;
 }
 
-static int adp5520_gpio_remove(struct platform_device *pdev)
-{
-       struct adp5520_gpio *dev;
-
-       dev = platform_get_drvdata(pdev);
-       gpiochip_remove(&dev->gpio_chip);
-
-       return 0;
-}
-
 static struct platform_driver adp5520_gpio_driver = {
        .driver = {
                .name   = "adp5520-gpio",
        },
        .probe          = adp5520_gpio_probe,
-       .remove         = adp5520_gpio_remove,
 };
 
 module_platform_driver(adp5520_gpio_driver);
index 19a0eba1e942a2f652ff1c43f5b870512e82d698..c0f718b12317271d90c44ab73438f993c36a343e 100644 (file)
@@ -414,7 +414,7 @@ static int adp5588_gpio_probe(struct i2c_client *client,
                }
        }
 
-       ret = gpiochip_add_data(&dev->gpio_chip, dev);
+       ret = devm_gpiochip_add_data(&client->dev, &dev->gpio_chip, dev);
        if (ret)
                goto err_irq;
 
@@ -457,8 +457,6 @@ static int adp5588_gpio_remove(struct i2c_client *client)
        if (dev->irq_base)
                free_irq(dev->client->irq, dev);
 
-       gpiochip_remove(&dev->gpio_chip);
-
        return 0;
 }
 
index 2aeaebd1c6e7af574fca9058cd0cf758e635943b..3f87a03abc222bc31cbc68eef98993c9e3303ad4 100644 (file)
@@ -312,8 +312,8 @@ static int altera_gpio_probe(struct platform_device *pdev)
                handle_simple_irq, IRQ_TYPE_NONE);
 
        if (ret) {
-               dev_info(&pdev->dev, "could not add irqchip\n");
-               return ret;
+               dev_err(&pdev->dev, "could not add irqchip\n");
+               goto teardown;
        }
 
        gpiochip_set_chained_irqchip(&altera_gc->mmchip.gc,
@@ -326,6 +326,7 @@ static int altera_gpio_probe(struct platform_device *pdev)
 skip_irq:
        return 0;
 teardown:
+       of_mm_gpiochip_remove(&altera_gc->mmchip);
        pr_err("%s: registration failed with status %d\n",
                node->full_name, ret);
 
index e910c1f41d9340d9f02624d7549ca1ac2071b3a6..991370494922b1f7ac3489dc0616793be319378a 100644 (file)
@@ -132,7 +132,8 @@ static int arizona_gpio_probe(struct platform_device *pdev)
        else
                arizona_gpio->gpio_chip.base = -1;
 
-       ret = gpiochip_add_data(&arizona_gpio->gpio_chip, arizona_gpio);
+       ret = devm_gpiochip_add_data(&pdev->dev, &arizona_gpio->gpio_chip,
+                                    arizona_gpio);
        if (ret < 0) {
                dev_err(&pdev->dev, "Could not register gpiochip, %d\n",
                        ret);
@@ -147,18 +148,9 @@ err:
        return ret;
 }
 
-static int arizona_gpio_remove(struct platform_device *pdev)
-{
-       struct arizona_gpio *arizona_gpio = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&arizona_gpio->gpio_chip);
-       return 0;
-}
-
 static struct platform_driver arizona_gpio_driver = {
        .driver.name    = "arizona-gpio",
        .probe          = arizona_gpio_probe,
-       .remove         = arizona_gpio_remove,
 };
 
 module_platform_driver(arizona_gpio_driver);
index b6c5abe85dafef89d001b55d3b278de830a9ce5a..2fd38d598f3de8912e19fdddc1f13b1194ef393e 100644 (file)
@@ -630,7 +630,7 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev)
 
        bcm_kona_gpio_reset(kona_gpio);
 
-       ret = gpiochip_add_data(chip, kona_gpio);
+       ret = devm_gpiochip_add_data(dev, chip, kona_gpio);
        if (ret < 0) {
                dev_err(dev, "Couldn't add GPIO chip -- %d\n", ret);
                goto err_irq_domain;
index c84f9551f1082b4655d8cf86007395ea4a942173..5a690256af9bea31855609da66138fef1c152df8 100644 (file)
@@ -67,15 +67,7 @@ static int clps711x_gpio_probe(struct platform_device *pdev)
        gc->owner = THIS_MODULE;
        platform_set_drvdata(pdev, gc);
 
-       return gpiochip_add_data(gc, NULL);
-}
-
-static int clps711x_gpio_remove(struct platform_device *pdev)
-{
-       struct gpio_chip *gc = platform_get_drvdata(pdev);
-
-       gpiochip_remove(gc);
-       return 0;
+       return devm_gpiochip_add_data(&pdev->dev, gc, NULL);
 }
 
 static const struct of_device_id __maybe_unused clps711x_gpio_ids[] = {
@@ -90,7 +82,6 @@ static struct platform_driver clps711x_gpio_driver = {
                .of_match_table = of_match_ptr(clps711x_gpio_ids),
        },
        .probe  = clps711x_gpio_probe,
-       .remove = clps711x_gpio_remove,
 };
 module_platform_driver(clps711x_gpio_driver);
 
index 7865ef0d3352b0d656201707c61b089b5b6ad7ed..7c446d118cd68f543f63114cd95bf334a11ed67f 100644 (file)
@@ -345,7 +345,7 @@ static int crystalcove_gpio_probe(struct platform_device *pdev)
        cg->chip.dbg_show = crystalcove_gpio_dbg_show;
        cg->regmap = pmic->regmap;
 
-       retval = gpiochip_add_data(&cg->chip, cg);
+       retval = devm_gpiochip_add_data(&pdev->dev, &cg->chip, cg);
        if (retval) {
                dev_warn(&pdev->dev, "add gpio chip error: %d\n", retval);
                return retval;
@@ -359,14 +359,10 @@ static int crystalcove_gpio_probe(struct platform_device *pdev)
 
        if (retval) {
                dev_warn(&pdev->dev, "request irq failed: %d\n", retval);
-               goto out_remove_gpio;
+               return retval;
        }
 
        return 0;
-
-out_remove_gpio:
-       gpiochip_remove(&cg->chip);
-       return retval;
 }
 
 static int crystalcove_gpio_remove(struct platform_device *pdev)
@@ -374,7 +370,6 @@ static int crystalcove_gpio_remove(struct platform_device *pdev)
        struct crystalcove_gpio *cg = platform_get_drvdata(pdev);
        int irq = platform_get_irq(pdev, 0);
 
-       gpiochip_remove(&cg->chip);
        if (irq >= 0)
                free_irq(irq, cg);
        return 0;
index eccb712e09fb1109d27bf34f2861176451c332a5..90278b19aa0e27574528d055e773b716ad5dd134 100644 (file)
@@ -320,13 +320,13 @@ static int cs5535_gpio_probe(struct platform_device *pdev)
        res = platform_get_resource(pdev, IORESOURCE_IO, 0);
        if (!res) {
                dev_err(&pdev->dev, "can't fetch device resource info\n");
-               goto done;
+               return err;
        }
 
        if (!devm_request_region(&pdev->dev, res->start, resource_size(res),
                                 pdev->name)) {
                dev_err(&pdev->dev, "can't request region\n");
-               goto done;
+               return err;
        }
 
        /* set up the driver-specific struct */
@@ -348,19 +348,10 @@ static int cs5535_gpio_probe(struct platform_device *pdev)
                                mask_orig, mask);
 
        /* finally, register with the generic GPIO API */
-       err = gpiochip_add_data(&cs5535_gpio_chip.chip, &cs5535_gpio_chip);
+       err = devm_gpiochip_add_data(&pdev->dev, &cs5535_gpio_chip.chip,
+                                    &cs5535_gpio_chip);
        if (err)
-               goto done;
-
-       return 0;
-
-done:
-       return err;
-}
-
-static int cs5535_gpio_remove(struct platform_device *pdev)
-{
-       gpiochip_remove(&cs5535_gpio_chip.chip);
+               return err;
 
        return 0;
 }
@@ -370,7 +361,6 @@ static struct platform_driver cs5535_gpio_driver = {
                .name = DRV_NAME,
        },
        .probe = cs5535_gpio_probe,
-       .remove = cs5535_gpio_remove,
 };
 
 module_platform_driver(cs5535_gpio_driver);
index f9b3247ad14b7a8ee8497c263d9c1dba84204939..e29553b7ccdb8aaad14d574e5b6fcc433e094bb5 100644 (file)
@@ -214,7 +214,7 @@ static int da9052_gpio_probe(struct platform_device *pdev)
        if (pdata && pdata->gpio_base)
                gpio->gp.base = pdata->gpio_base;
 
-       ret = gpiochip_add_data(&gpio->gp, gpio);
+       ret = devm_gpiochip_add_data(&pdev->dev, &gpio->gp, gpio);
        if (ret < 0) {
                dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);
                return ret;
@@ -225,17 +225,8 @@ static int da9052_gpio_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int da9052_gpio_remove(struct platform_device *pdev)
-{
-       struct da9052_gpio *gpio = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&gpio->gp);
-       return 0;
-}
-
 static struct platform_driver da9052_gpio_driver = {
        .probe = da9052_gpio_probe,
-       .remove = da9052_gpio_remove,
        .driver = {
                .name   = "da9052-gpio",
        },
index 18210fb2cb13ba5f6bf3c35a0a72f606526f635b..2c2c18dc6c4f394d4bce5ac675d9ca45a37e9a9d 100644 (file)
@@ -151,31 +151,19 @@ static int da9055_gpio_probe(struct platform_device *pdev)
        if (pdata && pdata->gpio_base)
                gpio->gp.base = pdata->gpio_base;
 
-       ret = gpiochip_add_data(&gpio->gp, gpio);
+       ret = devm_gpiochip_add_data(&pdev->dev, &gpio->gp, gpio);
        if (ret < 0) {
                dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);
-               goto err_mem;
+               return ret;
        }
 
        platform_set_drvdata(pdev, gpio);
 
        return 0;
-
-err_mem:
-       return ret;
-}
-
-static int da9055_gpio_remove(struct platform_device *pdev)
-{
-       struct da9055_gpio *gpio = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&gpio->gp);
-       return 0;
 }
 
 static struct platform_driver da9055_gpio_driver = {
        .probe = da9055_gpio_probe,
-       .remove = da9055_gpio_remove,
        .driver = {
                .name   = "da9055-gpio",
        },
index 96332f19e775d8efef2610fa567846938b7a575c..dd262f00295defb359dbda86c636bfd9ab172ed7 100644 (file)
@@ -195,7 +195,7 @@ static int davinci_gpio_of_xlate(struct gpio_chip *gc,
 static int davinci_gpio_probe(struct platform_device *pdev)
 {
        int i, base;
-       unsigned ngpio;
+       unsigned ngpio, nbank;
        struct davinci_gpio_controller *chips;
        struct davinci_gpio_platform_data *pdata;
        struct davinci_gpio_regs __iomem *regs;
@@ -224,8 +224,9 @@ static int davinci_gpio_probe(struct platform_device *pdev)
        if (WARN_ON(ARCH_NR_GPIOS < ngpio))
                ngpio = ARCH_NR_GPIOS;
 
+       nbank = DIV_ROUND_UP(ngpio, 32);
        chips = devm_kzalloc(dev,
-                            ngpio * sizeof(struct davinci_gpio_controller),
+                            nbank * sizeof(struct davinci_gpio_controller),
                             GFP_KERNEL);
        if (!chips)
                return -ENOMEM;
@@ -512,7 +513,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
                        return irq;
                }
 
-               irq_domain = irq_domain_add_legacy(NULL, ngpio, irq, 0,
+               irq_domain = irq_domain_add_legacy(dev->of_node, ngpio, irq, 0,
                                                        &davinci_gpio_irq_ops,
                                                        chips);
                if (!irq_domain) {
index e11a7d126e74f9cd51c206e4f48886e691c102b5..f7a60a441e9583fcf1693cb928d90e24c255afa3 100644 (file)
@@ -479,40 +479,32 @@ static int dln2_gpio_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, dln2);
 
-       ret = gpiochip_add_data(&dln2->gpio, dln2);
+       ret = devm_gpiochip_add_data(dev, &dln2->gpio, dln2);
        if (ret < 0) {
                dev_err(dev, "failed to add gpio chip: %d\n", ret);
-               goto out;
+               return ret;
        }
 
        ret = gpiochip_irqchip_add(&dln2->gpio, &dln2_gpio_irqchip, 0,
                                   handle_simple_irq, IRQ_TYPE_NONE);
        if (ret < 0) {
                dev_err(dev, "failed to add irq chip: %d\n", ret);
-               goto out_gpiochip_remove;
+               return ret;
        }
 
        ret = dln2_register_event_cb(pdev, DLN2_GPIO_CONDITION_MET_EV,
                                     dln2_gpio_event);
        if (ret) {
                dev_err(dev, "failed to register event cb: %d\n", ret);
-               goto out_gpiochip_remove;
+               return ret;
        }
 
        return 0;
-
-out_gpiochip_remove:
-       gpiochip_remove(&dln2->gpio);
-out:
-       return ret;
 }
 
 static int dln2_gpio_remove(struct platform_device *pdev)
 {
-       struct dln2_gpio *dln2 = platform_get_drvdata(pdev);
-
        dln2_unregister_event_cb(pdev, DLN2_GPIO_CONDITION_MET_EV);
-       gpiochip_remove(&dln2->gpio);
 
        return 0;
 }
index ad279078fed7f9c441e046e820ca60d27b53b579..d054219e18b930d1cc0df7880066fd3e8b3b0ed1 100644 (file)
@@ -339,7 +339,7 @@ static int ep93xx_gpio_add_bank(struct gpio_chip *gc, struct device *dev,
                gc->to_irq = ep93xx_gpio_to_irq;
        }
 
-       return gpiochip_add_data(gc, NULL);
+       return devm_gpiochip_add_data(dev, gc, NULL);
 }
 
 static int ep93xx_gpio_probe(struct platform_device *pdev)
index 0417798c45f1dd54597b9ee9495d6fdcb4044420..daac2d480db1de8081f46f40c94306a8662b88cc 100644 (file)
@@ -350,36 +350,15 @@ static int f7188x_gpio_probe(struct platform_device *pdev)
                bank->chip.parent = &pdev->dev;
                bank->data = data;
 
-               err = gpiochip_add_data(&bank->chip, bank);
+               err = devm_gpiochip_add_data(&pdev->dev, &bank->chip, bank);
                if (err) {
                        dev_err(&pdev->dev,
                                "Failed to register gpiochip %d: %d\n",
                                i, err);
-                       goto err_gpiochip;
+                       return err;
                }
        }
 
-       return 0;
-
-err_gpiochip:
-       for (i = i - 1; i >= 0; i--) {
-               struct f7188x_gpio_bank *bank = &data->bank[i];
-               gpiochip_remove(&bank->chip);
-       }
-
-       return err;
-}
-
-static int f7188x_gpio_remove(struct platform_device *pdev)
-{
-       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];
-               gpiochip_remove(&bank->chip);
-       }
-
        return 0;
 }
 
@@ -476,7 +455,6 @@ static struct platform_driver f7188x_gpio_driver = {
                .name   = DRVNAME,
        },
        .probe          = f7188x_gpio_probe,
-       .remove         = f7188x_gpio_remove,
 };
 
 static int __init f7188x_gpio_init(void)
index cbbec838a9d1b1c383788a7b22cfa16563d6305d..8650b2916f874c8b1285e3f8fee4ae62ce954631 100644 (file)
@@ -89,7 +89,7 @@ static int __init gef_gpio_probe(struct platform_device *pdev)
        gc->of_node = pdev->dev.of_node;
 
        /* This function adds a memory mapped GPIO chip */
-       ret = gpiochip_add_data(gc, NULL);
+       ret = devm_gpiochip_add_data(&pdev->dev, gc, NULL);
        if (ret)
                goto err0;
 
index 2a4f2333a50b39674cbb848cddd03481fe79b566..54cddfa98f50b09c0d87a1f8d61031e158be23a2 100644 (file)
@@ -628,15 +628,7 @@ static int bgpio_pdev_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, gc);
 
-       return gpiochip_add_data(gc, NULL);
-}
-
-static int bgpio_pdev_remove(struct platform_device *pdev)
-{
-       struct gpio_chip *gc = platform_get_drvdata(pdev);
-
-       gpiochip_remove(gc);
-       return 0;
+       return devm_gpiochip_add_data(&pdev->dev, gc, NULL);
 }
 
 static const struct platform_device_id bgpio_id_table[] = {
@@ -657,7 +649,6 @@ static struct platform_driver bgpio_driver = {
        },
        .id_table = bgpio_id_table,
        .probe = bgpio_pdev_probe,
-       .remove = bgpio_pdev_remove,
 };
 
 module_platform_driver(bgpio_driver);
index fb65e5850e0c1f67a31b00a678fb1a4b35ccf3de..860c535922fd184d929e1fda6a9fff2c9452622c 100644 (file)
@@ -114,7 +114,7 @@ static int iop3xx_gpio_probe(struct platform_device *pdev)
        if (IS_ERR(base))
                return PTR_ERR(base);
 
-       return gpiochip_add_data(&iop3xx_chip, NULL);
+       return devm_gpiochip_add_data(&pdev->dev, &iop3xx_chip, NULL);
 }
 
 static struct platform_driver iop3xx_gpio_driver = {
index 482aa0353868e3d1e1e395917e42cc7a4b077a6f..a8d0a6b8025a60f820a62674e6780b6b92bb0334 100644 (file)
@@ -182,7 +182,7 @@ static int ttl_probe(struct platform_device *pdev)
        gpio->base = -1;
        gpio->ngpio = 20;
 
-       ret = gpiochip_add_data(gpio, NULL);
+       ret = devm_gpiochip_add_data(dev, gpio, NULL);
        if (ret) {
                dev_err(dev, "unable to add GPIO chip\n");
                return ret;
@@ -191,21 +191,11 @@ static int ttl_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int ttl_remove(struct platform_device *pdev)
-{
-       struct ttl_module *mod = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&mod->gpio);
-
-       return 0;
-}
-
 static struct platform_driver ttl_driver = {
        .driver         = {
                .name   = DRV_NAME,
        },
        .probe          = ttl_probe,
-       .remove         = ttl_remove,
 };
 
 module_platform_driver(ttl_driver);
index 01117747b965923455f29062878c1e379033a6c2..701f1510328c1144f2725e8acfa379cd39ab73b0 100644 (file)
@@ -178,7 +178,7 @@ static int kempld_gpio_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
-       ret = gpiochip_add_data(chip, gpio);
+       ret = devm_gpiochip_add_data(dev, chip, gpio);
        if (ret) {
                dev_err(dev, "Could not register GPIO chip\n");
                return ret;
@@ -190,20 +190,11 @@ static int kempld_gpio_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int kempld_gpio_remove(struct platform_device *pdev)
-{
-       struct kempld_gpio_data *gpio = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&gpio->chip);
-       return 0;
-}
-
 static struct platform_driver kempld_gpio_driver = {
        .driver = {
                .name = "kempld-gpio",
        },
        .probe          = kempld_gpio_probe,
-       .remove         = kempld_gpio_remove,
 };
 
 module_platform_driver(kempld_gpio_driver);
index 1c8e2ae26938bd3b6b20c81c81335de23f019e05..6dc6725403ecd70f2b3d36deefd48a75df475648 100644 (file)
@@ -204,15 +204,8 @@ static int lp3943_gpio_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, lp3943_gpio);
 
-       return gpiochip_add_data(&lp3943_gpio->chip, lp3943_gpio);
-}
-
-static int lp3943_gpio_remove(struct platform_device *pdev)
-{
-       struct lp3943_gpio *lp3943_gpio = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&lp3943_gpio->chip);
-       return 0;
+       return devm_gpiochip_add_data(&pdev->dev, &lp3943_gpio->chip,
+                                     lp3943_gpio);
 }
 
 static const struct of_device_id lp3943_gpio_of_match[] = {
@@ -223,7 +216,6 @@ MODULE_DEVICE_TABLE(of, lp3943_gpio_of_match);
 
 static struct platform_driver lp3943_gpio_driver = {
        .probe = lp3943_gpio_probe,
-       .remove = lp3943_gpio_remove,
        .driver = {
                .name = "lp3943-gpio",
                .of_match_table = lp3943_gpio_of_match,
index 4cecf4ce96c1cc24d33ecf2016782a640d29c4c3..d39014daeef9e206bfeb8cdf967e3c55c56db459 100644 (file)
@@ -547,7 +547,7 @@ static int lpc32xx_gpio_probe(struct platform_device *pdev)
                        lpc32xx_gpiochip[i].chip.of_gpio_n_cells = 3;
                        lpc32xx_gpiochip[i].chip.of_node = pdev->dev.of_node;
                }
-               gpiochip_add_data(&lpc32xx_gpiochip[i].chip,
+               devm_gpiochip_add_data(&pdev->dev, &lpc32xx_gpiochip[i].chip,
                                  &lpc32xx_gpiochip[i]);
        }
 
index 13107772be4ffc4e1d12d471cf5df7a65a1ab639..9df015e85ad94cdffaa3630432482eb4e8af3a9a 100644 (file)
@@ -370,7 +370,7 @@ static int lp_gpio_probe(struct platform_device *pdev)
        gc->can_sleep = false;
        gc->parent = dev;
 
-       ret = gpiochip_add_data(gc, lg);
+       ret = devm_gpiochip_add_data(dev, gc, lg);
        if (ret) {
                dev_err(dev, "failed adding lp-gpio chip\n");
                return ret;
@@ -439,9 +439,7 @@ 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);
        pm_runtime_disable(&pdev->dev);
-       gpiochip_remove(&lg->chip);
        return 0;
 }
 
index ba22fb92a6e7df10d411ccd9882677fae80bf465..14f252f9eb298166b684f9f456eecf68b1036933 100644 (file)
@@ -103,17 +103,7 @@ static int mc9s08dz60_probe(struct i2c_client *client,
        mc9s->client = client;
        i2c_set_clientdata(client, mc9s);
 
-       return gpiochip_add_data(&mc9s->chip, mc9s);
-}
-
-static int mc9s08dz60_remove(struct i2c_client *client)
-{
-       struct mc9s08dz60 *mc9s;
-
-       mc9s = i2c_get_clientdata(client);
-
-       gpiochip_remove(&mc9s->chip);
-       return 0;
+       return devm_gpiochip_add_data(&client->dev, &mc9s->chip, mc9s);
 }
 
 static const struct i2c_device_id mc9s08dz60_id[] = {
@@ -128,7 +118,6 @@ static struct i2c_driver mc9s08dz60_i2c_driver = {
                .name = "mc9s08dz60",
        },
        .probe = mc9s08dz60_probe,
-       .remove = mc9s08dz60_remove,
        .id_table = mc9s08dz60_id,
 };
 
index ca604538ebf7e74acb523af0c2dc5a7e4ced5777..869002b7a571a70c092e8c2dff6b136188b4e06f 100644 (file)
@@ -63,7 +63,7 @@ static int moxart_gpio_probe(struct platform_device *pdev)
        gc->parent = dev;
        gc->owner = THIS_MODULE;
 
-       ret = gpiochip_add_data(gc, NULL);
+       ret = devm_gpiochip_add_data(dev, gc, NULL);
        if (ret) {
                dev_err(dev, "%s: gpiochip_add failed\n",
                        dev->of_node->full_name);
index a5eacc1dff094463aecd281d09cffa308a0fde89..11c6582ef0a6cf9aa2ef2a4496202b077bad3a4c 100644 (file)
@@ -756,7 +756,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
                BUG();
        }
 
-       gpiochip_add_data(&mvchip->chip, mvchip);
+       devm_gpiochip_add_data(&pdev->dev, &mvchip->chip, mvchip);
 
        /* Some gpio controllers do not provide irq support */
        if (!of_irq_count(np))
@@ -777,16 +777,14 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
        mvchip->irqbase = irq_alloc_descs(-1, 0, ngpios, -1);
        if (mvchip->irqbase < 0) {
                dev_err(&pdev->dev, "no irqs\n");
-               err = mvchip->irqbase;
-               goto err_gpiochip_add;
+               return mvchip->irqbase;
        }
 
        gc = irq_alloc_generic_chip("mvebu_gpio_irq", 2, mvchip->irqbase,
                                    mvchip->membase, handle_level_irq);
        if (!gc) {
                dev_err(&pdev->dev, "Cannot allocate generic irq_chip\n");
-               err = -ENOMEM;
-               goto err_gpiochip_add;
+               return -ENOMEM;
        }
 
        gc->private = mvchip;
@@ -828,9 +826,6 @@ err_generic_chip:
                                IRQ_LEVEL | IRQ_NOPROBE);
        kfree(gc);
 
-err_gpiochip_add:
-       gpiochip_remove(&mvchip->chip);
-
        return err;
 }
 
index 7fd21cb53c81c167523f47989170133f9809fe2a..1b342a3842c824158b424141636a7df368b3c787 100644 (file)
@@ -462,14 +462,14 @@ static int mxc_gpio_probe(struct platform_device *pdev)
        port->gc.base = (pdev->id < 0) ? of_alias_get_id(np, "gpio") * 32 :
                                             pdev->id * 32;
 
-       err = gpiochip_add_data(&port->gc, port);
+       err = devm_gpiochip_add_data(&pdev->dev, &port->gc, port);
        if (err)
                goto out_bgio;
 
        irq_base = irq_alloc_descs(-1, 0, 32, numa_node_id());
        if (irq_base < 0) {
                err = irq_base;
-               goto out_gpiochip_remove;
+               goto out_bgio;
        }
 
        port->domain = irq_domain_add_legacy(np, 32, irq_base, 0,
@@ -492,8 +492,6 @@ out_irqdomain_remove:
        irq_domain_remove(port->domain);
 out_irqdesc_free:
        irq_free_descs(irq_base, 32);
-out_gpiochip_remove:
-       gpiochip_remove(&port->gc);
 out_bgio:
        dev_info(&pdev->dev, "%s failed with errno %d\n", __func__, err);
        return err;
index 7665ebcd0c1d7be77be57338aa2065d63463e3eb..47aead1ed1cc4218378bd13683e627c60728ed05 100644 (file)
@@ -117,7 +117,7 @@ static int octeon_gpio_probe(struct platform_device *pdev)
        chip->get = octeon_gpio_get;
        chip->direction_output = octeon_gpio_dir_out;
        chip->set = octeon_gpio_set;
-       err = gpiochip_add_data(chip, gpio);
+       err = devm_gpiochip_add_data(&pdev->dev, chip, gpio);
        if (err)
                goto out;
 
@@ -126,13 +126,6 @@ out:
        return err;
 }
 
-static int octeon_gpio_remove(struct platform_device *pdev)
-{
-       struct gpio_chip *chip = dev_get_platdata(&pdev->dev);
-       gpiochip_remove(chip);
-       return 0;
-}
-
 static struct of_device_id octeon_gpio_match[] = {
        {
                .compatible = "cavium,octeon-3860-gpio",
@@ -147,7 +140,6 @@ static struct platform_driver octeon_gpio_driver = {
                .of_match_table = octeon_gpio_match,
        },
        .probe          = octeon_gpio_probe,
-       .remove         = octeon_gpio_remove,
 };
 
 module_platform_driver(octeon_gpio_driver);
index fdfb3b1e0defdac02ab5c711a640a43c6b1e5221..6f27b3d94d53d6dd2ff16742b4723998316ffc61 100644 (file)
@@ -195,7 +195,8 @@ static int palmas_gpio_probe(struct platform_device *pdev)
        else
                palmas_gpio->gpio_chip.base = -1;
 
-       ret = gpiochip_add_data(&palmas_gpio->gpio_chip, palmas_gpio);
+       ret = devm_gpiochip_add_data(&pdev->dev, &palmas_gpio->gpio_chip,
+                                    palmas_gpio);
        if (ret < 0) {
                dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);
                return ret;
@@ -205,20 +206,11 @@ static int palmas_gpio_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int palmas_gpio_remove(struct platform_device *pdev)
-{
-       struct palmas_gpio *palmas_gpio = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&palmas_gpio->gpio_chip);
-       return 0;
-}
-
 static struct platform_driver palmas_gpio_driver = {
        .driver.name    = "palmas-gpio",
        .driver.owner   = THIS_MODULE,
        .driver.of_match_table = of_palmas_gpio_match,
        .probe          = palmas_gpio_probe,
-       .remove         = palmas_gpio_remove,
 };
 
 static int __init palmas_gpio_init(void)
index 23196c5fc17ceb6b90a24ef446d43bb3ae858734..b7fe5d5e348815b2acea03dc7ea70d181fa0d621 100644 (file)
@@ -754,7 +754,7 @@ static int pca953x_probe(struct i2c_client *client,
        if (ret)
                return ret;
 
-       ret = gpiochip_add_data(&chip->gpio_chip, chip);
+       ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip);
        if (ret)
                return ret;
 
@@ -789,8 +789,6 @@ static int pca953x_remove(struct i2c_client *client)
                }
        }
 
-       gpiochip_remove(&chip->gpio_chip);
-
        return 0;
 }
 
index 709cd3fc2a70eb152f44fa0d083bd085c242d813..169c09aa33c85b7505c912d31b8176c18a81fcce 100644 (file)
@@ -372,7 +372,7 @@ static int pcf857x_probe(struct i2c_client *client,
        gpio->out = ~n_latch;
        gpio->status = gpio->out;
 
-       status = gpiochip_add_data(&gpio->chip, gpio);
+       status = devm_gpiochip_add_data(&client->dev, &gpio->chip, gpio);
        if (status < 0)
                goto fail;
 
@@ -383,7 +383,7 @@ static int pcf857x_probe(struct i2c_client *client,
                                              IRQ_TYPE_NONE);
                if (status) {
                        dev_err(&client->dev, "cannot add irqchip\n");
-                       goto fail_irq;
+                       goto fail;
                }
 
                status = devm_request_threaded_irq(&client->dev, client->irq,
@@ -391,7 +391,7 @@ static int pcf857x_probe(struct i2c_client *client,
                                        IRQF_TRIGGER_FALLING | IRQF_SHARED,
                                        dev_name(&client->dev), gpio);
                if (status)
-                       goto fail_irq;
+                       goto fail;
 
                gpiochip_set_chained_irqchip(&gpio->chip, &pcf857x_irq_chip,
                                             client->irq, NULL);
@@ -413,9 +413,6 @@ static int pcf857x_probe(struct i2c_client *client,
 
        return 0;
 
-fail_irq:
-       gpiochip_remove(&gpio->chip);
-
 fail:
        dev_dbg(&client->dev, "probe error %d for '%s'\n", status,
                client->name);
@@ -440,7 +437,6 @@ static int pcf857x_remove(struct i2c_client *client)
                }
        }
 
-       gpiochip_remove(&gpio->chip);
        return status;
 }
 
index 1e2d210b33697d55aa75cfe40871a0ddd244752b..1d6100fa312ad94b456d9276f570e024782fa505 100644 (file)
@@ -136,15 +136,8 @@ static int rc5t583_gpio_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, rc5t583_gpio);
 
-       return gpiochip_add_data(&rc5t583_gpio->gpio_chip, rc5t583_gpio);
-}
-
-static int rc5t583_gpio_remove(struct platform_device *pdev)
-{
-       struct rc5t583_gpio *rc5t583_gpio = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&rc5t583_gpio->gpio_chip);
-       return 0;
+       return devm_gpiochip_add_data(&pdev->dev, &rc5t583_gpio->gpio_chip,
+                                     rc5t583_gpio);
 }
 
 static struct platform_driver rc5t583_gpio_driver = {
@@ -152,7 +145,6 @@ static struct platform_driver rc5t583_gpio_driver = {
                .name    = "rc5t583-gpio",
        },
        .probe          = rc5t583_gpio_probe,
-       .remove         = rc5t583_gpio_remove,
 };
 
 static int __init rc5t583_gpio_init(void)
index 96ddee3f464a7b3feb875ddd47a198f8709d74f1..ec945b90f54deea96fef88b65ff1945d0480056e 100644 (file)
@@ -194,23 +194,14 @@ static int rdc321x_gpio_probe(struct platform_device *pdev)
 
        dev_info(&pdev->dev, "registering %d GPIOs\n",
                                        rdc321x_gpio_dev->chip.ngpio);
-       return gpiochip_add_data(&rdc321x_gpio_dev->chip, rdc321x_gpio_dev);
-}
-
-static int rdc321x_gpio_remove(struct platform_device *pdev)
-{
-       struct rdc321x_gpio *rdc321x_gpio_dev = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&rdc321x_gpio_dev->chip);
-
-       return 0;
+       return devm_gpiochip_add_data(&pdev->dev, &rdc321x_gpio_dev->chip,
+                                     rdc321x_gpio_dev);
 }
 
 static struct platform_driver rdc321x_gpio_driver = {
        .driver.name    = "rdc321x-gpio",
        .driver.owner   = THIS_MODULE,
        .probe          = rdc321x_gpio_probe,
-       .remove         = rdc321x_gpio_remove,
 };
 
 module_platform_driver(rdc321x_gpio_driver);
index 5314ee4b947dd84b726ce354225ad3edcb32cd6e..e85e7539cf5d23d0eae1d4a1433b236253dd10cc 100644 (file)
@@ -215,15 +215,7 @@ static int sch_gpio_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, sch);
 
-       return gpiochip_add_data(&sch->chip, sch);
-}
-
-static int sch_gpio_remove(struct platform_device *pdev)
-{
-       struct sch_gpio *sch = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&sch->chip);
-       return 0;
+       return devm_gpiochip_add_data(&pdev->dev, &sch->chip, sch);
 }
 
 static struct platform_driver sch_gpio_driver = {
@@ -231,7 +223,6 @@ static struct platform_driver sch_gpio_driver = {
                .name = "sch_gpio",
        },
        .probe          = sch_gpio_probe,
-       .remove         = sch_gpio_remove,
 };
 
 module_platform_driver(sch_gpio_driver);
index 50fb09080a6b5c127445de370eec00ade0490bb1..7ffd164952867a870ff06c5120462b38cf6df928 100644 (file)
@@ -165,7 +165,7 @@ static int spics_gpio_probe(struct platform_device *pdev)
        spics->chip.owner = THIS_MODULE;
        spics->last_off = -1;
 
-       ret = gpiochip_add_data(&spics->chip, spics);
+       ret = devm_gpiochip_add_data(&pdev->dev, &spics->chip, spics);
        if (ret) {
                dev_err(&pdev->dev, "unable to add gpio chip\n");
                return ret;
index 83af1cb3633379e12328c531724717391a8e6978..0d5b8c525dd9c9fb6cf31db786edd6793b822df1 100644 (file)
@@ -409,7 +409,7 @@ static int gsta_probe(struct platform_device *dev)
                goto err_free_descs;
        }
 
-       err = gpiochip_add_data(&chip->gpio, chip);
+       err = devm_gpiochip_add_data(&dev->dev, &chip->gpio, chip);
        if (err < 0) {
                dev_err(&dev->dev, "sta2x11 gpio: Can't register (%i)\n",
                        -err);
index d11dd48570b24d0f1735e4a124f57aecc13961f2..19e654f88b3ab93373df113904850bea74faad40 100644 (file)
@@ -258,7 +258,7 @@ static int xway_stp_probe(struct platform_device *pdev)
 
        ret = xway_stp_hw_init(chip);
        if (!ret)
-               ret = gpiochip_add_data(&chip->gc, chip);
+               ret = devm_gpiochip_add_data(&pdev->dev, &chip->gc, chip);
 
        if (!ret)
                dev_info(&pdev->dev, "Init done\n");
index e6cff1cabd0c3139f86c959e10cd2e8ac62d2835..d387eb524bf34ca142ebaedbff4cbb6750865d01 100644 (file)
@@ -687,7 +687,7 @@ static int sx150x_probe(struct i2c_client *client,
        if (rc < 0)
                return rc;
 
-       rc = gpiochip_add_data(&chip->gpio_chip, chip);
+       rc = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip);
        if (rc)
                return rc;
 
@@ -696,24 +696,11 @@ static int sx150x_probe(struct i2c_client *client,
                                        pdata->irq_summary,
                                        pdata->irq_base);
                if (rc < 0)
-                       goto probe_fail_post_gpiochip_add;
+                       return rc;
        }
 
        i2c_set_clientdata(client, chip);
 
-       return 0;
-probe_fail_post_gpiochip_add:
-       gpiochip_remove(&chip->gpio_chip);
-       return rc;
-}
-
-static int sx150x_remove(struct i2c_client *client)
-{
-       struct sx150x_chip *chip;
-
-       chip = i2c_get_clientdata(client);
-       gpiochip_remove(&chip->gpio_chip);
-
        return 0;
 }
 
@@ -723,7 +710,6 @@ static struct i2c_driver sx150x_driver = {
                .of_match_table = of_match_ptr(sx150x_of_match),
        },
        .probe    = sx150x_probe,
-       .remove   = sx150x_remove,
        .id_table = sx150x_id,
 };
 
index e5c5b62058863a60b36cf7aa38e0e865b29daafb..24b6d643ecdbf82188a7c136420ec6e074a9403b 100644 (file)
@@ -238,15 +238,7 @@ static int syscon_gpio_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, priv);
 
-       return gpiochip_add_data(&priv->chip, priv);
-}
-
-static int syscon_gpio_remove(struct platform_device *pdev)
-{
-       struct syscon_gpio_priv *priv = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&priv->chip);
-       return 0;
+       return devm_gpiochip_add_data(&pdev->dev, &priv->chip, priv);
 }
 
 static struct platform_driver syscon_gpio_driver = {
@@ -255,7 +247,6 @@ static struct platform_driver syscon_gpio_driver = {
                .of_match_table = syscon_gpio_ids,
        },
        .probe  = syscon_gpio_probe,
-       .remove = syscon_gpio_remove,
 };
 module_platform_driver(syscon_gpio_driver);
 
index 5eaec20ddbc784713829b06cc5dfe08ecd0d9985..80b6959ae995388a10e43fc48d418571d16db12d 100644 (file)
@@ -205,10 +205,10 @@ static int tb10x_gpio_probe(struct platform_device *pdev)
        tb10x_gpio->gc.can_sleep        = false;
 
 
-       ret = gpiochip_add_data(&tb10x_gpio->gc, tb10x_gpio);
+       ret = devm_gpiochip_add_data(&pdev->dev, &tb10x_gpio->gc, tb10x_gpio);
        if (ret < 0) {
                dev_err(&pdev->dev, "Could not add gpiochip.\n");
-               goto fail_gpiochip_registration;
+               return ret;
        }
 
        platform_set_drvdata(pdev, tb10x_gpio);
@@ -219,7 +219,7 @@ static int tb10x_gpio_probe(struct platform_device *pdev)
                ret = platform_get_irq(pdev, 0);
                if (ret < 0) {
                        dev_err(&pdev->dev, "No interrupt specified.\n");
-                       goto fail_get_irq;
+                       return ret;
                }
 
                tb10x_gpio->gc.to_irq   = tb10x_gpio_to_irq;
@@ -229,14 +229,13 @@ static int tb10x_gpio_probe(struct platform_device *pdev)
                                IRQF_TRIGGER_NONE | IRQF_SHARED,
                                dev_name(&pdev->dev), tb10x_gpio);
                if (ret != 0)
-                       goto fail_request_irq;
+                       return ret;
 
                tb10x_gpio->domain = irq_domain_add_linear(dn,
                                                tb10x_gpio->gc.ngpio,
                                                &irq_generic_chip_ops, NULL);
                if (!tb10x_gpio->domain) {
-                       ret = -ENOMEM;
-                       goto fail_irq_domain;
+                       return -ENOMEM;
                }
 
                ret = irq_alloc_domain_generic_chips(tb10x_gpio->domain,
@@ -244,7 +243,7 @@ static int tb10x_gpio_probe(struct platform_device *pdev)
                                handle_edge_irq, IRQ_NOREQUEST, IRQ_NOPROBE,
                                IRQ_GC_INIT_MASK_CACHE);
                if (ret)
-                       goto fail_irq_domain;
+                       return ret;
 
                gc = tb10x_gpio->domain->gc->gc[0];
                gc->reg_base                         = tb10x_gpio->base;
@@ -258,14 +257,6 @@ static int tb10x_gpio_probe(struct platform_device *pdev)
        }
 
        return 0;
-
-fail_irq_domain:
-fail_request_irq:
-fail_get_irq:
-       gpiochip_remove(&tb10x_gpio->gc);
-fail_gpiochip_registration:
-fail_ioremap:
-       return ret;
 }
 
 static int tb10x_gpio_remove(struct platform_device *pdev)
@@ -278,7 +269,6 @@ static int tb10x_gpio_remove(struct platform_device *pdev)
                kfree(tb10x_gpio->domain->gc);
                irq_domain_remove(tb10x_gpio->domain);
        }
-       gpiochip_remove(&tb10x_gpio->gc);
 
        return 0;
 }
index 05a27ec55addf986af28552695bad4b03a1c68b1..4f566e6b81f1210172e4d82e1da8a6ad741aa97e 100644 (file)
@@ -272,7 +272,8 @@ static int tc3589x_gpio_probe(struct platform_device *pdev)
                return ret;
        }
 
-       ret = gpiochip_add_data(&tc3589x_gpio->chip, tc3589x_gpio);
+       ret = devm_gpiochip_add_data(&pdev->dev, &tc3589x_gpio->chip,
+                                    tc3589x_gpio);
        if (ret) {
                dev_err(&pdev->dev, "unable to add gpiochip: %d\n", ret);
                return ret;
@@ -299,20 +300,10 @@ static int tc3589x_gpio_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int tc3589x_gpio_remove(struct platform_device *pdev)
-{
-       struct tc3589x_gpio *tc3589x_gpio = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&tc3589x_gpio->chip);
-
-       return 0;
-}
-
 static struct platform_driver tc3589x_gpio_driver = {
        .driver.name    = "tc3589x-gpio",
        .driver.owner   = THIS_MODULE,
        .probe          = tc3589x_gpio_probe,
-       .remove         = tc3589x_gpio_remove,
 };
 
 static int __init tc3589x_gpio_init(void)
index 9a1a7e2ef38857c1f7f6e4ff4f352f17ce4751aa..790bb111b2cbd49a52d67c80c83a357cb87a40ac 100644 (file)
@@ -545,7 +545,7 @@ static int tegra_gpio_probe(struct platform_device *pdev)
 
        tegra_gpio_chip.of_node = pdev->dev.of_node;
 
-       ret = gpiochip_add_data(&tegra_gpio_chip, NULL);
+       ret = devm_gpiochip_add_data(&pdev->dev, &tegra_gpio_chip, NULL);
        if (ret < 0) {
                irq_domain_remove(irq_domain);
                return ret;
index a6de10c5275b00b8d65b8a9f278daae46b79ed14..f0164ec43921e12625bdbd84338f26eb01ec8936 100644 (file)
@@ -279,7 +279,7 @@ static int timbgpio_probe(struct platform_device *pdev)
        gc->ngpio = pdata->nr_pins;
        gc->can_sleep = false;
 
-       err = gpiochip_add_data(gc, tgpio);
+       err = devm_gpiochip_add_data(&pdev->dev, gc, tgpio);
        if (err)
                return err;
 
@@ -320,8 +320,6 @@ static int timbgpio_remove(struct platform_device *pdev)
                irq_set_handler_data(irq, NULL);
        }
 
-       gpiochip_remove(&tgpio->gpio);
-
        return 0;
 }
 
index 87de5486a29e9d32576fc99bb502b123fa1af293..c88bdc8ee2c9da35f531a003016d46adcd74f709 100644 (file)
@@ -117,7 +117,8 @@ static int tps6586x_gpio_probe(struct platform_device *pdev)
        else
                tps6586x_gpio->gpio_chip.base = -1;
 
-       ret = gpiochip_add_data(&tps6586x_gpio->gpio_chip, tps6586x_gpio);
+       ret = devm_gpiochip_add_data(&pdev->dev, &tps6586x_gpio->gpio_chip,
+                                    tps6586x_gpio);
        if (ret < 0) {
                dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);
                return ret;
@@ -128,19 +129,10 @@ static int tps6586x_gpio_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int tps6586x_gpio_remove(struct platform_device *pdev)
-{
-       struct tps6586x_gpio *tps6586x_gpio = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&tps6586x_gpio->gpio_chip);
-       return 0;
-}
-
 static struct platform_driver tps6586x_gpio_driver = {
        .driver.name    = "tps6586x-gpio",
        .driver.owner   = THIS_MODULE,
        .probe          = tps6586x_gpio_probe,
-       .remove         = tps6586x_gpio_remove,
 };
 
 static int __init tps6586x_gpio_init(void)
index e81eee7627a36dd5e67039707947e192504841f3..cdbd7c7400432bcaa151bae36bd6c5207bcb0bf3 100644 (file)
@@ -170,7 +170,8 @@ static int tps65910_gpio_probe(struct platform_device *pdev)
        }
 
 skip_init:
-       ret = gpiochip_add_data(&tps65910_gpio->gpio_chip, tps65910_gpio);
+       ret = devm_gpiochip_add_data(&pdev->dev, &tps65910_gpio->gpio_chip,
+                                    tps65910_gpio);
        if (ret < 0) {
                dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);
                return ret;
@@ -181,19 +182,10 @@ skip_init:
        return ret;
 }
 
-static int tps65910_gpio_remove(struct platform_device *pdev)
-{
-       struct tps65910_gpio *tps65910_gpio = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&tps65910_gpio->gpio_chip);
-       return 0;
-}
-
 static struct platform_driver tps65910_gpio_driver = {
        .driver.name    = "tps65910-gpio",
        .driver.owner   = THIS_MODULE,
        .probe          = tps65910_gpio_probe,
-       .remove         = tps65910_gpio_remove,
 };
 
 static int __init tps65910_gpio_init(void)
index 4f2029c7da3a8dcc37819e998d22fa849c37ed35..e72302d2461acf80bda722c21ff2d7027376e2e7 100644 (file)
@@ -106,7 +106,8 @@ static int tps65912_gpio_probe(struct platform_device *pdev)
        if (pdata && pdata->gpio_base)
                tps65912_gpio->gpio_chip.base = pdata->gpio_base;
 
-       ret = gpiochip_add_data(&tps65912_gpio->gpio_chip, tps65912_gpio);
+       ret = devm_gpiochip_add_data(&pdev->dev, &tps65912_gpio->gpio_chip,
+                                    tps65912_gpio);
        if (ret < 0) {
                dev_err(&pdev->dev, "Failed to register gpiochip, %d\n", ret);
                return ret;
@@ -117,20 +118,11 @@ static int tps65912_gpio_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int tps65912_gpio_remove(struct platform_device *pdev)
-{
-       struct tps65912_gpio_data  *tps65912_gpio = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&tps65912_gpio->gpio_chip);
-       return 0;
-}
-
 static struct platform_driver tps65912_gpio_driver = {
        .driver = {
                .name = "tps65912-gpio",
        },
        .probe = tps65912_gpio_probe,
-       .remove = tps65912_gpio_remove,
 };
 
 static int __init tps65912_gpio_init(void)
index 1478245542537f95d187d2fa195c8f08cffd5995..0c144a72f9af2281b9dc8a151728e2574d57d4e3 100644 (file)
@@ -58,16 +58,7 @@ static int ts4800_gpio_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, chip);
 
-       return gpiochip_add_data(chip, NULL);
-}
-
-static int ts4800_gpio_remove(struct platform_device *pdev)
-{
-       struct gpio_chip *chip = platform_get_drvdata(pdev);
-
-       gpiochip_remove(chip);
-
-       return 0;
+       return devm_gpiochip_add_data(&pdev->dev, chip, NULL);
 }
 
 static const struct of_device_id ts4800_gpio_of_match[] = {
@@ -81,7 +72,6 @@ static struct platform_driver ts4800_gpio_driver = {
                   .of_match_table = ts4800_gpio_of_match,
                   },
        .probe = ts4800_gpio_probe,
-       .remove = ts4800_gpio_remove,
 };
 
 module_platform_driver_probe(ts4800_gpio_driver, ts4800_gpio_probe);
index 5f945083f9d8c8f699fce925fe403e4ed54f626c..6cfeba07f8820aa858c637e947f5508af2aef05d 100644 (file)
@@ -409,7 +409,7 @@ static int ts5500_dio_probe(struct platform_device *pdev)
                break;
        }
 
-       ret = gpiochip_add_data(&priv->gpio_chip, priv);
+       ret = devm_gpiochip_add_data(dev, &priv->gpio_chip, priv);
        if (ret) {
                dev_err(dev, "failed to register the gpio chip\n");
                return ret;
@@ -418,13 +418,10 @@ static int ts5500_dio_probe(struct platform_device *pdev)
        ret = ts5500_enable_irq(priv);
        if (ret) {
                dev_err(dev, "invalid interrupt %d\n", priv->hwirq);
-               goto cleanup;
+               return ret;
        }
 
        return 0;
-cleanup:
-       gpiochip_remove(&priv->gpio_chip);
-       return ret;
 }
 
 static int ts5500_dio_remove(struct platform_device *pdev)
@@ -432,7 +429,7 @@ static int ts5500_dio_remove(struct platform_device *pdev)
        struct ts5500_priv *priv = platform_get_drvdata(pdev);
 
        ts5500_disable_irq(priv);
-       gpiochip_remove(&priv->gpio_chip);
+
        return 0;
 }
 
index 8e9e9853f3bd4c9f92985a650dc07452bb0b72bd..b780314cdfc9a048c91db99922feb25bb15fe5ac 100644 (file)
@@ -100,7 +100,7 @@ static int gpo_twl6040_probe(struct platform_device *pdev)
        twl6040gpo_chip.of_node = twl6040_core_dev->of_node;
 #endif
 
-       ret = gpiochip_add_data(&twl6040gpo_chip, NULL);
+       ret = devm_gpiochip_add_data(&pdev->dev, &twl6040gpo_chip, NULL);
        if (ret < 0) {
                dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret);
                twl6040gpo_chip.ngpio = 0;
@@ -109,12 +109,6 @@ static int gpo_twl6040_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int gpo_twl6040_remove(struct platform_device *pdev)
-{
-       gpiochip_remove(&twl6040gpo_chip);
-       return 0;
-}
-
 /* Note:  this hardware lives inside an I2C-based multi-function device. */
 MODULE_ALIAS("platform:twl6040-gpo");
 
@@ -123,7 +117,6 @@ static struct platform_driver gpo_twl6040_driver = {
                .name   = "twl6040-gpo",
        },
        .probe          = gpo_twl6040_probe,
-       .remove         = gpo_twl6040_remove,
 };
 
 module_platform_driver(gpo_twl6040_driver);
index 2c5cd46bfa6ea62538714d07aa38b0b358e42ebb..5dbe31bf66991891e4c7f3dbf37afd961c6d3da8 100644 (file)
@@ -67,7 +67,7 @@ static int ucb1400_gpio_probe(struct platform_device *dev)
        ucb->gc.set = ucb1400_gpio_set;
        ucb->gc.can_sleep = true;
 
-       err = gpiochip_add_data(&ucb->gc, ucb);
+       err = devm_gpiochip_add_data(&dev->dev, &ucb->gc, ucb);
        if (err)
                goto err;
 
@@ -90,7 +90,6 @@ static int ucb1400_gpio_remove(struct platform_device *dev)
                        return err;
        }
 
-       gpiochip_remove(&ucb->gc);
        return err;
 }
 
index 1170b035cb924253c3d0bfa47bbbd8ba194b1231..dec47aafd5cda0d9ed78ed96c1de23f0e17642f5 100644 (file)
@@ -410,10 +410,10 @@ static int vprbrd_gpio_probe(struct platform_device *pdev)
        vb_gpio->gpioa.get = vprbrd_gpioa_get;
        vb_gpio->gpioa.direction_input = vprbrd_gpioa_direction_input;
        vb_gpio->gpioa.direction_output = vprbrd_gpioa_direction_output;
-       ret = gpiochip_add_data(&vb_gpio->gpioa, vb_gpio);
+       ret = devm_gpiochip_add_data(&pdev->dev, &vb_gpio->gpioa, vb_gpio);
        if (ret < 0) {
                dev_err(vb_gpio->gpioa.parent, "could not add gpio a");
-               goto err_gpioa;
+               return ret;
        }
 
        /* registering gpio b */
@@ -427,37 +427,21 @@ static int vprbrd_gpio_probe(struct platform_device *pdev)
        vb_gpio->gpiob.get = vprbrd_gpiob_get;
        vb_gpio->gpiob.direction_input = vprbrd_gpiob_direction_input;
        vb_gpio->gpiob.direction_output = vprbrd_gpiob_direction_output;
-       ret = gpiochip_add_data(&vb_gpio->gpiob, vb_gpio);
+       ret = devm_gpiochip_add_data(&pdev->dev, &vb_gpio->gpiob, vb_gpio);
        if (ret < 0) {
                dev_err(vb_gpio->gpiob.parent, "could not add gpio b");
-               goto err_gpiob;
+               return ret;
        }
 
        platform_set_drvdata(pdev, vb_gpio);
 
        return ret;
-
-err_gpiob:
-       gpiochip_remove(&vb_gpio->gpioa);
-
-err_gpioa:
-       return ret;
-}
-
-static int vprbrd_gpio_remove(struct platform_device *pdev)
-{
-       struct vprbrd_gpio *vb_gpio = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&vb_gpio->gpiob);
-
-       return 0;
 }
 
 static struct platform_driver vprbrd_gpio_driver = {
        .driver.name    = "viperboard-gpio",
        .driver.owner   = THIS_MODULE,
        .probe          = vprbrd_gpio_probe,
-       .remove         = vprbrd_gpio_remove,
 };
 
 static int __init vprbrd_gpio_init(void)
index 764999cc0794f8ca41e6f81830caf31fa7c0989b..8cdb9f7ec7e0673a1965505d81e0590e39363bb2 100644 (file)
@@ -259,16 +259,7 @@ static int vx855gpio_probe(struct platform_device *pdev)
 
        vx855gpio_gpio_setup(vg);
 
-       return gpiochip_add_data(&vg->gpio, vg);
-}
-
-static int vx855gpio_remove(struct platform_device *pdev)
-{
-       struct vx855_gpio *vg = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&vg->gpio);
-
-       return 0;
+       return devm_gpiochip_add_data(&pdev->dev, &vg->gpio, vg);
 }
 
 static struct platform_driver vx855gpio_driver = {
@@ -276,7 +267,6 @@ static struct platform_driver vx855gpio_driver = {
                .name   = MODULE_NAME,
        },
        .probe          = vx855gpio_probe,
-       .remove         = vx855gpio_remove,
 };
 
 module_platform_driver(vx855gpio_driver);
index 98390070fb6451f667b6dcc8e8a35bbddb034004..18cb0f534b917fe4e13fdcdedce1c14d0511bd83 100644 (file)
@@ -259,7 +259,8 @@ static int wm831x_gpio_probe(struct platform_device *pdev)
        else
                wm831x_gpio->gpio_chip.base = -1;
 
-       ret = gpiochip_add_data(&wm831x_gpio->gpio_chip, wm831x_gpio);
+       ret = devm_gpiochip_add_data(&pdev->dev, &wm831x_gpio->gpio_chip,
+                                    wm831x_gpio);
        if (ret < 0) {
                dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);
                return ret;
@@ -270,19 +271,10 @@ static int wm831x_gpio_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int wm831x_gpio_remove(struct platform_device *pdev)
-{
-       struct wm831x_gpio *wm831x_gpio = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&wm831x_gpio->gpio_chip);
-       return 0;
-}
-
 static struct platform_driver wm831x_gpio_driver = {
        .driver.name    = "wm831x-gpio",
        .driver.owner   = THIS_MODULE,
        .probe          = wm831x_gpio_probe,
-       .remove         = wm831x_gpio_remove,
 };
 
 static int __init wm831x_gpio_init(void)
index 0a306b4baa73358207ae5e23688fb6173974d77d..07d45a3b205aeb4aba91c1fa9bb83df6f26eec67 100644 (file)
@@ -125,7 +125,8 @@ static int wm8350_gpio_probe(struct platform_device *pdev)
        else
                wm8350_gpio->gpio_chip.base = -1;
 
-       ret = gpiochip_add_data(&wm8350_gpio->gpio_chip, wm8350_gpio);
+       ret = devm_gpiochip_add_data(&pdev->dev, &wm8350_gpio->gpio_chip,
+                                    wm8350_gpio);
        if (ret < 0) {
                dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);
                return ret;
@@ -136,19 +137,10 @@ static int wm8350_gpio_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int wm8350_gpio_remove(struct platform_device *pdev)
-{
-       struct wm8350_gpio_data *wm8350_gpio = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&wm8350_gpio->gpio_chip);
-       return 0;
-}
-
 static struct platform_driver wm8350_gpio_driver = {
        .driver.name    = "wm8350-gpio",
        .driver.owner   = THIS_MODULE,
        .probe          = wm8350_gpio_probe,
-       .remove         = wm8350_gpio_remove,
 };
 
 static int __init wm8350_gpio_init(void)
index 3ae4c15974942af790ed09dcea399d770482419e..b089df99a0d0824b766b1b91690c5c140b9e58d1 100644 (file)
@@ -261,34 +261,23 @@ static int wm8994_gpio_probe(struct platform_device *pdev)
        else
                wm8994_gpio->gpio_chip.base = -1;
 
-       ret = gpiochip_add_data(&wm8994_gpio->gpio_chip, wm8994_gpio);
+       ret = devm_gpiochip_add_data(&pdev->dev, &wm8994_gpio->gpio_chip,
+                                    wm8994_gpio);
        if (ret < 0) {
                dev_err(&pdev->dev, "Could not register gpiochip, %d\n",
                        ret);
-               goto err;
+               return ret;
        }
 
        platform_set_drvdata(pdev, wm8994_gpio);
 
        return ret;
-
-err:
-       return ret;
-}
-
-static int wm8994_gpio_remove(struct platform_device *pdev)
-{
-       struct wm8994_gpio *wm8994_gpio = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&wm8994_gpio->gpio_chip);
-       return 0;
 }
 
 static struct platform_driver wm8994_gpio_driver = {
        .driver.name    = "wm8994-gpio",
        .driver.owner   = THIS_MODULE,
        .probe          = wm8994_gpio_probe,
-       .remove         = wm8994_gpio_remove,
 };
 
 static int __init wm8994_gpio_init(void)
index fd81ebc8d36560facf955d9d0ee8fa5f59412f55..31cbcb84cfafef46e0a6a8d7725ebec25a4bbfd1 100644 (file)
@@ -311,7 +311,7 @@ static int xgene_gpio_sb_probe(struct platform_device *pdev)
 
        priv->gc.irqdomain = priv->irq_domain;
 
-       ret = gpiochip_add_data(&priv->gc, priv);
+       ret = devm_gpiochip_add_data(&pdev->dev, &priv->gc, priv);
        if (ret) {
                dev_err(&pdev->dev,
                        "failed to register X-Gene GPIO Standby driver\n");
@@ -339,7 +339,6 @@ static int xgene_gpio_sb_remove(struct platform_device *pdev)
 
        irq_domain_remove(priv->irq_domain);
 
-       gpiochip_remove(&priv->gc);
        return 0;
 }
 
index 592e9cdf9c5387d270c54a1af2d1c3f57fac8058..c0aa387664bf50bda637a928574c0667f5b76a43 100644 (file)
@@ -193,7 +193,7 @@ static int xgene_gpio_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, gpio);
 
-       err = gpiochip_add_data(&gpio->chip, gpio);
+       err = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio);
        if (err) {
                dev_err(&pdev->dev,
                        "failed to register gpiochip.\n");
@@ -207,14 +207,6 @@ err:
        return err;
 }
 
-static int xgene_gpio_remove(struct platform_device *pdev)
-{
-       struct xgene_gpio *gpio = platform_get_drvdata(pdev);
-
-       gpiochip_remove(&gpio->chip);
-       return 0;
-}
-
 static const struct of_device_id xgene_gpio_of_match[] = {
        { .compatible = "apm,xgene-gpio", },
        {},
@@ -228,7 +220,6 @@ static struct platform_driver xgene_gpio_driver = {
                .pm     = XGENE_GPIO_PM_OPS,
        },
        .probe = xgene_gpio_probe,
-       .remove = xgene_gpio_remove,
 };
 
 module_platform_driver(xgene_gpio_driver);
index 872774a404f1752549753975082298e2381315c7..e31d0a1e6f7c941677440525cb70cf2703c50716 100644 (file)
@@ -723,6 +723,80 @@ void gpiochip_remove(struct gpio_chip *chip)
 }
 EXPORT_SYMBOL_GPL(gpiochip_remove);
 
+static void devm_gpio_chip_release(struct device *dev, void *res)
+{
+       struct gpio_chip *chip = *(struct gpio_chip **)res;
+
+       gpiochip_remove(chip);
+}
+
+static int devm_gpio_chip_match(struct device *dev, void *res, void *data)
+
+{
+       struct gpio_chip **r = res;
+
+       if (!r || !*r) {
+               WARN_ON(!r || !*r);
+               return 0;
+       }
+
+       return *r == data;
+}
+
+/**
+ * devm_gpiochip_add_data() - Resource manager piochip_add_data()
+ * @dev: the device pointer on which irq_chip belongs to.
+ * @chip: the chip to register, with chip->base initialized
+ * Context: potentially before irqs will work
+ *
+ * Returns a negative errno if the chip can't be registered, such as
+ * because the chip->base is invalid or already associated with a
+ * different chip.  Otherwise it returns zero as a success code.
+ *
+ * The gpio chip automatically be released when the device is unbound.
+ */
+int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *chip,
+                          void *data)
+{
+       struct gpio_chip **ptr;
+       int ret;
+
+       ptr = devres_alloc(devm_gpio_chip_release, sizeof(*ptr),
+                            GFP_KERNEL);
+       if (!ptr)
+               return -ENOMEM;
+
+       ret = gpiochip_add_data(chip, data);
+       if (ret < 0) {
+               devres_free(ptr);
+               return ret;
+       }
+
+       *ptr = chip;
+       devres_add(dev, ptr);
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(devm_gpiochip_add_data);
+
+/**
+ * devm_gpiochip_remove() - Resource manager of gpiochip_remove()
+ * @dev: device for which which resource was allocated
+ * @chip: the chip to remove
+ *
+ * A gpio_chip with any GPIOs still requested may not be removed.
+ */
+void devm_gpiochip_remove(struct device *dev, struct gpio_chip *chip)
+{
+       int ret;
+
+       ret = devres_release(dev, devm_gpio_chip_release,
+                            devm_gpio_chip_match, chip);
+       if (!ret)
+               WARN_ON(ret);
+}
+EXPORT_SYMBOL_GPL(devm_gpiochip_remove);
+
 /**
  * gpiochip_find() - iterator for locating a specific gpio_chip
  * @data: data to pass to match function
index 639607658ed892ce35e259a3f5fcf1c44540b35d..bee976f827889d1b7261d44dde499ccaadac5d71 100644 (file)
@@ -192,6 +192,10 @@ static inline int gpiochip_add(struct gpio_chip *chip)
        return gpiochip_add_data(chip, NULL);
 }
 extern void gpiochip_remove(struct gpio_chip *chip);
+extern int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *chip,
+                                 void *data);
+extern void devm_gpiochip_remove(struct device *dev, struct gpio_chip *chip);
+
 extern struct gpio_chip *gpiochip_find(void *data,
                              int (*match)(struct gpio_chip *chip, void *data));
 
This page took 0.060835 seconds and 5 git commands to generate.