From fe8a4052e1e49c8050750a608cc448f1d57a826c Mon Sep 17 00:00:00 2001 From: Martin Peres Date: Thu, 14 Mar 2013 23:51:16 +0100 Subject: [PATCH] --- yaml --- r: 361527 b: refs/heads/master c: ad40d73ef533ab0ad16b4a1ab2f7870c1f8ab954 h: refs/heads/master i: 361525: 1cc7ff406ab44d69fbb5c394daba72d6a661d93c 361523: 9ff86b3d2b8468ca0f350a5f96c90f9b056a28e3 361519: 5edb07b9870dc5bf3934e5ff2c07261a5fb0f6f9 v: v3 --- [refs] | 2 +- trunk/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c | 10 ++++------ trunk/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c | 9 --------- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/[refs] b/[refs] index 2053599058e2..ffec3acdfd8c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 13506e2ab40ebec3be3e2fda708d40d3ba972e3e +refs/heads/master: ad40d73ef533ab0ad16b4a1ab2f7870c1f8ab954 diff --git a/trunk/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c b/trunk/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c index 0575af5328ec..c526d536409f 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c +++ b/trunk/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c @@ -93,12 +93,10 @@ nv40_temp_get(struct nouveau_therm *therm) } else return -ENODEV; - if (sensor->slope_div == 0) - sensor->slope_div = 1; - if (sensor->offset_den == 0) - sensor->offset_den = 1; - if (sensor->slope_mult < 1) - sensor->slope_mult = 1; + /* if the slope or the offset is unset, do no use the sensor */ + if (!sensor->slope_div || !sensor->slope_mult || + !sensor->offset_num || !sensor->offset_den) + return -ENODEV; core_temp = core_temp * sensor->slope_mult / sensor->slope_div; core_temp = core_temp + sensor->offset_num / sensor->offset_den; diff --git a/trunk/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c b/trunk/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c index 441f60bba226..0d94d1a19eb7 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c +++ b/trunk/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c @@ -34,10 +34,6 @@ nouveau_therm_temp_set_defaults(struct nouveau_therm *therm) { struct nouveau_therm_priv *priv = (void *)therm; - priv->bios_sensor.slope_mult = 1; - priv->bios_sensor.slope_div = 1; - priv->bios_sensor.offset_num = 0; - priv->bios_sensor.offset_den = 1; priv->bios_sensor.offset_constant = 0; priv->bios_sensor.thrs_fan_boost.temp = 90; @@ -60,11 +56,6 @@ nouveau_therm_temp_safety_checks(struct nouveau_therm *therm) struct nouveau_therm_priv *priv = (void *)therm; struct nvbios_therm_sensor *s = &priv->bios_sensor; - if (!priv->bios_sensor.slope_div) - priv->bios_sensor.slope_div = 1; - if (!priv->bios_sensor.offset_den) - priv->bios_sensor.offset_den = 1; - /* enforce a minimum hysteresis on thresholds */ s->thrs_fan_boost.hysteresis = max_t(u8, s->thrs_fan_boost.hysteresis, 2); s->thrs_down_clock.hysteresis = max_t(u8, s->thrs_down_clock.hysteresis, 2);