Skip to content

Commit b890eb4

Browse files
committed
Merge tag 'pm+acpi-3.14-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI and power management fixes and cleanups from Rafael Wysocki: - ACPI device hotplug fix preventing ACPI drivers from binding to device objects that acpi_bus_trim() has been called for and the devices represented by them may not be operational. - Recent cpufreq changes related to the "boost" (turbo) feature broke the acpi-cpufreq error code path causing a NULL pointer dereference to occur on some systems. Fix from Konrad Rzeszutek Wilk. - The log level of a CPU initialization error message added recently needs to be reduced, because the particular BIOS issue indicated by it turns out to be widespread and doesn't really matter for the majority of systems having it. From Jiang Liu. - The regulator API needs to be told to stay away from things on systems with ACPI BIOSes or it may conflict with the BIOS' own handling of voltage regulators. Fix from Mark Brown that works around a 3.13 regression in lm90 on PCs occuring if the regulator API is enabled. - Prevent the Exynos4 devfreq driver from being built on multiplatform, because it depends on things that aren't available during such builds. From Sachin Kamat. - Upstream ACPICA doesn't use the bool type as defined in the kernel, so modify the kernel's ACPICA code to follow the upstream in that respect (only one variable definition is affected) to reduce divergences between the two. From Lv Zheng. - Make the ACPI device PM code use ACPI_COMPANION() instead of its own routine doing the same thing (and invokng ACPI_COMPANION() in the process). - Modify some routines in the ACPI processor driver to follow the common convention and return negative integers on errors. From Hanjun Guo. * tag 'pm+acpi-3.14-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI / scan: Clear match_driver flag in acpi_bus_trim() ACPI / init: Flag use of ACPI and ACPI idioms for power supplies to regulator API acpi-cpufreq: De-register CPU notifier and free struct msr on error. ACPICA: Remove bool usage from ACPICA. PM / devfreq: Disable Exynos4 driver build on multiplatform ACPI / PM: Use ACPI_COMPANION() to get ACPI companions of devices ACPI / scan: reduce log level of "ACPI: \_PR_.CPU4: failed to get CPU APIC ID" ACPI / processor: Return specific error value when mapping lapic id
2 parents aafd9d6 + 88ea0f2 commit b890eb4

File tree

10 files changed

+38
-39
lines changed

10 files changed

+38
-39
lines changed

drivers/acpi/acpi_processor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
261261

262262
apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id);
263263
if (apic_id < 0) {
264-
acpi_handle_err(pr->handle, "failed to get CPU APIC ID.\n");
264+
acpi_handle_debug(pr->handle, "failed to get CPU APIC ID.\n");
265265
return -ENODEV;
266266
}
267267
pr->apic_id = apic_id;

drivers/acpi/acpica/acglobal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE);
108108
/*
109109
* Optionally enable output from the AML Debug Object.
110110
*/
111-
bool ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);
111+
u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);
112112

113113
/*
114114
* Optionally copy the entire DSDT to local memory (instead of simply

drivers/acpi/bus.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <linux/proc_fs.h>
3434
#include <linux/acpi.h>
3535
#include <linux/slab.h>
36+
#include <linux/regulator/machine.h>
3637
#ifdef CONFIG_X86
3738
#include <asm/mpspec.h>
3839
#endif
@@ -509,6 +510,14 @@ void __init acpi_early_init(void)
509510
goto error0;
510511
}
511512

513+
/*
514+
* If the system is using ACPI then we can be reasonably
515+
* confident that any regulators are managed by the firmware
516+
* so tell the regulator core it has everything it needs to
517+
* know.
518+
*/
519+
regulator_has_full_constraints();
520+
512521
return;
513522

514523
error0:

drivers/acpi/device_pm.c

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -726,18 +726,6 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
726726
}
727727
#endif /* CONFIG_PM_SLEEP */
728728

729-
/**
730-
* acpi_dev_pm_get_node - Get ACPI device node for the given physical device.
731-
* @dev: Device to get the ACPI node for.
732-
*/
733-
struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
734-
{
735-
acpi_handle handle = ACPI_HANDLE(dev);
736-
struct acpi_device *adev;
737-
738-
return handle && !acpi_bus_get_device(handle, &adev) ? adev : NULL;
739-
}
740-
741729
/**
742730
* acpi_dev_pm_low_power - Put ACPI device into a low-power state.
743731
* @dev: Device to put into a low-power state.
@@ -778,7 +766,7 @@ static int acpi_dev_pm_full_power(struct acpi_device *adev)
778766
*/
779767
int acpi_dev_runtime_suspend(struct device *dev)
780768
{
781-
struct acpi_device *adev = acpi_dev_pm_get_node(dev);
769+
struct acpi_device *adev = ACPI_COMPANION(dev);
782770
bool remote_wakeup;
783771
int error;
784772

@@ -809,7 +797,7 @@ EXPORT_SYMBOL_GPL(acpi_dev_runtime_suspend);
809797
*/
810798
int acpi_dev_runtime_resume(struct device *dev)
811799
{
812-
struct acpi_device *adev = acpi_dev_pm_get_node(dev);
800+
struct acpi_device *adev = ACPI_COMPANION(dev);
813801
int error;
814802

815803
if (!adev)
@@ -862,7 +850,7 @@ EXPORT_SYMBOL_GPL(acpi_subsys_runtime_resume);
862850
*/
863851
int acpi_dev_suspend_late(struct device *dev)
864852
{
865-
struct acpi_device *adev = acpi_dev_pm_get_node(dev);
853+
struct acpi_device *adev = ACPI_COMPANION(dev);
866854
u32 target_state;
867855
bool wakeup;
868856
int error;
@@ -894,7 +882,7 @@ EXPORT_SYMBOL_GPL(acpi_dev_suspend_late);
894882
*/
895883
int acpi_dev_resume_early(struct device *dev)
896884
{
897-
struct acpi_device *adev = acpi_dev_pm_get_node(dev);
885+
struct acpi_device *adev = ACPI_COMPANION(dev);
898886
int error;
899887

900888
if (!adev)
@@ -985,7 +973,7 @@ static struct dev_pm_domain acpi_general_pm_domain = {
985973
*/
986974
int acpi_dev_pm_attach(struct device *dev, bool power_on)
987975
{
988-
struct acpi_device *adev = acpi_dev_pm_get_node(dev);
976+
struct acpi_device *adev = ACPI_COMPANION(dev);
989977

990978
if (!adev)
991979
return -ENODEV;
@@ -1017,7 +1005,7 @@ EXPORT_SYMBOL_GPL(acpi_dev_pm_attach);
10171005
*/
10181006
void acpi_dev_pm_detach(struct device *dev, bool power_off)
10191007
{
1020-
struct acpi_device *adev = acpi_dev_pm_get_node(dev);
1008+
struct acpi_device *adev = ACPI_COMPANION(dev);
10211009

10221010
if (adev && dev->pm_domain == &acpi_general_pm_domain) {
10231011
dev->pm_domain = NULL;

drivers/acpi/processor_core.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ static int map_lapic_id(struct acpi_subtable_header *entry,
4444
(struct acpi_madt_local_apic *)entry;
4545

4646
if (!(lapic->lapic_flags & ACPI_MADT_ENABLED))
47-
return 0;
47+
return -ENODEV;
4848

4949
if (lapic->processor_id != acpi_id)
50-
return 0;
50+
return -EINVAL;
5151

5252
*apic_id = lapic->id;
53-
return 1;
53+
return 0;
5454
}
5555

5656
static int map_x2apic_id(struct acpi_subtable_header *entry,
@@ -60,14 +60,14 @@ static int map_x2apic_id(struct acpi_subtable_header *entry,
6060
(struct acpi_madt_local_x2apic *)entry;
6161

6262
if (!(apic->lapic_flags & ACPI_MADT_ENABLED))
63-
return 0;
63+
return -ENODEV;
6464

6565
if (device_declaration && (apic->uid == acpi_id)) {
6666
*apic_id = apic->local_apic_id;
67-
return 1;
67+
return 0;
6868
}
6969

70-
return 0;
70+
return -EINVAL;
7171
}
7272

7373
static int map_lsapic_id(struct acpi_subtable_header *entry,
@@ -77,16 +77,16 @@ static int map_lsapic_id(struct acpi_subtable_header *entry,
7777
(struct acpi_madt_local_sapic *)entry;
7878

7979
if (!(lsapic->lapic_flags & ACPI_MADT_ENABLED))
80-
return 0;
80+
return -ENODEV;
8181

8282
if (device_declaration) {
8383
if ((entry->length < 16) || (lsapic->uid != acpi_id))
84-
return 0;
84+
return -EINVAL;
8585
} else if (lsapic->processor_id != acpi_id)
86-
return 0;
86+
return -EINVAL;
8787

8888
*apic_id = (lsapic->id << 8) | lsapic->eid;
89-
return 1;
89+
return 0;
9090
}
9191

9292
static int map_madt_entry(int type, u32 acpi_id)
@@ -116,13 +116,13 @@ static int map_madt_entry(int type, u32 acpi_id)
116116
struct acpi_subtable_header *header =
117117
(struct acpi_subtable_header *)entry;
118118
if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) {
119-
if (map_lapic_id(header, acpi_id, &apic_id))
119+
if (!map_lapic_id(header, acpi_id, &apic_id))
120120
break;
121121
} else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) {
122-
if (map_x2apic_id(header, type, acpi_id, &apic_id))
122+
if (!map_x2apic_id(header, type, acpi_id, &apic_id))
123123
break;
124124
} else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
125-
if (map_lsapic_id(header, type, acpi_id, &apic_id))
125+
if (!map_lsapic_id(header, type, acpi_id, &apic_id))
126126
break;
127127
}
128128
entry += header->length;

drivers/acpi/scan.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,6 +2105,7 @@ void acpi_bus_trim(struct acpi_device *adev)
21052105
list_for_each_entry_reverse(child, &adev->children, node)
21062106
acpi_bus_trim(child);
21072107

2108+
adev->flags.match_driver = false;
21082109
if (handler) {
21092110
if (handler->detach)
21102111
handler->detach(adev);

drivers/acpi/sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ module_param_call(trace_state, param_set_trace_state, param_get_trace_state,
226226
/* /sys/modules/acpi/parameters/aml_debug_output */
227227

228228
module_param_named(aml_debug_output, acpi_gbl_enable_aml_debug_object,
229-
bool, 0644);
229+
byte, 0644);
230230
MODULE_PARM_DESC(aml_debug_output,
231231
"To enable/disable the ACPI Debug Object output.");
232232

drivers/cpufreq/acpi-cpufreq.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ static void __init acpi_cpufreq_boost_init(void)
919919
}
920920
}
921921

922-
static void __exit acpi_cpufreq_boost_exit(void)
922+
static void acpi_cpufreq_boost_exit(void)
923923
{
924924
if (msrs) {
925925
unregister_cpu_notifier(&boost_nb);
@@ -969,9 +969,10 @@ static int __init acpi_cpufreq_init(void)
969969
acpi_cpufreq_boost_init();
970970

971971
ret = cpufreq_register_driver(&acpi_cpufreq_driver);
972-
if (ret)
972+
if (ret) {
973973
free_acpi_perf_data();
974-
974+
acpi_cpufreq_boost_exit();
975+
}
975976
return ret;
976977
}
977978

drivers/devfreq/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ comment "DEVFREQ Drivers"
6767

6868
config ARM_EXYNOS4_BUS_DEVFREQ
6969
bool "ARM Exynos4210/4212/4412 Memory Bus DEVFREQ Driver"
70-
depends on CPU_EXYNOS4210 || SOC_EXYNOS4212 || SOC_EXYNOS4412
70+
depends on (CPU_EXYNOS4210 || SOC_EXYNOS4212 || SOC_EXYNOS4412) && !ARCH_MULTIPLATFORM
7171
select ARCH_HAS_OPP
7272
select DEVFREQ_GOV_SIMPLE_ONDEMAND
7373
help

include/acpi/acpixf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ extern u8 acpi_gbl_create_osi_method;
7777
extern u8 acpi_gbl_disable_auto_repair;
7878
extern u8 acpi_gbl_disable_ssdt_table_load;
7979
extern u8 acpi_gbl_do_not_use_xsdt;
80-
extern bool acpi_gbl_enable_aml_debug_object;
80+
extern u8 acpi_gbl_enable_aml_debug_object;
8181
extern u8 acpi_gbl_enable_interpreter_slack;
8282
extern u32 acpi_gbl_trace_flags;
8383
extern acpi_name acpi_gbl_trace_method_name;

0 commit comments

Comments
 (0)