mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-16 01:04:08 +08:00
ACPI: utils: Introduce acpi_evaluation_failure_warn()
Quite a few users of ACPI objects want to log a warning message if the evaluation fails which is a repeating pattern, so introduce a helper function for that purpose and convert some code where it is open-coded to using it. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
a030fee8db
commit
4c324548f0
@ -256,8 +256,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)
|
||||
status = acpi_walk_resources(handle, METHOD_NAME__CRS,
|
||||
acpi_pci_link_check_current, &irq);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_handle_warn(handle, "_CRS evaluation failed: %s\n",
|
||||
acpi_format_exception(status));
|
||||
acpi_evaluation_failure_warn(handle, "_CRS", status);
|
||||
result = -ENODEV;
|
||||
goto end;
|
||||
}
|
||||
@ -345,8 +344,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
|
||||
|
||||
/* check for total failure */
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_handle_warn(handle, "_SRS evaluation failed: %s",
|
||||
acpi_format_exception(status));
|
||||
acpi_evaluation_failure_warn(handle, "_SRS", status);
|
||||
result = -ENODEV;
|
||||
goto end;
|
||||
}
|
||||
|
@ -67,9 +67,7 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
|
||||
acpi_processor_ppc_in_use = true;
|
||||
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_handle_warn(pr->handle,
|
||||
"_PPC evaluation failed: %s\n",
|
||||
acpi_format_exception(status));
|
||||
acpi_evaluation_failure_warn(pr->handle, "_PPC", status);
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
@ -199,8 +197,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
|
||||
|
||||
status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_handle_warn(pr->handle, "_PCT evaluation failed: %s\n",
|
||||
acpi_format_exception(status));
|
||||
acpi_evaluation_failure_warn(pr->handle, "_PCT", status);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@ -300,8 +297,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
|
||||
|
||||
status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_handle_warn(pr->handle, "_PSS evaluation failed: %s\n",
|
||||
acpi_format_exception(status));
|
||||
acpi_evaluation_failure_warn(pr->handle, "_PSS", status);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
@ -281,9 +281,7 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
|
||||
status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
if (status != AE_NOT_FOUND)
|
||||
acpi_handle_warn(pr->handle,
|
||||
"_TPC evaluation failed: %s\n",
|
||||
acpi_format_exception(status));
|
||||
acpi_evaluation_failure_warn(pr->handle, "_TPC", status);
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
@ -416,9 +414,7 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
|
||||
status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
if (status != AE_NOT_FOUND)
|
||||
acpi_handle_warn(pr->handle,
|
||||
"_PTC evaluation failed: %s\n",
|
||||
acpi_format_exception(status));
|
||||
acpi_evaluation_failure_warn(pr->handle, "_PTC", status);
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
@ -503,9 +499,7 @@ static int acpi_processor_get_throttling_states(struct acpi_processor *pr)
|
||||
status = acpi_evaluate_object(pr->handle, "_TSS", NULL, &buffer);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
if (status != AE_NOT_FOUND)
|
||||
acpi_handle_warn(pr->handle,
|
||||
"_TSS evaluation failed: %s\n",
|
||||
acpi_format_exception(status));
|
||||
acpi_evaluation_failure_warn(pr->handle, "_TSS", status);
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
@ -586,9 +580,7 @@ static int acpi_processor_get_tsd(struct acpi_processor *pr)
|
||||
status = acpi_evaluate_object(pr->handle, "_TSD", NULL, &buffer);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
if (status != AE_NOT_FOUND)
|
||||
acpi_handle_warn(pr->handle,
|
||||
"_TSD evaluation failed: %s\n",
|
||||
acpi_format_exception(status));
|
||||
acpi_evaluation_failure_warn(pr->handle, "_TSD", status);
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
|
@ -511,6 +511,20 @@ __acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle,
|
||||
EXPORT_SYMBOL(__acpi_handle_debug);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* acpi_evaluation_failure_warn - Log evaluation failure warning.
|
||||
* @handle: Parent object handle.
|
||||
* @name: Name of the object whose evaluation has failed.
|
||||
* @status: Status value returned by the failing object evaluation.
|
||||
*/
|
||||
void acpi_evaluation_failure_warn(acpi_handle handle, const char *name,
|
||||
acpi_status status)
|
||||
{
|
||||
acpi_handle_warn(handle, "%s evaluation failed: %s\n", name,
|
||||
acpi_format_exception(status));
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(acpi_evaluation_failure_warn);
|
||||
|
||||
/**
|
||||
* acpi_has_method: Check whether @handle has a method named @name
|
||||
* @handle: ACPI device handle
|
||||
|
@ -1027,9 +1027,14 @@ static inline void acpi_ec_set_gpe_wake_mask(u8 action) {}
|
||||
__printf(3, 4)
|
||||
void acpi_handle_printk(const char *level, acpi_handle handle,
|
||||
const char *fmt, ...);
|
||||
void acpi_evaluation_failure_warn(acpi_handle handle, const char *name,
|
||||
acpi_status status);
|
||||
#else /* !CONFIG_ACPI */
|
||||
static inline __printf(3, 4) void
|
||||
acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
|
||||
static inline void acpi_evaluation_failure_warn(acpi_handle handle,
|
||||
const char *name,
|
||||
acpi_status status) {}
|
||||
#endif /* !CONFIG_ACPI */
|
||||
|
||||
#if defined(CONFIG_ACPI) && defined(CONFIG_DYNAMIC_DEBUG)
|
||||
|
Loading…
Reference in New Issue
Block a user