Skip to contentSkip to conversation

drm/nouveau/therm: use workqueue to shutdown the machine

PATCH In review Marcin Slusarz 2 participants 2 messages Feb 3, 2013 – Feb 4, 2013 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 drm/nouveau/therm: use workqueue to shutdown the machine

orderly_poweroff cannot be called from atomic context.

---
 drivers/gpu/drm/nouveau/core/subdev/therm/temp.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/core/subdev/therm/temp.c +16 -2
index 8f27b44..b37624a 100644
@@ -90,6 +90,13 @@ nouveau_therm_sensor_get_threshold_state(struct nouveau_therm *therm,
 	return priv->sensor.alarm_state[thrs];
 }
 
+static void
+nv_poweroff_work(struct work_struct *work)
+{
+	orderly_poweroff(true);
+	kfree(work);
+}
+
 void nouveau_therm_sensor_event(struct nouveau_therm *therm,
 			        enum nouveau_therm_thrs thrs,
 			        enum nouveau_therm_thrs_direction dir)
@@ -128,8 +135,15 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm,
 			priv->emergency.pause(therm, active);
 		break;
 	case NOUVEAU_THERM_THRS_SHUTDOWN:
-		if (active)
-			orderly_poweroff(true);
+		if (active) {
+			struct work_struct *work;
+
+			work = kmalloc(sizeof(*work), GFP_ATOMIC);
+			if (work) {
+				INIT_WORK(work, nv_poweroff_work);
+				schedule_work(work);
+			}
+		}
 		break;
 	case NOUVEAU_THERM_THRS_NR:
 		break;
Signature · 1 line
1.8.1

A message that is not in the archive (sent off-list or not yet received): 1359922077-3347-3-git-send-email-marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org