mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-05 13:51:52 +00:00
hwmon: (max6650) Use devm function to register thermal device
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>
This commit is contained in:
parent
792eac1843
commit
8e5e7ddd38
1 changed files with 7 additions and 20 deletions
|
@ -101,7 +101,6 @@ module_param(clock, int, 0444);
|
||||||
struct max6650_data {
|
struct max6650_data {
|
||||||
struct i2c_client *client;
|
struct i2c_client *client;
|
||||||
const struct attribute_group *groups[3];
|
const struct attribute_group *groups[3];
|
||||||
struct thermal_cooling_device *cooling_dev;
|
|
||||||
struct mutex update_lock;
|
struct mutex update_lock;
|
||||||
int nr_fans;
|
int nr_fans;
|
||||||
char valid; /* zero until following fields are valid */
|
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,
|
static int max6650_probe(struct i2c_client *client,
|
||||||
const struct i2c_device_id *id)
|
const struct i2c_device_id *id)
|
||||||
{
|
{
|
||||||
|
struct thermal_cooling_device *cooling_dev;
|
||||||
struct device *dev = &client->dev;
|
struct device *dev = &client->dev;
|
||||||
const struct of_device_id *of_id =
|
const struct of_device_id *of_id =
|
||||||
of_match_device(of_match_ptr(max6650_dt_match), dev);
|
of_match_device(of_match_ptr(max6650_dt_match), dev);
|
||||||
|
@ -780,28 +780,16 @@ static int max6650_probe(struct i2c_client *client,
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_THERMAL)
|
#if IS_ENABLED(CONFIG_THERMAL)
|
||||||
data->cooling_dev =
|
cooling_dev = devm_thermal_of_cooling_device_register(dev, dev->of_node,
|
||||||
thermal_of_cooling_device_register(client->dev.of_node,
|
client->name, data, &max6650_cooling_ops);
|
||||||
client->name, data,
|
if (IS_ERR(cooling_dev)) {
|
||||||
&max6650_cooling_ops);
|
dev_warn(dev, "thermal cooling device register failed: %ld\n",
|
||||||
if (IS_ERR(data->cooling_dev))
|
PTR_ERR(cooling_dev));
|
||||||
dev_warn(&client->dev,
|
}
|
||||||
"thermal cooling device register failed: %ld\n",
|
|
||||||
PTR_ERR(data->cooling_dev));
|
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
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[] = {
|
static const struct i2c_device_id max6650_id[] = {
|
||||||
{ "max6650", 1 },
|
{ "max6650", 1 },
|
||||||
{ "max6651", 4 },
|
{ "max6651", 4 },
|
||||||
|
@ -815,7 +803,6 @@ static struct i2c_driver max6650_driver = {
|
||||||
.of_match_table = of_match_ptr(max6650_dt_match),
|
.of_match_table = of_match_ptr(max6650_dt_match),
|
||||||
},
|
},
|
||||||
.probe = max6650_probe,
|
.probe = max6650_probe,
|
||||||
.remove = max6650_remove,
|
|
||||||
.id_table = max6650_id,
|
.id_table = max6650_id,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue