linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 01/10] hwmon: (max6650) Use devm function to register thermal device
@ 2019-06-07 17:23 Guenter Roeck
  2019-06-07 17:23 ` [PATCH v2 02/10] hwmon: (max6650) Introduce pwm_to_dac and dac_to_pwm Guenter Roeck
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Guenter Roeck @ 2019-06-07 17:23 UTC (permalink / raw)
  To: Hardware Monitoring; +Cc: Jean Delvare, Guenter Roeck, Jean-Francois Dagenais

Use devm_thermal_of_cooling_device_register to register the thermal
cooling device. This lets us drop the remove function.

At the same time, use 'dev' variable in probe function consistently.

Cc: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Use devm_thermal_of_cooling_device_register() instead of devm_add_action()

 drivers/hwmon/max6650.c | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c
index 6b9056f9483f..e540d0b0145e 100644
--- a/drivers/hwmon/max6650.c
+++ b/drivers/hwmon/max6650.c
@@ -101,7 +101,6 @@ module_param(clock, int, 0444);
 struct max6650_data {
 	struct i2c_client *client;
 	const struct attribute_group *groups[3];
-	struct thermal_cooling_device *cooling_dev;
 	struct mutex update_lock;
 	int nr_fans;
 	char valid; /* zero until following fields are valid */
@@ -744,6 +743,7 @@ static const struct thermal_cooling_device_ops max6650_cooling_ops = {
 static int max6650_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
+	struct thermal_cooling_device *cooling_dev;
 	struct device *dev = &client->dev;
 	const struct of_device_id *of_id =
 		of_match_device(of_match_ptr(max6650_dt_match), dev);
@@ -780,28 +780,16 @@ static int max6650_probe(struct i2c_client *client,
 		return err;
 
 #if IS_ENABLED(CONFIG_THERMAL)
-	data->cooling_dev =
-		thermal_of_cooling_device_register(client->dev.of_node,
-						   client->name, data,
-						   &max6650_cooling_ops);
-	if (IS_ERR(data->cooling_dev))
-		dev_warn(&client->dev,
-			 "thermal cooling device register failed: %ld\n",
-			 PTR_ERR(data->cooling_dev));
+	cooling_dev = devm_thermal_of_cooling_device_register(dev, dev->of_node,
+				client->name, data, &max6650_cooling_ops);
+	if (IS_ERR(cooling_dev)) {
+		dev_warn(dev, "thermal cooling device register failed: %ld\n",
+			 PTR_ERR(cooling_dev));
+	}
 #endif
 	return 0;
 }
 
-static int max6650_remove(struct i2c_client *client)
-{
-	struct max6650_data *data = i2c_get_clientdata(client);
-
-	if (!IS_ERR(data->cooling_dev))
-		thermal_cooling_device_unregister(data->cooling_dev);
-
-	return 0;
-}
-
 static const struct i2c_device_id max6650_id[] = {
 	{ "max6650", 1 },
 	{ "max6651", 4 },
@@ -815,7 +803,6 @@ static struct i2c_driver max6650_driver = {
 		.of_match_table = of_match_ptr(max6650_dt_match),
 	},
 	.probe		= max6650_probe,
-	.remove		= max6650_remove,
 	.id_table	= max6650_id,
 };
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-06-10 12:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-07 17:23 [PATCH v2 01/10] hwmon: (max6650) Use devm function to register thermal device Guenter Roeck
2019-06-07 17:23 ` [PATCH v2 02/10] hwmon: (max6650) Introduce pwm_to_dac and dac_to_pwm Guenter Roeck
2019-06-07 17:23 ` [PATCH v2 03/10] hwmon: (max6650) Improve error handling in max6650_init_client Guenter Roeck
2019-06-07 17:23 ` [PATCH v2 04/10] hwmon: (max6650) Declare valid as boolean Guenter Roeck
2019-06-10 11:33   ` Jean-Francois Dagenais
2019-06-10 12:47     ` Guenter Roeck
2019-06-07 17:23 ` [PATCH v2 05/10] hwmon: (max6650) Cache alarm_en register Guenter Roeck
2019-06-07 17:23 ` [PATCH v2 06/10] hwmon: (max6650) Simplify alarm handling Guenter Roeck
2019-06-07 17:23 ` [PATCH v2 07/10] hwmon: (max6650) Convert to use devm_hwmon_device_register_with_info Guenter Roeck
2019-06-07 17:23 ` [PATCH v2 08/10] hwmon: (max6650) Read non-volatile registers only once Guenter Roeck
2019-06-07 17:23 ` [PATCH v2 09/10] hwmon: (max6650) Improve error handling in max6650_update_device Guenter Roeck
2019-06-07 17:23 ` [PATCH v2 10/10] hwmon: (max6650) Fix minor formatting issues Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).