Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1320992

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

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Alban Bedel <albeu@free.fr>
Newsgroups linux.kernel
Subject [PATCH 3/5] gpio: ath79: Make the driver removable
Date Thu, 28 Jan 2016 20:50:04 +0100
Message-ID <qW0JS-8ef-57@gated-at.bofh.it> (permalink)
References <qW0JP-8ef-3@gated-at.bofh.it>
X-Original-To linux-gpio@vger.kernel.org
X-Mailer git-send-email 2.0.0
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 44
Organization linux.* mail to news gateway
X-Original-Cc Linus Walleij <linus.walleij@linaro.org>, Alexandre Courbot <gnurou@gmail.com>, Antony Pavlov <antonynpavlov@gmail.com>, Gabor Juhos <juhosg@openwrt.org>, linux-kernel@vger.kernel.org, Alban Bedel <albeu@free.fr>
X-Original-Date Thu, 28 Jan 2016 20:44:31 +0100
X-Original-Message-ID <1454010273-21513-3-git-send-email-albeu@free.fr>
X-Original-References <1454010273-21513-1-git-send-email-albeu@free.fr>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1320992

Show key headers only | View raw


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 | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpio/gpio-ath79.c b/drivers/gpio/gpio-ath79.c
index afb535e..6b15792 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);
-- 
2.0.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/5] gpio: ath79: Move to the generic GPIO driver Alban Bedel <albeu@free.fr> - 2016-01-28 20:50 +0100
  [PATCH 5/5] gpio: ath79: Update the copyright notice Alban Bedel <albeu@free.fr> - 2016-01-28 20:50 +0100
  [PATCH 3/5] gpio: ath79: Make the driver removable Alban Bedel <albeu@free.fr> - 2016-01-28 20:50 +0100
    Re: [PATCH 3/5] gpio: ath79: Make the driver removable Alexandre Courbot <gnurou@gmail.com> - 2016-02-08 04:10 +0100
  Re: [PATCH 1/5] gpio: ath79: Move to the generic GPIO driver Alexandre Courbot <gnurou@gmail.com> - 2016-02-08 04:00 +0100

csiph-web