提交 eb72ed5d 编写于 作者: K Karol Herbst 提交者: Ben Skeggs

drm/nouveau/hwmon: don't require therm to be valid to get any data

Signed-off-by: NKarol Herbst <nouveau@karolherbst.de>
Reviewed-by: NMartin Peres <martin.peres@free.fr>
上级 353b9834
...@@ -640,9 +640,6 @@ nouveau_hwmon_init(struct drm_device *dev) ...@@ -640,9 +640,6 @@ nouveau_hwmon_init(struct drm_device *dev)
return -ENOMEM; return -ENOMEM;
hwmon->dev = dev; hwmon->dev = dev;
if (!therm || !therm->attr_get || !therm->attr_set)
return -ENODEV;
hwmon_dev = hwmon_device_register(&dev->pdev->dev); hwmon_dev = hwmon_device_register(&dev->pdev->dev);
if (IS_ERR(hwmon_dev)) { if (IS_ERR(hwmon_dev)) {
ret = PTR_ERR(hwmon_dev); ret = PTR_ERR(hwmon_dev);
...@@ -656,6 +653,7 @@ nouveau_hwmon_init(struct drm_device *dev) ...@@ -656,6 +653,7 @@ nouveau_hwmon_init(struct drm_device *dev)
if (ret) if (ret)
goto error; goto error;
if (therm && therm->attr_get && therm->attr_set) {
/* if the card has a working thermal sensor */ /* if the card has a working thermal sensor */
if (nvkm_therm_temp_get(therm) >= 0) { if (nvkm_therm_temp_get(therm) >= 0) {
ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_temp_attrgroup); ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_temp_attrgroup);
...@@ -673,9 +671,10 @@ nouveau_hwmon_init(struct drm_device *dev) ...@@ -673,9 +671,10 @@ nouveau_hwmon_init(struct drm_device *dev)
if (ret) if (ret)
goto error; goto error;
} }
}
/* if the card can read the fan rpm */ /* if the card can read the fan rpm */
if (nvkm_therm_fan_sense(therm) >= 0) { if (therm && nvkm_therm_fan_sense(therm) >= 0) {
ret = sysfs_create_group(&hwmon_dev->kobj, ret = sysfs_create_group(&hwmon_dev->kobj,
&hwmon_fan_rpm_attrgroup); &hwmon_fan_rpm_attrgroup);
if (ret) if (ret)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册