Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1566131 > unrolled thread

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

Started byWilliam Breathitt Gray <vilhelm.gray@gmail.com>
First post2017-01-24 21:40 +0100
Last post2017-01-24 23:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] watchdog: ebc-c384_wdt: Utilize devm_ functions in driver probe callback William Breathitt Gray <vilhelm.gray@gmail.com> - 2017-01-24 21:40 +0100
    Re: [PATCH] watchdog: ebc-c384_wdt: Utilize devm_ functions in  driver probe callback Guenter Roeck <linux@roeck-us.net> - 2017-01-24 23:00 +0100

#1566131 — [PATCH] watchdog: ebc-c384_wdt: Utilize devm_ functions in driver probe callback

FromWilliam Breathitt Gray <vilhelm.gray@gmail.com>
Date2017-01-24 21:40 +0100
Subject[PATCH] watchdog: ebc-c384_wdt: Utilize devm_ functions in driver probe callback
Message-ID<t3g2K-wp-7@gated-at.bofh.it>
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.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
---
 drivers/watchdog/ebc-c384_wdt.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/watchdog/ebc-c384_wdt.c b/drivers/watchdog/ebc-c384_wdt.c
index 4b849b8e..de135dff 100644
--- a/drivers/watchdog/ebc-c384_wdt.c
+++ b/drivers/watchdog/ebc-c384_wdt.c
@@ -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)
-- 
2.11.0

[toc] | [next] | [standalone]


#1566186 — Re: [PATCH] watchdog: ebc-c384_wdt: Utilize devm_ functions in driver probe callback

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-24 23:00 +0100
SubjectRe: [PATCH] watchdog: ebc-c384_wdt: Utilize devm_ functions in driver probe callback
Message-ID<t3hic-1ka-67@gated-at.bofh.it>
In reply to#1566131
On Tue, Jan 24, 2017 at 03:36:19PM -0500, William Breathitt Gray wrote:
> 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.
> 
> Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
> ---
>  drivers/watchdog/ebc-c384_wdt.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/drivers/watchdog/ebc-c384_wdt.c b/drivers/watchdog/ebc-c384_wdt.c
> index 4b849b8e..de135dff 100644
> --- a/drivers/watchdog/ebc-c384_wdt.c
> +++ b/drivers/watchdog/ebc-c384_wdt.c
> @@ -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

>  
> -	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)
> -- 
> 2.11.0
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web