Re: linux-next: Tree for Nov 21 (nouveau)

From: Adrian Pop
Date: Fri Nov 22 2013 - 06:35:58 EST


Hello!

> on x86_64:
>
> CONFIG_HWMON is not enabled.
>
> drivers/gpu/drm/nouveau/nouveau_hwmon.c: In function 'nouveau_hwmon_init':
> drivers/gpu/drm/nouveau/nouveau_hwmon.c:633:2: error: 'hwmon' undeclared (first use in this function)

I've attached a patch that fixes the build for me when using this
config.

From: Adrian Pop <sultryweather@xxxxxxxxx>
Date: Fri, 22 Nov 2013 12:52:19 +0200
Subject: [PATCH] nouveau: Fixed the 'hwmon' undeclared build error

hwmon is declared inside the #if defined(CONFIG_HWMON)... but is still
referenced outside of it, which results in a build error. By removing
the reference, Linux builds successfully with both code paths.
Two warnings from running checkpatch.pl have been fixed too.

Signed-off-by: Adrian Pop <sultryweather@xxxxxxxxx>
---
drivers/gpu/drm/nouveau/nouveau_hwmon.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
index 38a4db5..21fc8d6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
@@ -357,7 +357,7 @@ nouveau_hwmon_show_fan1_input(struct device *d, struct device_attribute *attr,
static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, nouveau_hwmon_show_fan1_input,
NULL, 0);

- static ssize_t
+static ssize_t
nouveau_hwmon_get_pwm1_enable(struct device *d,
struct device_attribute *a, char *buf)
{
@@ -383,7 +383,7 @@ nouveau_hwmon_set_pwm1_enable(struct device *d, struct device_attribute *a,
long value;
int ret;

- if (strict_strtol(buf, 10, &value) == -EINVAL)
+ if (kstrtol(buf, 10, &value) == -EINVAL)
return -EINVAL;

ret = therm->attr_set(therm, NOUVEAU_THERM_ATTR_FAN_MODE, value);
@@ -630,7 +630,6 @@ error:
hwmon->hwmon = NULL;
return ret;
#else
- hwmon->hwmon = NULL;
return 0;
#endif
}
--
1.8.4.2