diff options
author | Alban Bedel <albeu@free.fr> | 2016-01-28 20:44:31 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-02-10 11:14:08 +0100 |
commit | 2f890cf0dfe421ecd2095d8cabb89e7207b499ee (patch) | |
tree | 1e99db71b424bf8e53a2c54785d16a5308578d0b /drivers/gpio/gpio-ath79.c | |
parent | 409d87838d5755b471933fb2a43f2dfc514ccd2d (diff) | |
download | linux-2f890cf0dfe421ecd2095d8cabb89e7207b499ee.tar.gz linux-2f890cf0dfe421ecd2095d8cabb89e7207b499ee.tar.bz2 linux-2f890cf0dfe421ecd2095d8cabb89e7207b499ee.zip |
gpio: ath79: Make the driver removable
As we now allow the driver to be built as a module it should be
removable.
Signed-off-by: Alban Bedel <albeu@free.fr>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-ath79.c')
-rw-r--r-- | drivers/gpio/gpio-ath79.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-ath79.c b/drivers/gpio/gpio-ath79.c index afb535eef9f3..6b157925e16e 100644 --- a/drivers/gpio/gpio-ath79.c +++ b/drivers/gpio/gpio-ath79.c @@ -46,6 +46,7 @@ static int ath79_gpio_probe(struct platform_device *pdev) ctrl = devm_kzalloc(&pdev->dev, sizeof(*ctrl), GFP_KERNEL); if (!ctrl) return -ENOMEM; + platform_set_drvdata(pdev, ctrl); if (np) { err = of_property_read_u32(np, "ngpios", &ath79_gpio_count); @@ -97,12 +98,21 @@ static int ath79_gpio_probe(struct platform_device *pdev) return 0; } +static int ath79_gpio_remove(struct platform_device *pdev) +{ + struct ath79_gpio_ctrl *ctrl = platform_get_drvdata(pdev); + + gpiochip_remove(&ctrl->gc); + return 0; +} + static struct platform_driver ath79_gpio_driver = { .driver = { .name = "ath79-gpio", .of_match_table = ath79_gpio_of_match, }, .probe = ath79_gpio_probe, + .remove = ath79_gpio_remove, }; module_platform_driver(ath79_gpio_driver); |