From owner-svn-src-all@freebsd.org Mon Oct 24 22:35:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20149C1F8A6; Mon, 24 Oct 2016 22:35:14 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E0A2AFC0; Mon, 24 Oct 2016 22:35:13 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OMZCUO048270; Mon, 24 Oct 2016 22:35:12 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OMZChp048269; Mon, 24 Oct 2016 22:35:12 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201610242235.u9OMZChp048269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 24 Oct 2016 22:35:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307888 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Oct 2016 22:35:14 -0000 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 #include #include +#include #include #include @@ -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");