From 77aee56418ffbb4f0d4683d9e6d9d8d46ad12621 Mon Sep 17 00:00:00 2001
From: Martin Peres <martin.peres@ensi-bourges.fr>
Date: Tue, 12 Oct 2010 03:30:27 +0200
Subject: [PATCH] Try to fix issues when compiling nouveau without CONFIG_HWMON
Signed-off: Martin Peres <martin.peres@ensi-bourges.fr>
---
drivers/gpu/drm/nouveau/nouveau_pm.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
@@ -27,8 +27,10 @@
#include "nouveau_drv.h"
#include "nouveau_pm.h"
+#ifdef CONFIG_HWMON
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
+#endif
static int
nouveau_pm_clock_set(struct drm_device *dev, struct nouveau_pm_level *perflvl,
@@ -406,7 +408,8 @@ nouveau_hwmon_init(struct drm_device *dev)
if (!pm->temp_get)
return -ENODEV;
-
+
+#ifdef CONFIG_HWMON
hwmon_dev = hwmon_device_register(&dev->pdev->dev);
if (IS_ERR(hwmon_dev)) {
ret = PTR_ERR(hwmon_dev);
@@ -425,6 +428,9 @@ nouveau_hwmon_init(struct drm_device *dev)
}
pm->hwmon = hwmon_dev;
+#else
+ pm->hwmon = NULL;
+#endif
return 0;
}
@@ -435,10 +441,12 @@ 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;
+#ifdef CONFIG_HWMON
if (pm->hwmon) {
sysfs_remove_group(&pm->hwmon->kobj, &hwmon_attrgroup);
hwmon_device_unregister(pm->hwmon);
}
+#endif
}
int
--
1.7.3.1