Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Oct 2016 22:35:12 +0000 (UTC)
From:      Jared McNeill <jmcneill@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r307888 - head/sys/arm/allwinner
Message-ID:  <201610242235.u9OMZChp048269@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmcneill
Date: Mon Oct 24 22:35:12 2016
New Revision: 307888
URL: https://svnweb.freebsd.org/changeset/base/307888

Log:
  Defer cpufreq updates from intr handler to the taskqueue_thread queue.

Modified:
  head/sys/arm/allwinner/aw_thermal.c

Modified: head/sys/arm/allwinner/aw_thermal.c
==============================================================================
--- head/sys/arm/allwinner/aw_thermal.c	Mon Oct 24 22:11:33 2016	(r307887)
+++ head/sys/arm/allwinner/aw_thermal.c	Mon Oct 24 22:35:12 2016	(r307888)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/reboot.h>
 #include <sys/module.h>
 #include <sys/cpu.h>
+#include <sys/taskqueue.h>
 #include <machine/bus.h>
 
 #include <dev/ofw/ofw_bus.h>
@@ -249,6 +250,7 @@ struct aw_thermal_softc {
 	struct resource			*res[2];
 	struct aw_thermal_config	*conf;
 
+	struct task			cf_task;
 	int				throttle;
 	int				min_freq;
 	struct cf_level			levels[MAX_CF_LEVELS];
@@ -390,6 +392,16 @@ aw_thermal_throttle(struct aw_thermal_so
 }
 
 static void
+aw_thermal_cf_task(void *arg, int pending)
+{
+	struct aw_thermal_softc *sc;
+
+	sc = arg;
+
+	aw_thermal_throttle(sc, 1);
+}
+
+static void
 aw_thermal_cf_pre_change(void *arg, const struct cf_level *level, int *status)
 {
 	struct aw_thermal_softc *sc;
@@ -430,7 +442,7 @@ aw_thermal_intr(void *arg)
 	}
 
 	if ((ints & ALARM_INT_ALL) != 0)
-		aw_thermal_throttle(sc, 1);
+		taskqueue_enqueue(taskqueue_thread, &sc->cf_task);
 }
 
 static int
@@ -461,6 +473,7 @@ aw_thermal_attach(device_t dev)
 	ih = NULL;
 
 	sc->conf = THS_CONF(dev);
+	TASK_INIT(&sc->cf_task, 0, aw_thermal_cf_task, sc);
 
 	if (bus_alloc_resources(dev, aw_thermal_spec, sc->res) != 0) {
 		device_printf(dev, "cannot allocate resources for device\n");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610242235.u9OMZChp048269>