Skip to contentSkip to conversation

watchdog: ebc-c384_wdt: Utilize devm_ functions in driver probe callback

PATCH Superseded William Breathitt Gray 2 participants 2 messages Jan 24, 2017

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog: ebc-c384_wdt: Utilize devm_ functions in driver probe callback

The devm_ resource manager functions allow memory to be automatically released when a device is unbound. This patch takes advantage of the resource manager functions and replaces the watchdog_register_device call with the devm_watchdog_register_device call. In addition, the ebc_c384_wdt_remove function has been removed as no longer necessary due to the use of the relevant devm_ resource manager functions.

---
 drivers/watchdog/ebc-c384_wdt.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/watchdog/ebc-c384_wdt.c +1 -11
index 4b849b8e..de135dff 100644
@@ -123,16 +123,7 @@ static int ebc_c384_wdt_probe(struct device *dev, unsigned int id)
 
 	dev_set_drvdata(dev, wdd);
 
-	return watchdog_register_device(wdd);
-}
-
-static int ebc_c384_wdt_remove(struct device *dev, unsigned int id)
-{
-	struct watchdog_device *wdd = dev_get_drvdata(dev);
-
-	watchdog_unregister_device(wdd);
-
-	return 0;
+	return devm_watchdog_register_device(dev, wdd);
 }
 
 static struct isa_driver ebc_c384_wdt_driver = {
@@ -140,7 +131,6 @@ static struct isa_driver ebc_c384_wdt_driver = {
 	.driver = {
 		.name = MODULE_NAME
 	},
-	.remove = ebc_c384_wdt_remove
 };
 
 static int __init ebc_c384_wdt_init(void)
Signature · 1 line
2.11.0
maintainer
#1 lore raw
Quoted 17 lines · William Breathitt Gray

The devm_ resource manager functions allow memory to be automatically released when a device is unbound. This patch takes advantage of the resource manager functions and replaces the watchdog_register_device call with the devm_watchdog_register_device call. In addition, the ebc_c384_wdt_remove function has been removed as no longer necessary due to the use of the relevant devm_ resource manager functions.

---
 drivers/watchdog/ebc-c384_wdt.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/watchdog/ebc-c384_wdt.c +0 -0
index 4b849b8e..de135dff 100644

drivers/watchdog/ebc-c384_wdt.c static int ebc_c384_wdt_probe(struct device *dev, unsigned int id) · line 124

Quoted 2 lines
drivers/watchdog/ebc-c384_wdt.c +0 -0
@@ -123,16 +123,7 @@ static int ebc_c384_wdt_probe(struct device *dev, unsigned int id)
 
 	dev_set_drvdata(dev, wdd);

Unless I am missing something, this is no longer needed.

Thanks,
Guenter

Quoted 26 lines
drivers/watchdog/ebc-c384_wdt.c +1 -11
-	return watchdog_register_device(wdd);
-}
-
-static int ebc_c384_wdt_remove(struct device *dev, unsigned int id)
-{
-	struct watchdog_device *wdd = dev_get_drvdata(dev);
-
-	watchdog_unregister_device(wdd);
-
-	return 0;
+	return devm_watchdog_register_device(dev, wdd);
 }
 
 static struct isa_driver ebc_c384_wdt_driver = {
@@ -140,7 +131,6 @@ static struct isa_driver ebc_c384_wdt_driver = {
 	.driver = {
 		.name = MODULE_NAME
 	},
-	.remove = ebc_c384_wdt_remove
 };
 
 static int __init ebc_c384_wdt_init(void)
Signature · 1 line
2.11.0