This adds remove function in at91_gpio_driver platform_driver so that
driver can be unloaded cleanly.

CC: Jean-Christophe Plagniol-Villard <plagn...@jcrosoft.com>
CC: Linus Walleij <linus.wall...@linaro.org>
Signed-off-by: Pramod Gurav <pramod.gu...@smartplayin.com>
---
 drivers/pinctrl/pinctrl-at91.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 8b8772c..92641b6 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -1646,6 +1646,7 @@ static int at91_gpio_probe(struct platform_device *pdev)
        if (ret)
                goto irq_setup_err;
 
+       platform_set_drvdata(pdev, at91_chip);
        dev_info(&pdev->dev, "at address %p\n", at91_chip->regbase);
 
        return 0;
@@ -1663,6 +1664,17 @@ err:
        return ret;
 }
 
+static int at91_gpio_remove(struct platform_device *pdev)
+{
+       struct at91_gpio_chip *at91_chip = platform_get_drvdata(pdev);
+
+       gpiochip_remove(&at91_chip->chip);
+       clk_disable(at91_chip->clock);
+       clk_unprepare(at91_chip->clock);
+
+       return 0;
+}
+
 static struct platform_driver at91_gpio_driver = {
        .driver = {
                .name = "gpio-at91",
@@ -1670,6 +1682,7 @@ static struct platform_driver at91_gpio_driver = {
                .of_match_table = at91_gpio_of_match,
        },
        .probe = at91_gpio_probe,
+       .remove = at91_gpio_remove,
 };
 
 static struct platform_driver at91_pinctrl_driver = {
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to