Commit da238221 authored by Ricardo Ribalda Delgado's avatar Ricardo Ribalda Delgado Committed by Linus Walleij

gpio: gpio-mm-lantiq: Use of_mm_gpiochip_remove

Since d621e8ba (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: Alexandre Courbot <gnurou@gmail.com>
Cc: John Crispin <blogic@openwrt.org>
Signed-off-by: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 68a99b18
...@@ -111,6 +111,8 @@ static int ltq_mm_probe(struct platform_device *pdev) ...@@ -111,6 +111,8 @@ static int ltq_mm_probe(struct platform_device *pdev)
if (!chip) if (!chip)
return -ENOMEM; return -ENOMEM;
platform_set_drvdata(pdev, chip);
chip->mmchip.gc.ngpio = 16; chip->mmchip.gc.ngpio = 16;
chip->mmchip.gc.direction_output = ltq_mm_dir_out; chip->mmchip.gc.direction_output = ltq_mm_dir_out;
chip->mmchip.gc.set = ltq_mm_set; chip->mmchip.gc.set = ltq_mm_set;
...@@ -123,6 +125,15 @@ static int ltq_mm_probe(struct platform_device *pdev) ...@@ -123,6 +125,15 @@ static int ltq_mm_probe(struct platform_device *pdev)
return of_mm_gpiochip_add(pdev->dev.of_node, &chip->mmchip); return of_mm_gpiochip_add(pdev->dev.of_node, &chip->mmchip);
} }
static int ltq_mm_remove(struct platform_device *pdev)
{
struct ltq_mm *chip = platform_get_drvdata(pdev);
of_mm_gpiochip_remove(&chip->mmchip);
return 0;
}
static const struct of_device_id ltq_mm_match[] = { static const struct of_device_id ltq_mm_match[] = {
{ .compatible = "lantiq,gpio-mm" }, { .compatible = "lantiq,gpio-mm" },
{}, {},
...@@ -131,6 +142,7 @@ MODULE_DEVICE_TABLE(of, ltq_mm_match); ...@@ -131,6 +142,7 @@ MODULE_DEVICE_TABLE(of, ltq_mm_match);
static struct platform_driver ltq_mm_driver = { static struct platform_driver ltq_mm_driver = {
.probe = ltq_mm_probe, .probe = ltq_mm_probe,
.remove = ltq_mm_remove,
.driver = { .driver = {
.name = "gpio-mm-ltq", .name = "gpio-mm-ltq",
.of_match_table = ltq_mm_match, .of_match_table = ltq_mm_match,
...@@ -143,3 +155,9 @@ static int __init ltq_mm_init(void) ...@@ -143,3 +155,9 @@ static int __init ltq_mm_init(void)
} }
subsys_initcall(ltq_mm_init); subsys_initcall(ltq_mm_init);
static void __exit ltq_mm_exit(void)
{
platform_driver_unregister(&ltq_mm_driver);
}
module_exit(ltq_mm_exit);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment