[PATCH 4/5] arm: omap: debug-leds: add a remove method

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



while at that, also convert to module_platform_driver

Signed-off-by: Felipe Balbi <balbi@xxxxxx>
---
 arch/arm/plat-omap/debug-leds.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index 392daa8..08fbb85 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -251,6 +251,14 @@ static void __devinit newled_init(struct device *dev)
 	return;
 }
 
+static void __devexit newled_exit(void)
+{
+	unsigned	i;
+	struct dbg_led	*led;
+
+	for (i = 0, led = dbg_leds; i < ARRAY_SIZE(dbg_leds); i++, led++)
+		led_classdev_unregister(&led->cdev);
+}
 
 /*-------------------------------------------------------------------------*/
 
@@ -279,6 +287,16 @@ static int __devinit fpga_probe(struct platform_device *pdev)
 	return 0;
 }
 
+static int __devexit fpga_remove(struct platform_device *pdev)
+{
+	if (new_led_api())
+		newled_exit();
+
+	iounmap(fpga);
+
+	return 0;
+}
+
 static int fpga_suspend_noirq(struct device *dev)
 {
 	__raw_writew(~0, &fpga->leds);
@@ -300,10 +318,7 @@ static struct platform_driver led_driver = {
 	.driver.name	= "omap_dbg_led",
 	.driver.pm	= &fpga_dev_pm_ops,
 	.probe		= fpga_probe,
+	.remove		= __devexit_p(fpga_remove),
 };
 
-static int __init fpga_init(void)
-{
-	return platform_driver_register(&led_driver);
-}
-module_init(fpga_init);
+module_platform_driver(led_driver);
-- 
1.7.11

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux