static int __init acpi_cpufreq_init(void) { int ret; if (acpi_disabled) return -ENODEV; /* don't keep reloading if cpufreq_driver exists */ if (cpufreq_get_current_driver()) return -EEXIST; pr_debug("acpi_cpufreq_init\n"); ret = acpi_cpufreq_early_init(); if (ret) return ret; #ifdef CONFIG_X86_ACPI_CPUFREQ_CPB /* this is a sysfs file with a strange name and an even stranger * semantic - per CPU instantiation, but system global effect. * Lets enable it only on AMD CPUs for compatibility reasons and * only if configured. This is considered legacy code, which * will probably be removed at some point in the future. */ if (!check_amd_hwpstate_cpu(0)) { struct freq_attr **attr; pr_debug("CPB unsupported, do not expose it\n"); for (attr = acpi_cpufreq_attr; *attr; attr++) if (*attr == &cpb) { *attr = NULL; break; } } #endif acpi_cpufreq_boost_init(); ret = cpufreq_register_driver(&acpi_cpufreq_driver); if (ret) { free_acpi_perf_data(); acpi_cpufreq_boost_exit(); } return ret; }
static int __init acpi_cpufreq_init(void) { int ret; if (acpi_disabled) return -ENODEV; /* don't keep reloading if cpufreq_driver exists */ if (cpufreq_get_current_driver()) return -EEXIST; pr_debug("acpi_cpufreq_init\n"); ret = acpi_cpufreq_early_init(); if (ret) return ret; #ifdef CONFIG_X86_ACPI_CPUFREQ_CPB /* this is a sysfs file with a strange name and an even stranger * semantic - per CPU instantiation, but system global effect. * Lets enable it only on AMD CPUs for compatibility reasons and * only if configured. This is considered legacy code, which * will probably be removed at some point in the future. */ if (check_amd_hwpstate_cpu(0)) { struct freq_attr **iter; pr_debug("adding sysfs entry for cpb\n"); for (iter = acpi_cpufreq_attr; *iter != NULL; iter++) ; /* make sure there is a terminator behind it */ if (iter[1] == NULL) *iter = &cpb; } #endif acpi_cpufreq_boost_init(); ret = cpufreq_register_driver(&acpi_cpufreq_driver); if (ret) free_acpi_perf_data(); return ret; }