aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/nouveau_pm.c
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2010-09-23 20:58:38 +0200
committerBen Skeggs <bskeggs@redhat.com>2010-09-24 16:29:29 +1000
commit8155cac489eb8cc6fd96b9bdefacdf5a56e6ea32 (patch)
tree0fb54eb113e8cbac73836b9c48989f0bf42d4f2f /drivers/gpu/drm/nouveau/nouveau_pm.c
parente829d804d78c57b8e90039079284ac585f72851d (diff)
drm/nouveau: Refactor nouveau_temp_get() into engine pointers.
Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_pm.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_pm.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c
index 09b638435f8f..85a56dea0ef7 100644
--- a/drivers/gpu/drm/nouveau/nouveau_pm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_pm.c
@@ -289,8 +289,10 @@ static ssize_t
nouveau_hwmon_show_temp(struct device *d, struct device_attribute *a, char *buf)
{
struct drm_device *dev = dev_get_drvdata(d);
+ struct drm_nouveau_private *dev_priv = dev->dev_private;
+ struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
- return snprintf(buf, PAGE_SIZE, "%d\n", nouveau_temp_get(dev)*1000);
+ return snprintf(buf, PAGE_SIZE, "%d\n", pm->temp_get(dev)*1000);
}
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, nouveau_hwmon_show_temp,
NULL, 0);
@@ -399,10 +401,12 @@ static int
nouveau_hwmon_init(struct drm_device *dev)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
+ struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
struct device *hwmon_dev;
int ret;
- dev_priv->int_hwmon_dev = NULL;
+ if (!pm->temp_get)
+ return -ENODEV;
hwmon_dev = hwmon_device_register(&dev->pdev->dev);
if (IS_ERR(hwmon_dev)) {
@@ -421,7 +425,7 @@ nouveau_hwmon_init(struct drm_device *dev)
return ret;
}
- dev_priv->int_hwmon_dev = hwmon_dev;
+ pm->hwmon = hwmon_dev;
return 0;
}
@@ -430,15 +434,14 @@ static void
nouveau_hwmon_fini(struct drm_device *dev)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
+ struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
- if (dev_priv->int_hwmon_dev) {
- sysfs_remove_group(&dev_priv->int_hwmon_dev->kobj,
- &hwmon_attrgroup);
- hwmon_device_unregister(dev_priv->int_hwmon_dev);
+ if (pm->hwmon) {
+ sysfs_remove_group(&pm->hwmon->kobj, &hwmon_attrgroup);
+ hwmon_device_unregister(pm->hwmon);
}
}
-
int
nouveau_pm_init(struct drm_device *dev)
{