drm/nouveau/therm: update target fanspeed outside of therm lock
authorBen Skeggs <bskeggs@redhat.com>
Sun, 3 Nov 2013 23:34:55 +0000 (09:34 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 8 Nov 2013 05:40:03 +0000 (15:40 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/subdev/therm/base.c

index 29cf7bcd7b3e48c42da3897e69cde7ee8e12e855..21b2b3021fadf0f49f1e0b8775acb6ffb264561a 100644 (file)
@@ -92,8 +92,9 @@ nouveau_therm_update(struct nouveau_therm *therm, int mode)
        struct nouveau_timer *ptimer = nouveau_timer(therm);
        struct nouveau_therm_priv *priv = (void *)therm;
        unsigned long flags;
+       bool immd = true;
        bool poll = true;
-       int duty;
+       int duty = -1;
 
        spin_lock_irqsave(&priv->lock, flags);
        if (mode < 0)
@@ -119,21 +120,22 @@ nouveau_therm_update(struct nouveau_therm *therm, int mode)
                        duty = priv->cstate;
                        poll = false;
                }
+               immd = false;
                break;
        case NOUVEAU_THERM_CTRL_NONE:
        default:
                ptimer->alarm_cancel(ptimer, &priv->alarm);
                poll = false;
-               goto done;
        }
 
-       nv_debug(therm, "FAN target request: %d%%\n", duty);
-       nouveau_therm_fan_set(therm, (mode != NOUVEAU_THERM_CTRL_AUTO), duty);
-
-done:
        if (list_empty(&priv->alarm.head) && poll)
                ptimer->alarm(ptimer, 1000000000ULL, &priv->alarm);
        spin_unlock_irqrestore(&priv->lock, flags);
+
+       if (duty >= 0) {
+               nv_debug(therm, "FAN target request: %d%%\n", duty);
+               nouveau_therm_fan_set(therm, immd, duty);
+       }
 }
 
 int