Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: gpio-mm-lantiq: Use of_mm_gpiochip_remove

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: Alexandre Courbot <gnurou@gmail.com>
Cc: John Crispin <blogic@openwrt.org>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Ricardo Ribalda Delgado and committed by
Linus Walleij
da238221 68a99b18

+18
+18
drivers/gpio/gpio-mm-lantiq.c
··· 111 111 if (!chip) 112 112 return -ENOMEM; 113 113 114 + platform_set_drvdata(pdev, chip); 115 + 114 116 chip->mmchip.gc.ngpio = 16; 115 117 chip->mmchip.gc.direction_output = ltq_mm_dir_out; 116 118 chip->mmchip.gc.set = ltq_mm_set; ··· 125 123 return of_mm_gpiochip_add(pdev->dev.of_node, &chip->mmchip); 126 124 } 127 125 126 + static int ltq_mm_remove(struct platform_device *pdev) 127 + { 128 + struct ltq_mm *chip = platform_get_drvdata(pdev); 129 + 130 + of_mm_gpiochip_remove(&chip->mmchip); 131 + 132 + return 0; 133 + } 134 + 128 135 static const struct of_device_id ltq_mm_match[] = { 129 136 { .compatible = "lantiq,gpio-mm" }, 130 137 {}, ··· 142 131 143 132 static struct platform_driver ltq_mm_driver = { 144 133 .probe = ltq_mm_probe, 134 + .remove = ltq_mm_remove, 145 135 .driver = { 146 136 .name = "gpio-mm-ltq", 147 137 .of_match_table = ltq_mm_match, ··· 155 143 } 156 144 157 145 subsys_initcall(ltq_mm_init); 146 + 147 + static void __exit ltq_mm_exit(void) 148 + { 149 + platform_driver_unregister(&ltq_mm_driver); 150 + } 151 + module_exit(ltq_mm_exit);