[2/3] watchdog: rn5t618: Simplify using devm_watchdog_register_device()

Message ID 20230306170901.2232323-3-u.kleine-koenig@pengutronix.de
State New
Headers
Series watchdog: Simplify using devm_watchdog_register_device() |

Commit Message

Uwe Kleine-König March 6, 2023, 5:09 p.m. UTC
  This allows to drop the .remove() function as it only exists to
unregister the watchdog device which is now done in a callback
registered by devm_watchdog_register_device().

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/watchdog/rn5t618_wdt.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
  

Comments

Guenter Roeck March 6, 2023, 5:31 p.m. UTC | #1
On Mon, Mar 06, 2023 at 06:09:00PM +0100, Uwe Kleine-König wrote:
> This allows to drop the .remove() function as it only exists to
> unregister the watchdog device which is now done in a callback
> registered by devm_watchdog_register_device().
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/rn5t618_wdt.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/drivers/watchdog/rn5t618_wdt.c b/drivers/watchdog/rn5t618_wdt.c
> index 40d8ebd8c0ac..c0aee627ff3b 100644
> --- a/drivers/watchdog/rn5t618_wdt.c
> +++ b/drivers/watchdog/rn5t618_wdt.c
> @@ -178,21 +178,11 @@ static int rn5t618_wdt_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, wdt);
>  
> -	return watchdog_register_device(&wdt->wdt_dev);
> -}
> -
> -static int rn5t618_wdt_remove(struct platform_device *pdev)
> -{
> -	struct rn5t618_wdt *wdt = platform_get_drvdata(pdev);
> -
> -	watchdog_unregister_device(&wdt->wdt_dev);
> -
> -	return 0;
> +	return devm_watchdog_register_device(&wdt->wdt_dev);
>  }
>  
>  static struct platform_driver rn5t618_wdt_driver = {
>  	.probe = rn5t618_wdt_probe,
> -	.remove = rn5t618_wdt_remove,
>  	.driver = {
>  		.name	= DRIVER_NAME,
>  	},
> -- 
> 2.39.1
>
  

Patch

diff --git a/drivers/watchdog/rn5t618_wdt.c b/drivers/watchdog/rn5t618_wdt.c
index 40d8ebd8c0ac..c0aee627ff3b 100644
--- a/drivers/watchdog/rn5t618_wdt.c
+++ b/drivers/watchdog/rn5t618_wdt.c
@@ -178,21 +178,11 @@  static int rn5t618_wdt_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, wdt);
 
-	return watchdog_register_device(&wdt->wdt_dev);
-}
-
-static int rn5t618_wdt_remove(struct platform_device *pdev)
-{
-	struct rn5t618_wdt *wdt = platform_get_drvdata(pdev);
-
-	watchdog_unregister_device(&wdt->wdt_dev);
-
-	return 0;
+	return devm_watchdog_register_device(&wdt->wdt_dev);
 }
 
 static struct platform_driver rn5t618_wdt_driver = {
 	.probe = rn5t618_wdt_probe,
-	.remove = rn5t618_wdt_remove,
 	.driver = {
 		.name	= DRIVER_NAME,
 	},