ACPI fixes for 4.18-rc4

- 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).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJbPf5UAAoJEILEb/54YlRxQjUQAJp1vfYp9w/zVT0fDQZIgkmS
 k1BYw5LonMhGOls0qd8laQJ5g7wgc9rIeA6/oT/eCkvJVzOqYN0y49EKBdevLuB6
 3K7NeFJtJwvQFPhQrrDBN2PL5SN6ZL9e16MxPZXeVrWN2wMAAdCZiDQN1QyEZNj2
 SeFBnMiG/oYiX/87/mkbmwJyG8QX9onH6VywwRP1YGOpPnt/oLtpb3nPHh+Ep85Z
 +k2LmICGdUbIadYLhO9UlvyWxaUoVIoyGt/p51vgB2wezfkqg6phKPbl3v1+3z0l
 90R4Ls968yzdnZ/09e8ywAy2pUOPQe1BfzSxSrmW0+QF+83tHoOV8xoMo32571pb
 /kJn+9qOa6SNfKDTK1thLbSQDgWe02qalWXmCcSyHcUbPaIeEozymyrdF8TZ6xmR
 W190C+yQlSS8428B8fI8kPsslg1ZDjqRT2eSnvlAogLYX/wHHN5qygtKHc2iWMso
 WL98G9KmcxIt6HtDKUCkW49mW1bACnD3RhrOVczCGPbyqk4asclsMFzqV1W+emMN
 d0XaELMkkMaKfLAx3UPS+xNeMAQ/gshfUPm/oMbSjYrHpI+9l8XEUsirdjf3QWiY
 8lBUtW7wZPqU8wjUtUh7e7P1F0UFHK4Dzp39IgCWuCnvuid/2mfBwAJ2LcTCaxzx
 mYHKZwkBqs68wvuVQM1S
 =8VBX
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2018-07-05 09:52:30 -07:00
commit 06c8563989
3 changed files with 16 additions and 9 deletions

View File

@ -182,19 +182,19 @@ acpi_ut_prefixed_namespace_error(const char *module_name,
switch (lookup_status) {
case AE_ALREADY_EXISTS:
acpi_os_printf("\n" ACPI_MSG_BIOS_ERROR);
acpi_os_printf(ACPI_MSG_BIOS_ERROR);
message = "Failure creating";
break;
case AE_NOT_FOUND:
acpi_os_printf("\n" ACPI_MSG_BIOS_ERROR);
acpi_os_printf(ACPI_MSG_BIOS_ERROR);
message = "Could not resolve";
break;
default:
acpi_os_printf("\n" ACPI_MSG_ERROR);
acpi_os_printf(ACPI_MSG_ERROR);
message = "Failure resolving";
break;
}

View File

@ -717,10 +717,11 @@ void battery_hook_register(struct acpi_battery_hook *hook)
*/
pr_err("extension failed to load: %s", hook->name);
__battery_hook_unregister(hook, 0);
return;
goto end;
}
}
pr_info("new extension: %s\n", hook->name);
end:
mutex_unlock(&hook_mutex);
}
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)
{
struct acpi_battery_hook *hook_node;
struct acpi_battery_hook *hook_node, *tmp;
mutex_lock(&hook_mutex);
INIT_LIST_HEAD(&battery->list);
@ -744,15 +745,15 @@ static void battery_hook_add_battery(struct acpi_battery *battery)
* when a battery gets hotplugged or initialized
* 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)) {
/*
* The notification of the extensions has failed, to
* prevent further errors we will unload the extension.
*/
__battery_hook_unregister(hook_node, 0);
pr_err("error in extension, unloading: %s",
hook_node->name);
__battery_hook_unregister(hook_node, 0);
}
}
mutex_unlock(&hook_mutex);

View File

@ -481,8 +481,14 @@ static int topology_get_acpi_cpu_tag(struct acpi_table_header *table,
if (cpu_node) {
cpu_node = acpi_find_processor_package_id(table, cpu_node,
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 ACPI_PTR_DIFF(cpu_node, table);
}