Module Name: src
Committed By: jruoho
Date: Thu Oct 20 06:48:25 UTC 2011
Modified Files:
src/share/man/man9: cpufreq.9
src/sys/kern: subr_cpufreq.c
Log Message:
Do not use xcall(9) in cpufreq_register(9), as it requires kthreads to be
running and may impose hacks like config_interrupts(9) in the backend.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man9/cpufreq.9
cvs rdiff -u -r1.4 -r1.5 src/sys/kern/subr_cpufreq.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/share/man/man9/cpufreq.9
diff -u src/share/man/man9/cpufreq.9:1.4 src/share/man/man9/cpufreq.9:1.5
--- src/share/man/man9/cpufreq.9:1.4 Fri Sep 30 04:21:17 2011
+++ src/share/man/man9/cpufreq.9 Thu Oct 20 06:48:24 2011
@@ -1,4 +1,4 @@
-.\" $NetBSD: cpufreq.9,v 1.4 2011/09/30 04:21:17 jruoho Exp $ */
+.\" $NetBSD: cpufreq.9,v 1.5 2011/10/20 06:48:24 jruoho Exp $ */
.\"
.\" Copyright (c) 2011 Jukka Ruohonen <jruohonen.iki.fi>
.\" All rights reserved.
@@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd September 30, 2011
+.Dd October 20, 2011
.Dt CPUFREQ 9
.Os
.Sh NAME
@@ -115,7 +115,7 @@ a machine-dependent backend with the fra
Only one backend can be registered.
Upon successful completion,
.Fn cpufreq_register
-returns 0 and sets the frequency to the maximum available level.
+returns 0.
.Pp
The following elements in
.Vt struct cpufreq
@@ -277,6 +277,7 @@ while calling the functions.
This, and the use of
.Xr xcall 9 ,
implies that no memory can be allocated in the backend during the calls.
+Nor should the functions be called from interrupt context.
.Sh CODE REFERENCES
The
.Nm
Index: src/sys/kern/subr_cpufreq.c
diff -u src/sys/kern/subr_cpufreq.c:1.4 src/sys/kern/subr_cpufreq.c:1.5
--- src/sys/kern/subr_cpufreq.c:1.4 Fri Sep 30 04:10:54 2011
+++ src/sys/kern/subr_cpufreq.c Thu Oct 20 06:48:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_cpufreq.c,v 1.4 2011/09/30 04:10:54 jruoho Exp $ */
+/* $NetBSD: subr_cpufreq.c,v 1.5 2011/10/20 06:48:24 jruoho Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_cpufreq.c,v 1.4 2011/09/30 04:10:54 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_cpufreq.c,v 1.5 2011/10/20 06:48:24 jruoho Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -62,7 +62,7 @@ cpufreq_init(void)
int
cpufreq_register(struct cpufreq *cf)
{
- uint32_t c, i, j, k, m;
+ uint32_t c, i, j, k;
int rv;
KASSERT(cf != NULL);
@@ -138,8 +138,6 @@ cpufreq_register(struct cpufreq *cf)
return rv;
}
- m = cpufreq_get_max();
- cpufreq_set_all_raw(m);
mutex_exit(&cpufreq_lock);
return 0;