Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f890cf0 authored by Alban Bedel's avatar Alban Bedel Committed by Linus Walleij
Browse files

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: default avatarAlban Bedel <albeu@free.fr>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 409d8783
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -46,6 +46,7 @@ static int ath79_gpio_probe(struct platform_device *pdev)
	ctrl = devm_kzalloc(&pdev->dev, sizeof(*ctrl), GFP_KERNEL);
	ctrl = devm_kzalloc(&pdev->dev, sizeof(*ctrl), GFP_KERNEL);
	if (!ctrl)
	if (!ctrl)
		return -ENOMEM;
		return -ENOMEM;
	platform_set_drvdata(pdev, ctrl);


	if (np) {
	if (np) {
		err = of_property_read_u32(np, "ngpios", &ath79_gpio_count);
		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;
	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 = {
static struct platform_driver ath79_gpio_driver = {
	.driver = {
	.driver = {
		.name = "ath79-gpio",
		.name = "ath79-gpio",
		.of_match_table	= ath79_gpio_of_match,
		.of_match_table	= ath79_gpio_of_match,
	},
	},
	.probe = ath79_gpio_probe,
	.probe = ath79_gpio_probe,
	.remove = ath79_gpio_remove,
};
};


module_platform_driver(ath79_gpio_driver);
module_platform_driver(ath79_gpio_driver);