Skip to content

Commit 06c8563

Browse files
committed
Merge tag 'acpi-4.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fixes from Rafael Wysocki: "These fix a recent ACPICA regression, fix a battery driver regression introduced during the 4.17 cycle and fix up the recently added support for the PPTT ACPI table. Specifics: - Revert part of a recent ACPICA regression fix that added leading newlines to ACPICA error messages and made the kernel log look broken (Rafael Wysocki). - Fix an ACPI battery driver regression introduced during the 4.17 cycle due to incorrect error handling that made Thinkpad 13 laptops crash on boot (Jouke Witteveen). - Fix up the recently added PPTT ACPI table support by covering the case when a PPTT structure represents a processors group correctly (Sudeep Holla)" * tag 'acpi-4.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI / battery: Safe unregistering of hooks ACPI / PPTT: use ACPI ID whenever ACPI_PPTT_ACPI_PROCESSOR_ID_VALID is set ACPICA: Drop leading newlines from error messages
2 parents 90dc8b6 + df95856 commit 06c8563

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

drivers/acpi/acpica/uterror.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,19 +182,19 @@ acpi_ut_prefixed_namespace_error(const char *module_name,
182182
switch (lookup_status) {
183183
case AE_ALREADY_EXISTS:
184184

185-
acpi_os_printf("\n" ACPI_MSG_BIOS_ERROR);
185+
acpi_os_printf(ACPI_MSG_BIOS_ERROR);
186186
message = "Failure creating";
187187
break;
188188

189189
case AE_NOT_FOUND:
190190

191-
acpi_os_printf("\n" ACPI_MSG_BIOS_ERROR);
191+
acpi_os_printf(ACPI_MSG_BIOS_ERROR);
192192
message = "Could not resolve";
193193
break;
194194

195195
default:
196196

197-
acpi_os_printf("\n" ACPI_MSG_ERROR);
197+
acpi_os_printf(ACPI_MSG_ERROR);
198198
message = "Failure resolving";
199199
break;
200200
}

drivers/acpi/battery.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -717,10 +717,11 @@ void battery_hook_register(struct acpi_battery_hook *hook)
717717
*/
718718
pr_err("extension failed to load: %s", hook->name);
719719
__battery_hook_unregister(hook, 0);
720-
return;
720+
goto end;
721721
}
722722
}
723723
pr_info("new extension: %s\n", hook->name);
724+
end:
724725
mutex_unlock(&hook_mutex);
725726
}
726727
EXPORT_SYMBOL_GPL(battery_hook_register);
@@ -732,7 +733,7 @@ EXPORT_SYMBOL_GPL(battery_hook_register);
732733
*/
733734
static void battery_hook_add_battery(struct acpi_battery *battery)
734735
{
735-
struct acpi_battery_hook *hook_node;
736+
struct acpi_battery_hook *hook_node, *tmp;
736737

737738
mutex_lock(&hook_mutex);
738739
INIT_LIST_HEAD(&battery->list);
@@ -744,15 +745,15 @@ static void battery_hook_add_battery(struct acpi_battery *battery)
744745
* when a battery gets hotplugged or initialized
745746
* during the battery module initialization.
746747
*/
747-
list_for_each_entry(hook_node, &battery_hook_list, list) {
748+
list_for_each_entry_safe(hook_node, tmp, &battery_hook_list, list) {
748749
if (hook_node->add_battery(battery->bat)) {
749750
/*
750751
* The notification of the extensions has failed, to
751752
* prevent further errors we will unload the extension.
752753
*/
753-
__battery_hook_unregister(hook_node, 0);
754754
pr_err("error in extension, unloading: %s",
755755
hook_node->name);
756+
__battery_hook_unregister(hook_node, 0);
756757
}
757758
}
758759
mutex_unlock(&hook_mutex);

drivers/acpi/pptt.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,14 @@ static int topology_get_acpi_cpu_tag(struct acpi_table_header *table,
481481
if (cpu_node) {
482482
cpu_node = acpi_find_processor_package_id(table, cpu_node,
483483
level, flag);
484-
/* Only the first level has a guaranteed id */
485-
if (level == 0)
484+
/*
485+
* As per specification if the processor structure represents
486+
* an actual processor, then ACPI processor ID must be valid.
487+
* For processor containers ACPI_PPTT_ACPI_PROCESSOR_ID_VALID
488+
* should be set if the UID is valid
489+
*/
490+
if (level == 0 ||
491+
cpu_node->flags & ACPI_PPTT_ACPI_PROCESSOR_ID_VALID)
486492
return cpu_node->acpi_processor_id;
487493
return ACPI_PTR_DIFF(cpu_node, table);
488494
}

0 commit comments

Comments
 (0)