Re: [PATCH v7 1/2] hwmon: (asus_wmi_ec_sensors) Support B550 Asus WMI.

From: Eugene Shalygin
Date: Fri Oct 15 2021 - 10:49:57 EST


Hi, Andy,

On Fri, 15 Oct 2021 at 16:37, Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:
> I didn't get it. If there is a strong endianess expected the parameter
> should be __le16 or __be16, moreover it seems it missed the const
> qualifier. Any preparatory stuff should be done in the
> asus_wmi_ec_make_block_read_query() which prepares the input buffer,
> doesn't it?

We need to produce and parse a, roughly speaking, hex-BSTR to pass it
to the WMI function (save for its size parameter of 16 bits instead of
32 for the BSTR). bin/hex conversion functions accept/output UTF-8
strings and thus require an intermediate buffer and additional utf-8
<-> utf-16 conversion. Do you insist that a loop with a stride of 4 is
a homegrown library already?

> > > What's the point of calling acpi_os_free(obj) when you already know it's NULL?
> >
> > The case when obj->type != ACPI_TYPE_BUFFER
>
> Read my comment again, please.

I did it twice already and still can't understand. The WMI method can
return a string, for example, which is an error for our code, but the
buffer needs to be freed.

Regards,
Eugene