Skip to content

Commit cff539b

Browse files
committed
Merge tag 'pm+acpi-3.13-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI and power management fixes from Rafael Wysocki: - Recent commits modifying the lists of C-states in the intel_idle driver introduced bugs leading to crashes on some systems. Two fixes from Jiang Liu. - The ACPI AC driver should receive all types of notifications, but recent change made it ignore some of them. Fix from Alexander Mezin. - intel_pstate's validity checks for MSRs it depends on are not sufficient to catch the lack of support in nested KVM setups, so they are extended to cover that case. From Dirk Brandewie. - NEC LZ750/LS has a botched up _BIX method in its ACPI tables, so our ACPI battery driver needs a quirk for it. From Lan Tianyu. - The tpm_ppi driver sometimes leaks memory allocated by acpi_get_name(). Fix from Jiang Liu. * tag 'pm+acpi-3.13-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: intel_idle: close avn_cstates array with correct marker Revert "intel_idle: mark states tables with __initdata tag" ACPI / Battery: Add a _BIX quirk for NEC LZ750/LS intel_pstate: Add X86_FEATURE_APERFMPERF to cpu match parameters. ACPI / TPM: fix memory leak when walking ACPI namespace ACPI / AC: change notification handler type to ACPI_ALL_NOTIFY
2 parents c43a5eb + 13de22c commit cff539b

File tree

5 files changed

+42
-16
lines changed

5 files changed

+42
-16
lines changed

drivers/acpi/ac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ static int acpi_ac_probe(struct platform_device *pdev)
207207
goto end;
208208

209209
result = acpi_install_notify_handler(ACPI_HANDLE(&pdev->dev),
210-
ACPI_DEVICE_NOTIFY, acpi_ac_notify_handler, ac);
210+
ACPI_ALL_NOTIFY, acpi_ac_notify_handler, ac);
211211
if (result) {
212212
power_supply_unregister(&ac->charger);
213213
goto end;
@@ -255,7 +255,7 @@ static int acpi_ac_remove(struct platform_device *pdev)
255255
return -EINVAL;
256256

257257
acpi_remove_notify_handler(ACPI_HANDLE(&pdev->dev),
258-
ACPI_DEVICE_NOTIFY, acpi_ac_notify_handler);
258+
ACPI_ALL_NOTIFY, acpi_ac_notify_handler);
259259

260260
ac = platform_get_drvdata(pdev);
261261
if (ac->charger.dev)

drivers/acpi/battery.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ MODULE_AUTHOR("Alexey Starikovskiy <[email protected]>");
6262
MODULE_DESCRIPTION("ACPI Battery Driver");
6363
MODULE_LICENSE("GPL");
6464

65+
static int battery_bix_broken_package;
6566
static unsigned int cache_time = 1000;
6667
module_param(cache_time, uint, 0644);
6768
MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
@@ -416,7 +417,12 @@ static int acpi_battery_get_info(struct acpi_battery *battery)
416417
ACPI_EXCEPTION((AE_INFO, status, "Evaluating %s", name));
417418
return -ENODEV;
418419
}
419-
if (test_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags))
420+
421+
if (battery_bix_broken_package)
422+
result = extract_package(battery, buffer.pointer,
423+
extended_info_offsets + 1,
424+
ARRAY_SIZE(extended_info_offsets) - 1);
425+
else if (test_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags))
420426
result = extract_package(battery, buffer.pointer,
421427
extended_info_offsets,
422428
ARRAY_SIZE(extended_info_offsets));
@@ -754,6 +760,17 @@ static int battery_notify(struct notifier_block *nb,
754760
return 0;
755761
}
756762

763+
static struct dmi_system_id bat_dmi_table[] = {
764+
{
765+
.ident = "NEC LZ750/LS",
766+
.matches = {
767+
DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
768+
DMI_MATCH(DMI_PRODUCT_NAME, "PC-LZ750LS"),
769+
},
770+
},
771+
{},
772+
};
773+
757774
static int acpi_battery_add(struct acpi_device *device)
758775
{
759776
int result = 0;
@@ -846,6 +863,9 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
846863
{
847864
if (acpi_disabled)
848865
return;
866+
867+
if (dmi_check_system(bat_dmi_table))
868+
battery_bix_broken_package = 1;
849869
acpi_bus_register_driver(&acpi_battery_driver);
850870
}
851871

drivers/char/tpm/tpm_ppi.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,18 @@ static char *tpm_device_name = "TPM";
2727
static acpi_status ppi_callback(acpi_handle handle, u32 level, void *context,
2828
void **return_value)
2929
{
30-
acpi_status status;
30+
acpi_status status = AE_OK;
3131
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
32-
status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
33-
if (strstr(buffer.pointer, context) != NULL) {
34-
*return_value = handle;
32+
33+
if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer))) {
34+
if (strstr(buffer.pointer, context) != NULL) {
35+
*return_value = handle;
36+
status = AE_CTRL_TERMINATE;
37+
}
3538
kfree(buffer.pointer);
36-
return AE_CTRL_TERMINATE;
3739
}
38-
return AE_OK;
40+
41+
return status;
3942
}
4043

4144
static inline void ppi_assign_params(union acpi_object params[4],

drivers/cpufreq/intel_pstate.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,8 @@ static void intel_pstate_timer_func(unsigned long __data)
581581
}
582582

583583
#define ICPU(model, policy) \
584-
{ X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long)&policy }
584+
{ X86_VENDOR_INTEL, 6, model, X86_FEATURE_APERFMPERF,\
585+
(unsigned long)&policy }
585586

586587
static const struct x86_cpu_id intel_pstate_cpu_ids[] = {
587588
ICPU(0x2a, core_params),

drivers/idle/intel_idle.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static struct cpuidle_state *cpuidle_state_table;
123123
* which is also the index into the MWAIT hint array.
124124
* Thus C0 is a dummy.
125125
*/
126-
static struct cpuidle_state nehalem_cstates[] __initdata = {
126+
static struct cpuidle_state nehalem_cstates[] = {
127127
{
128128
.name = "C1-NHM",
129129
.desc = "MWAIT 0x00",
@@ -156,7 +156,7 @@ static struct cpuidle_state nehalem_cstates[] __initdata = {
156156
.enter = NULL }
157157
};
158158

159-
static struct cpuidle_state snb_cstates[] __initdata = {
159+
static struct cpuidle_state snb_cstates[] = {
160160
{
161161
.name = "C1-SNB",
162162
.desc = "MWAIT 0x00",
@@ -196,7 +196,7 @@ static struct cpuidle_state snb_cstates[] __initdata = {
196196
.enter = NULL }
197197
};
198198

199-
static struct cpuidle_state ivb_cstates[] __initdata = {
199+
static struct cpuidle_state ivb_cstates[] = {
200200
{
201201
.name = "C1-IVB",
202202
.desc = "MWAIT 0x00",
@@ -236,7 +236,7 @@ static struct cpuidle_state ivb_cstates[] __initdata = {
236236
.enter = NULL }
237237
};
238238

239-
static struct cpuidle_state hsw_cstates[] __initdata = {
239+
static struct cpuidle_state hsw_cstates[] = {
240240
{
241241
.name = "C1-HSW",
242242
.desc = "MWAIT 0x00",
@@ -297,7 +297,7 @@ static struct cpuidle_state hsw_cstates[] __initdata = {
297297
.enter = NULL }
298298
};
299299

300-
static struct cpuidle_state atom_cstates[] __initdata = {
300+
static struct cpuidle_state atom_cstates[] = {
301301
{
302302
.name = "C1E-ATM",
303303
.desc = "MWAIT 0x00",
@@ -329,7 +329,7 @@ static struct cpuidle_state atom_cstates[] __initdata = {
329329
{
330330
.enter = NULL }
331331
};
332-
static struct cpuidle_state avn_cstates[] __initdata = {
332+
static struct cpuidle_state avn_cstates[] = {
333333
{
334334
.name = "C1-AVN",
335335
.desc = "MWAIT 0x00",
@@ -344,6 +344,8 @@ static struct cpuidle_state avn_cstates[] __initdata = {
344344
.exit_latency = 15,
345345
.target_residency = 45,
346346
.enter = &intel_idle },
347+
{
348+
.enter = NULL }
347349
};
348350

349351
/**

0 commit comments

Comments
 (0)