linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alban Bedel <albeu@free.fr>
To: linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>, Alban Bedel <albeu@free.fr>
Subject: [PATCH 3/3] gpio: ath79: Make the driver removable
Date: Fri, 30 Oct 2015 11:36:31 +0100	[thread overview]
Message-ID: <1446201391-22553-3-git-send-email-albeu@free.fr> (raw)
In-Reply-To: <1446201391-22553-1-git-send-email-albeu@free.fr>

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(+)

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);
-- 
2.0.0

  parent reply	other threads:[~2015-10-30 10:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-30 10:36 [PATCH 1/3] MAINTAINERS: Add an entry for the ATH79 GPIO driver Alban Bedel
2015-10-30 10:36 ` [PATCH 2/3] gpio: ath79: Move to the generic " Alban Bedel
2015-10-30 11:42   ` kbuild test robot
2015-10-31 21:02   ` Linus Walleij
2015-11-01 17:46     ` Alban
2015-11-02  8:30       ` Linus Walleij
2015-10-30 10:36 ` Alban Bedel [this message]
2015-10-31 21:03   ` [PATCH 3/3] gpio: ath79: Make the driver removable Linus Walleij
2015-10-31 20:56 ` [PATCH 1/3] MAINTAINERS: Add an entry for the ATH79 GPIO driver Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1446201391-22553-3-git-send-email-albeu@free.fr \
    --to=albeu@free.fr \
    --cc=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).