Skip to content

Commit

Permalink
gpio: gpio-mm-lantiq: Use of_mm_gpiochip_remove
Browse files Browse the repository at this point in the history
Since d621e8b (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 <[email protected]>
Cc: John Crispin <[email protected]>
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
  • Loading branch information
ribalda authored and linusw committed Jan 20, 2015
1 parent 68a99b1 commit da23822
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions drivers/gpio/gpio-mm-lantiq.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ static int ltq_mm_probe(struct platform_device *pdev)
if (!chip)
return -ENOMEM;

platform_set_drvdata(pdev, chip);

chip->mmchip.gc.ngpio = 16;
chip->mmchip.gc.direction_output = ltq_mm_dir_out;
chip->mmchip.gc.set = ltq_mm_set;
Expand All @@ -123,6 +125,15 @@ static int ltq_mm_probe(struct platform_device *pdev)
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[] = {
{ .compatible = "lantiq,gpio-mm" },
{},
Expand All @@ -131,6 +142,7 @@ MODULE_DEVICE_TABLE(of, ltq_mm_match);

static struct platform_driver ltq_mm_driver = {
.probe = ltq_mm_probe,
.remove = ltq_mm_remove,
.driver = {
.name = "gpio-mm-ltq",
.of_match_table = ltq_mm_match,
Expand All @@ -143,3 +155,9 @@ static int __init ltq_mm_init(void)
}

subsys_initcall(ltq_mm_init);

static void __exit ltq_mm_exit(void)
{
platform_driver_unregister(&ltq_mm_driver);
}
module_exit(ltq_mm_exit);

0 comments on commit da23822

Please sign in to comment.