Re: [PATCH v2 2/4] ACPI: x86: Add pm_debug_messages for LPS0 _DSM state tracking

From: andy . shevchenko
Date: Tue May 23 2023 - 12:49:29 EST


Mon, May 22, 2023 at 03:00:31PM -0500, Mario Limonciello kirjoitti:
> Enabling debugging messages for the state requires turning on dynamic
> debugging for the file. To make it more accessible, use
> `pm_debug_messages` and clearer strings for what is happening.

...

> + switch (state) {
> + case ACPI_LPS0_SCREEN_OFF:
> + return "screen off";
> + case ACPI_LPS0_SCREEN_ON:
> + return "screen on";
> + case ACPI_LPS0_ENTRY:
> + return "lps0 entry";
> + case ACPI_LPS0_EXIT:
> + return "lps0 exit";
> + case ACPI_LPS0_MS_ENTRY:
> + return "lps0 ms entry";
> + case ACPI_LPS0_MS_EXIT:
> + return "lps0 ms exit";

No default?

> + }

...

> + switch (state) {
> + case ACPI_LPS0_SCREEN_ON_AMD:
> + return "screen on";
> + case ACPI_LPS0_SCREEN_OFF_AMD:
> + return "screen off";
> + case ACPI_LPS0_ENTRY_AMD:
> + return "lps0 entry";
> + case ACPI_LPS0_EXIT_AMD:
> + return "lps0 exit";
> + }
> + }
> +
> + return "unknown";

Make it default in each switch-case. That way we might have an option to alter
them if needed.

...

> - acpi_handle_debug(lps0_device_handle, "_DSM function %u evaluation %s\n",
> - func, out_obj ? "successful" : "failed");
> + lps0_dsm_state = func;
> + if (pm_debug_messages_on) {
> + acpi_handle_info(lps0_device_handle,
> + "%s transitioned to state %s\n",
> + out_obj ? "Successfully" : "Failed to",
> + acpi_sleep_dsm_state_to_str(lps0_dsm_state));
> + }

Can we keep the original choice (i.e.

? "successful" : "failed");

) unmodified? The rationale is that we migh add something like
str_successful_failed() to the string_helpers.h for wider use and common
standardization.

--
With Best Regards,
Andy Shevchenko