aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndré Draszik <git@andred.net>2018-01-12 04:44:54 -0500
committerWim Van Sebroeck <wim@iguana.be>2018-01-21 06:44:59 -0500
commit1d2e5eb521a7edeac9e9decd3d526b04e307bb41 (patch)
treeea0c560dde53dcf6c9aecf7e86bb64799acf6a6b
parent392d39a863583eb6439e2ec543818250b57ef99d (diff)
watchdog: mt7621: switch to using managed devm_watchdog_register_device()
This does the necessary cleanup on driver unload automatically. Signed-off-by: André Draszik <git@andred.net> Cc: linux-watchdog@vger.kernel.org Cc: John Crispin <john@phrozen.org> Reviewed-by: Guenter Roeck <Linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r--drivers/watchdog/mt7621_wdt.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/drivers/watchdog/mt7621_wdt.c b/drivers/watchdog/mt7621_wdt.c
index eec57e5e1eae..5c4a764717c4 100644
--- a/drivers/watchdog/mt7621_wdt.c
+++ b/drivers/watchdog/mt7621_wdt.c
@@ -133,7 +133,6 @@ static struct watchdog_device mt7621_wdt_dev = {
133static int mt7621_wdt_probe(struct platform_device *pdev) 133static int mt7621_wdt_probe(struct platform_device *pdev)
134{ 134{
135 struct resource *res; 135 struct resource *res;
136 int ret;
137 136
138 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 137 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
139 mt7621_wdt_base = devm_ioremap_resource(&pdev->dev, res); 138 mt7621_wdt_base = devm_ioremap_resource(&pdev->dev, res);
@@ -164,16 +163,7 @@ static int mt7621_wdt_probe(struct platform_device *pdev)
164 set_bit(WDOG_HW_RUNNING, &mt7621_wdt_dev.status); 163 set_bit(WDOG_HW_RUNNING, &mt7621_wdt_dev.status);
165 } 164 }
166 165
167 ret = watchdog_register_device(&mt7621_wdt_dev); 166 return devm_watchdog_register_device(&pdev->dev, &mt7621_wdt_dev);
168
169 return 0;
170}
171
172static int mt7621_wdt_remove(struct platform_device *pdev)
173{
174 watchdog_unregister_device(&mt7621_wdt_dev);
175
176 return 0;
177} 167}
178 168
179static void mt7621_wdt_shutdown(struct platform_device *pdev) 169static void mt7621_wdt_shutdown(struct platform_device *pdev)
@@ -189,7 +179,6 @@ MODULE_DEVICE_TABLE(of, mt7621_wdt_match);
189 179
190static struct platform_driver mt7621_wdt_driver = { 180static struct platform_driver mt7621_wdt_driver = {
191 .probe = mt7621_wdt_probe, 181 .probe = mt7621_wdt_probe,
192 .remove = mt7621_wdt_remove,
193 .shutdown = mt7621_wdt_shutdown, 182 .shutdown = mt7621_wdt_shutdown,
194 .driver = { 183 .driver = {
195 .name = KBUILD_MODNAME, 184 .name = KBUILD_MODNAME,