summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_cpu.c
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2005-02-18 00:23:36 +0000
committernjl <njl@FreeBSD.org>2005-02-18 00:23:36 +0000
commit18a69f46e3ac23cb04aa2d1abf75f3aebf0c4e9a (patch)
treef4abd78e49b192efb6c1137801aa4a380e6e4218 /sys/kern/kern_cpu.c
parentc54115d548403a18776fc113c093f02b9b1b7cd6 (diff)
downloadFreeBSD-src-18a69f46e3ac23cb04aa2d1abf75f3aebf0c4e9a.zip
FreeBSD-src-18a69f46e3ac23cb04aa2d1abf75f3aebf0c4e9a.tar.gz
Introduce a new method, cpufreq_drv_type(), that returns the type of the
driver. This used to be handled by cpufreq_drv_settings() but it's useful to get the type/flags separately from getting the settings. (For example, you don't have to pass an array of cf_setting just to find the driver type.) Use this new method in our in-tree drivers to detect reliably if acpi_perf is present and owns the hardware. This simplifies logic in drivers as well as fixing a bug introduced in my last commit where too many drivers attached.
Diffstat (limited to 'sys/kern/kern_cpu.c')
-rw-r--r--sys/kern/kern_cpu.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/kern/kern_cpu.c b/sys/kern/kern_cpu.c
index d51dcb5..51ba889 100644
--- a/sys/kern/kern_cpu.c
+++ b/sys/kern/kern_cpu.c
@@ -404,9 +404,12 @@ cf_levels_method(device_t dev, struct cf_level *levels, int *count)
* Get settings, skipping drivers that offer no settings or
* provide settings for informational purposes only.
*/
+ error = CPUFREQ_DRV_TYPE(devs[i], &type);
+ if (error || (type & CPUFREQ_FLAG_INFO_ONLY))
+ continue;
set_count = MAX_SETTINGS;
- error = CPUFREQ_DRV_SETTINGS(devs[i], sets, &set_count, &type);
- if (error || set_count == 0 || (type & CPUFREQ_FLAG_INFO_ONLY))
+ error = CPUFREQ_DRV_SETTINGS(devs[i], sets, &set_count);
+ if (error || set_count == 0)
continue;
/* Add the settings to our absolute/relative lists. */
@@ -772,8 +775,7 @@ int
cpufreq_unregister(device_t dev)
{
device_t cf_dev, *devs;
- int cfcount, count, devcount, error, i, type;
- struct cf_setting set;
+ int cfcount, devcount, error, i, type;
/*
* If this is the last cpufreq child device, remove the control
@@ -788,8 +790,7 @@ cpufreq_unregister(device_t dev)
for (i = 0; i < devcount; i++) {
if (!device_is_attached(devs[i]))
continue;
- count = 1;
- if (CPUFREQ_DRV_SETTINGS(devs[i], &set, &count, &type) == 0)
+ if (CPUFREQ_DRV_TYPE(devs[i], &type) == 0)
cfcount++;
}
if (cfcount <= 1)
OpenPOWER on IntegriCloud