[3/3] hwmon: (ftsteutates) Use devm_watchdog_register_device()

Message ID 20221224041855.83981-4-W_Armin@gmx.de
State New
Headers
Series hwmon: (ftsteutates) Various fixes |

Commit Message

Armin Wolf Dec. 24, 2022, 4:18 a.m. UTC
  Use devm_watchdog_register_device() to let devres take care
of unregistering the watchdog at device removal. Remove the
now pointless fts_remove() function.

Tested on a Fujitsu DS3401-B1.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/hwmon/ftsteutates.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

--
2.30.2
  

Comments

Guenter Roeck Dec. 29, 2022, 2:29 p.m. UTC | #1
On Sat, Dec 24, 2022 at 05:18:55AM +0100, Armin Wolf wrote:
> Use devm_watchdog_register_device() to let devres take care
> of unregistering the watchdog at device removal. Remove the
> now pointless fts_remove() function.
> 
> Tested on a Fujitsu DS3401-B1.
> 
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>

Applied to hwmon-next.

Thanks,
Guenter

> ---
>  drivers/hwmon/ftsteutates.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> --
> 2.30.2
> 
> diff --git a/drivers/hwmon/ftsteutates.c b/drivers/hwmon/ftsteutates.c
> index 66ff8d69a0de..d8878b8d16bc 100644
> --- a/drivers/hwmon/ftsteutates.c
> +++ b/drivers/hwmon/ftsteutates.c
> @@ -333,7 +333,7 @@ static int fts_watchdog_init(struct fts_data *data)
>  	/* max timeout 255 minutes. */
>  	data->wdd.max_hw_heartbeat_ms = 0xFF * 60 * MSEC_PER_SEC;
> 
> -	return watchdog_register_device(&data->wdd);
> +	return devm_watchdog_register_device(&data->client->dev, &data->wdd);
>  }
> 
>  static umode_t fts_is_visible(const void *devdata, enum hwmon_sensor_types type, u32 attr,
> @@ -611,13 +611,6 @@ static int fts_detect(struct i2c_client *client,
>  	return 0;
>  }
> 
> -static void fts_remove(struct i2c_client *client)
> -{
> -	struct fts_data *data = dev_get_drvdata(&client->dev);
> -
> -	watchdog_unregister_device(&data->wdd);
> -}
> -
>  static int fts_probe(struct i2c_client *client)
>  {
>  	u8 revision;
> @@ -684,7 +677,6 @@ static struct i2c_driver fts_driver = {
>  	},
>  	.id_table = fts_id,
>  	.probe_new = fts_probe,
> -	.remove = fts_remove,
>  	.detect = fts_detect,
>  	.address_list = normal_i2c,
>  };
  

Patch

diff --git a/drivers/hwmon/ftsteutates.c b/drivers/hwmon/ftsteutates.c
index 66ff8d69a0de..d8878b8d16bc 100644
--- a/drivers/hwmon/ftsteutates.c
+++ b/drivers/hwmon/ftsteutates.c
@@ -333,7 +333,7 @@  static int fts_watchdog_init(struct fts_data *data)
 	/* max timeout 255 minutes. */
 	data->wdd.max_hw_heartbeat_ms = 0xFF * 60 * MSEC_PER_SEC;

-	return watchdog_register_device(&data->wdd);
+	return devm_watchdog_register_device(&data->client->dev, &data->wdd);
 }

 static umode_t fts_is_visible(const void *devdata, enum hwmon_sensor_types type, u32 attr,
@@ -611,13 +611,6 @@  static int fts_detect(struct i2c_client *client,
 	return 0;
 }

-static void fts_remove(struct i2c_client *client)
-{
-	struct fts_data *data = dev_get_drvdata(&client->dev);
-
-	watchdog_unregister_device(&data->wdd);
-}
-
 static int fts_probe(struct i2c_client *client)
 {
 	u8 revision;
@@ -684,7 +677,6 @@  static struct i2c_driver fts_driver = {
 	},
 	.id_table = fts_id,
 	.probe_new = fts_probe,
-	.remove = fts_remove,
 	.detect = fts_detect,
 	.address_list = normal_i2c,
 };