diff mbox

[3/3] gpio: ath79: Make the driver removable

Message ID 1446201391-22553-3-git-send-email-albeu@free.fr
State New
Headers show

Commit Message

Alban Oct. 30, 2015, 10:36 a.m. UTC
As we now allow the driver to be built as a module it should be
removable.

Signed-off-by: Alban Bedel <albeu@free.fr>
---
 drivers/gpio/gpio-ath79.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Linus Walleij Oct. 31, 2015, 9:03 p.m. UTC | #1
On Fri, Oct 30, 2015 at 11:36 AM, Alban Bedel <albeu@free.fr> wrote:

> As we now allow the driver to be built as a module it should be
> removable.
>
> Signed-off-by: Alban Bedel <albeu@free.fr>

Looks good but needs rebasing on top of the rebased 2/3.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/gpio/gpio-ath79.c b/drivers/gpio/gpio-ath79.c
index 3e71ced..6108dff 100644
--- a/drivers/gpio/gpio-ath79.c
+++ b/drivers/gpio/gpio-ath79.c
@@ -43,6 +43,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,20 @@  static int ath79_gpio_probe(struct platform_device *pdev)
 	return 0;
 }
 
+static int ath79_gpio_remove(struct platform_device *pdev)
+{
+	struct ath79_gpio *ctrl = platform_get_drvdata(pdev);
+
+	return bgpio_remove(&ctrl->bgc);
+}
+
 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);