Commit 06c85639 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 90dc8b65 df958569
...@@ -182,19 +182,19 @@ acpi_ut_prefixed_namespace_error(const char *module_name, ...@@ -182,19 +182,19 @@ acpi_ut_prefixed_namespace_error(const char *module_name,
switch (lookup_status) { switch (lookup_status) {
case AE_ALREADY_EXISTS: case AE_ALREADY_EXISTS:
acpi_os_printf("\n" ACPI_MSG_BIOS_ERROR); acpi_os_printf(ACPI_MSG_BIOS_ERROR);
message = "Failure creating"; message = "Failure creating";
break; break;
case AE_NOT_FOUND: case AE_NOT_FOUND:
acpi_os_printf("\n" ACPI_MSG_BIOS_ERROR); acpi_os_printf(ACPI_MSG_BIOS_ERROR);
message = "Could not resolve"; message = "Could not resolve";
break; break;
default: default:
acpi_os_printf("\n" ACPI_MSG_ERROR); acpi_os_printf(ACPI_MSG_ERROR);
message = "Failure resolving"; message = "Failure resolving";
break; break;
} }
......
...@@ -717,10 +717,11 @@ void battery_hook_register(struct acpi_battery_hook *hook) ...@@ -717,10 +717,11 @@ void battery_hook_register(struct acpi_battery_hook *hook)
*/ */
pr_err("extension failed to load: %s", hook->name); pr_err("extension failed to load: %s", hook->name);
__battery_hook_unregister(hook, 0); __battery_hook_unregister(hook, 0);
return; goto end;
} }
} }
pr_info("new extension: %s\n", hook->name); pr_info("new extension: %s\n", hook->name);
end:
mutex_unlock(&hook_mutex); mutex_unlock(&hook_mutex);
} }
EXPORT_SYMBOL_GPL(battery_hook_register); EXPORT_SYMBOL_GPL(battery_hook_register);
...@@ -732,7 +733,7 @@ EXPORT_SYMBOL_GPL(battery_hook_register); ...@@ -732,7 +733,7 @@ EXPORT_SYMBOL_GPL(battery_hook_register);
*/ */
static void battery_hook_add_battery(struct acpi_battery *battery) static void battery_hook_add_battery(struct acpi_battery *battery)
{ {
struct acpi_battery_hook *hook_node; struct acpi_battery_hook *hook_node, *tmp;
mutex_lock(&hook_mutex); mutex_lock(&hook_mutex);
INIT_LIST_HEAD(&battery->list); INIT_LIST_HEAD(&battery->list);
...@@ -744,15 +745,15 @@ static void battery_hook_add_battery(struct acpi_battery *battery) ...@@ -744,15 +745,15 @@ static void battery_hook_add_battery(struct acpi_battery *battery)
* when a battery gets hotplugged or initialized * when a battery gets hotplugged or initialized
* during the battery module initialization. * during the battery module initialization.
*/ */
list_for_each_entry(hook_node, &battery_hook_list, list) { list_for_each_entry_safe(hook_node, tmp, &battery_hook_list, list) {
if (hook_node->add_battery(battery->bat)) { if (hook_node->add_battery(battery->bat)) {
/* /*
* The notification of the extensions has failed, to * The notification of the extensions has failed, to
* prevent further errors we will unload the extension. * prevent further errors we will unload the extension.
*/ */
__battery_hook_unregister(hook_node, 0);
pr_err("error in extension, unloading: %s", pr_err("error in extension, unloading: %s",
hook_node->name); hook_node->name);
__battery_hook_unregister(hook_node, 0);
} }
} }
mutex_unlock(&hook_mutex); mutex_unlock(&hook_mutex);
......
...@@ -481,8 +481,14 @@ static int topology_get_acpi_cpu_tag(struct acpi_table_header *table, ...@@ -481,8 +481,14 @@ static int topology_get_acpi_cpu_tag(struct acpi_table_header *table,
if (cpu_node) { if (cpu_node) {
cpu_node = acpi_find_processor_package_id(table, cpu_node, cpu_node = acpi_find_processor_package_id(table, cpu_node,
level, flag); level, flag);
/* Only the first level has a guaranteed id */ /*
if (level == 0) * As per specification if the processor structure represents
* an actual processor, then ACPI processor ID must be valid.
* For processor containers ACPI_PPTT_ACPI_PROCESSOR_ID_VALID
* should be set if the UID is valid
*/
if (level == 0 ||
cpu_node->flags & ACPI_PPTT_ACPI_PROCESSOR_ID_VALID)
return cpu_node->acpi_processor_id; return cpu_node->acpi_processor_id;
return ACPI_PTR_DIFF(cpu_node, table); return ACPI_PTR_DIFF(cpu_node, table);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment