mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 00:04:15 +08:00
hwmon: (thmc50) Don't create temp3 if not enabled
Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
This commit is contained in:
parent
c2803b9855
commit
894c00cf38
@ -237,7 +237,7 @@ static const struct attribute_group thmc50_group = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* for ADM1022 3rd temperature mode */
|
/* for ADM1022 3rd temperature mode */
|
||||||
static struct attribute *adm1022_attributes[] = {
|
static struct attribute *temp3_attributes[] = {
|
||||||
&sensor_dev_attr_temp3_max.dev_attr.attr,
|
&sensor_dev_attr_temp3_max.dev_attr.attr,
|
||||||
&sensor_dev_attr_temp3_min.dev_attr.attr,
|
&sensor_dev_attr_temp3_min.dev_attr.attr,
|
||||||
&sensor_dev_attr_temp3_input.dev_attr.attr,
|
&sensor_dev_attr_temp3_input.dev_attr.attr,
|
||||||
@ -246,8 +246,8 @@ static struct attribute *adm1022_attributes[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct attribute_group adm1022_group = {
|
static const struct attribute_group temp3_group = {
|
||||||
.attrs = adm1022_attributes,
|
.attrs = temp3_attributes,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind)
|
static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind)
|
||||||
@ -345,9 +345,9 @@ static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
goto exit_detach;
|
goto exit_detach;
|
||||||
|
|
||||||
/* Register ADM1022 sysfs hooks */
|
/* Register ADM1022 sysfs hooks */
|
||||||
if (data->type == adm1022)
|
if (data->has_temp3)
|
||||||
if ((err = sysfs_create_group(&client->dev.kobj,
|
if ((err = sysfs_create_group(&client->dev.kobj,
|
||||||
&adm1022_group)))
|
&temp3_group)))
|
||||||
goto exit_remove_sysfs_thmc50;
|
goto exit_remove_sysfs_thmc50;
|
||||||
|
|
||||||
/* Register a new directory entry with module sensors */
|
/* Register a new directory entry with module sensors */
|
||||||
@ -360,8 +360,8 @@ static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
exit_remove_sysfs:
|
exit_remove_sysfs:
|
||||||
if (data->type == adm1022)
|
if (data->has_temp3)
|
||||||
sysfs_remove_group(&client->dev.kobj, &adm1022_group);
|
sysfs_remove_group(&client->dev.kobj, &temp3_group);
|
||||||
exit_remove_sysfs_thmc50:
|
exit_remove_sysfs_thmc50:
|
||||||
sysfs_remove_group(&client->dev.kobj, &thmc50_group);
|
sysfs_remove_group(&client->dev.kobj, &thmc50_group);
|
||||||
exit_detach:
|
exit_detach:
|
||||||
@ -386,8 +386,8 @@ static int thmc50_detach_client(struct i2c_client *client)
|
|||||||
|
|
||||||
hwmon_device_unregister(data->hwmon_dev);
|
hwmon_device_unregister(data->hwmon_dev);
|
||||||
sysfs_remove_group(&client->dev.kobj, &thmc50_group);
|
sysfs_remove_group(&client->dev.kobj, &thmc50_group);
|
||||||
if (data->type == adm1022)
|
if (data->has_temp3)
|
||||||
sysfs_remove_group(&client->dev.kobj, &adm1022_group);
|
sysfs_remove_group(&client->dev.kobj, &temp3_group);
|
||||||
|
|
||||||
if ((err = i2c_detach_client(client)))
|
if ((err = i2c_detach_client(client)))
|
||||||
return err;
|
return err;
|
||||||
|
Loading…
Reference in New Issue
Block a user