From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>,
Sascha Hauer <s.hauer@pengutronix.de>
Subject: [PATCH 1/8] gpio/mpc5200: Use of_mm_gpiochip_remove
Date: Sun, 18 Jan 2015 12:39:26 +0100 [thread overview]
Message-ID: <1421581173-28416-2-git-send-email-ricardo.ribalda@gmail.com> (raw)
In-Reply-To: <1421581173-28416-1-git-send-email-ricardo.ribalda@gmail.com>
Since d621e8bae5ac9c67 (Create of_mm_gpiochip_remove), there is a
counterpart for of_mm_gpiochip_add.
This patch implements the remove function of the driver making use of
it.
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
drivers/gpio/gpio-mpc5200.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-mpc5200.c b/drivers/gpio/gpio-mpc5200.c
index 8ce6c95..4c54215 100644
--- a/drivers/gpio/gpio-mpc5200.c
+++ b/drivers/gpio/gpio-mpc5200.c
@@ -155,10 +155,12 @@ static int mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev)
struct gpio_chip *gc;
int ret;
- chip = kzalloc(sizeof(*chip), GFP_KERNEL);
+ chip = devm_kzalloc(&ofdev->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;
+ platform_set_drvdata(ofdev, chip);
+
gc = &chip->mmchip.gc;
gc->ngpio = 8;
@@ -181,7 +183,11 @@ static int mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev)
static int mpc52xx_gpiochip_remove(struct platform_device *ofdev)
{
- return -EBUSY;
+ struct mpc52xx_gpiochip *chip = platform_get_drvdata(ofdev);
+
+ of_mm_gpiochip_remove(&chip->mmchip);
+
+ return 0;
}
static const struct of_device_id mpc52xx_wkup_gpiochip_match[] = {
@@ -314,10 +320,12 @@ static int mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev)
struct mpc52xx_gpio __iomem *regs;
int ret;
- chip = kzalloc(sizeof(*chip), GFP_KERNEL);
+ chip = devm_kzalloc(&ofdev->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;
+ platform_set_drvdata(ofdev, chip);
+
gc = &chip->mmchip.gc;
gc->ngpio = 32;
@@ -363,11 +371,16 @@ static int __init mpc52xx_gpio_init(void)
return 0;
}
-
/* Make sure we get initialised before anyone else tries to use us */
subsys_initcall(mpc52xx_gpio_init);
-/* No exit call at the moment as we cannot unregister of gpio chips */
+static void __exit mpc52xx_gpio_exit(void)
+{
+ platform_driver_unregister(&mpc52xx_wkup_gpiochip_driver);
+
+ platform_driver_unregister(&mpc52xx_simple_gpiochip_driver);
+}
+module_exit(mpc52xx_gpio_exit);
MODULE_DESCRIPTION("Freescale MPC52xx gpio driver");
MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de");
--
2.1.4
next prev parent reply other threads:[~2015-01-18 11:41 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-18 11:39 [PATCH 0/8] " Ricardo Ribalda Delgado
2015-01-18 11:39 ` Ricardo Ribalda Delgado [this message]
2015-01-20 10:06 ` [PATCH 1/8] gpio/mpc5200: " Linus Walleij
2015-01-18 11:39 ` [PATCH 2/8] gpio/-mm-lantiq: Use devm_kzalloc Ricardo Ribalda Delgado
2015-01-20 10:07 ` Linus Walleij
2015-01-18 11:39 ` [PATCH 3/8] gpio/mm-lantiq: Do not replicate code Ricardo Ribalda Delgado
2015-01-20 10:09 ` Linus Walleij
2015-01-18 11:39 ` [PATCH 4/8] gpio-mm-lantiq: Use of_propery_read_u16 Ricardo Ribalda Delgado
2015-01-19 10:57 ` Mark Rutland
2015-01-19 11:27 ` [PATCH v2 4/8] gpio-mm-lantiq: Use of_property_read_u32 Ricardo Ribalda Delgado
2015-01-20 10:10 ` Linus Walleij
2015-01-19 11:28 ` [PATCH 4/8] gpio-mm-lantiq: Use of_propery_read_u16 Ricardo Ribalda Delgado
2015-01-18 11:39 ` [PATCH 5/8] gpio/gpio-mm-lantiq: Use of_mm_gpiochip_remove Ricardo Ribalda Delgado
2015-01-18 11:39 ` [PATCH 6/8] gpio/zevio: " Ricardo Ribalda Delgado
2015-01-18 11:39 ` [PATCH 7/8] gpio/mpc8xxx: Convert to platform device interface Ricardo Ribalda Delgado
2015-01-19 22:36 ` Peter Korsgaard
2015-01-19 22:48 ` Peter Korsgaard
2015-01-19 23:37 ` Ricardo Ribalda Delgado
2015-01-20 10:41 ` Peter Korsgaard
2015-01-20 10:54 ` Ricardo Ribalda Delgado
2015-01-20 2:03 ` Alexandre Courbot
2015-01-20 10:15 ` Linus Walleij
2015-01-18 11:39 ` [PATCH 8/8] gpio/mpc8xxx: Use of_mm_gpiochip_remove Ricardo Ribalda Delgado
2015-01-19 22:52 ` Peter Korsgaard
2015-01-19 23:10 ` Ricardo Ribalda Delgado
2015-01-20 10:40 ` Peter Korsgaard
2015-01-20 10:17 ` Linus Walleij
2015-01-20 10:31 ` Ricardo Ribalda Delgado
2015-01-21 16:45 ` 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=1421581173-28416-2-git-send-email-ricardo.ribalda@gmail.com \
--to=ricardo.ribalda@gmail.com \
--cc=gnurou@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
/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
all inboxes | Powered by JetHome®