Skip to content

Commit

Permalink
gpio: ath79: Make the driver removable
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alban Bedel authored and Linus Walleij committed Feb 10, 2016
1 parent 409d878 commit 2f890cf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/gpio/gpio-ath79.c
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 2f890cf

Please sign in to comment.