Re: [PATCH] platform/x86: thinkpad_acpi: Read EC information on newer models

From: Andy Shevchenko
Date: Fri Apr 05 2019 - 10:38:27 EST


On Fri, Mar 8, 2019 at 3:15 PM Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx> wrote:
>
> Newer ThinkPads have a totally different EC program information DMI
> table. And thermal subdriver can't work without correct EC version.
>
> Read from this entry if the old method failed to get EC information.
>

Thank you for the patch. See my comments below.

> Signed-off-by: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>
> ---
> drivers/platform/x86/thinkpad_acpi.c | 62 ++++++++++++++++++++++------
> 1 file changed, 49 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
> index 2e24ee42a3c6..17fd2065000b 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -9959,6 +9959,37 @@ static char __init tpacpi_parse_fw_id(const char * const s,
> return '\0';
> }
>
> +static void find_new_ec_fwstr(const struct dmi_header *dm, void *private)
> +{

Today it's a new one, tomorrow something else might come. Care to use
versioning instead?
Something line find_ec_fwstr_vXYZ().

> +}

> - tp->ec_version_str = kstrdup(ec_fw_string, GFP_KERNEL);
> - if (!tp->ec_version_str)
> - return -ENOMEM;

>
> - t = tpacpi_parse_fw_id(ec_fw_string,
> - &tp->ec_model, &tp->ec_release);
> - if (t != 'H') {
> - pr_notice("ThinkPad firmware release %s doesn't match the known patterns\n",
> - ec_fw_string);
> - pr_notice("please report this to %s\n",
> - TPACPI_MAIL);
> - }

Seems to me that this is the same to below. Can you leave indentation
in place and fix it in a separate (following) patch?

> - break;
> + if (ec_fw_string[0]) {
> + tp->ec_version_str = kstrdup(ec_fw_string, GFP_KERNEL);
> + if (!tp->ec_version_str)
> + return -ENOMEM;
> +
> + t = tpacpi_parse_fw_id(ec_fw_string,
> + &tp->ec_model, &tp->ec_release);
> + if (t != 'H') {
> + pr_notice("ThinkPad firmware release %s doesn't match the known patterns\n",
> + ec_fw_string);
> + pr_notice("please report this to %s\n", TPACPI_MAIL);
> }
> }


--
With Best Regards,
Andy Shevchenko