[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAB95QAQMP58-H427+nASKBvHOHZtLQqgRBSPa+MqGU7_D42M2Q@mail.gmail.com>
Date: Fri, 15 Oct 2021 16:25:57 +0200
From: Eugene Shalygin <eugene.shalygin@...il.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Denis Pauk <pauk.denis@...il.com>,
Platform Driver <platform-driver-x86@...r.kernel.org>,
thomas@...ssschuh.net, Tor Vic <torvic9@...lbox.org>,
Oleksandr Natalenko <oleksandr@...alenko.name>,
kernel test robot <lkp@...el.com>,
Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
Jonathan Corbet <corbet@....net>, linux-hwmon@...r.kernel.org,
Linux Documentation List <linux-doc@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v7 1/2] hwmon: (asus_wmi_ec_sensors) Support B550 Asus WMI.
Hi, Andy,
> > +#define ASUSWMI_METHODID_BREC 0x42524543
>
> ...above has definitely an ASCII combination in hex format, care to
> decode it in the comment?
This is a constant from the WMI dispatch function, the number is a
four-letter ASCII-encoded method name, here BREC, which is already
noted in the define identifier. Is it needed to repeat that?
> > + utf16s_to_utf8s((wchar_t *)data, len * 2, UTF16_LITTLE_ENDIAN, buffer, len * 2);
>
> > + for (i = 0; i < len; i++, pos += 2)
> > + out[i] = (hex_to_bin(pos[0]) << 4) + hex_to_bin(pos[1]);
>
> NIH hex2bin().
Does it make sense to call hex2bin() with size = 1?
> > + for (i = 0; i < len; i++) {
> > + byte = registers[i] >> 8;
> > + *pos = hex_asc_hi(byte);
> > + pos++;
> > + *pos = hex_asc_lo(byte);
> > + pos++;
> > + byte = registers[i];
> > + *pos = hex_asc_hi(byte);
> > + pos++;
> > + *pos = hex_asc_lo(byte);
> > + pos++;
> > + }
>
> NIH bin2hex()
bin2hex() can't output UTF-16LE characters, can it? It would need an
intermediate buffer and a call to convert ASCII (UTF-8) to UTF-16.
> > + obj = output.pointer;
> > + if (!obj || obj->type != ACPI_TYPE_BUFFER) {
>
> > + acpi_os_free(obj);
>
> 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
Regards,
Eugene
Powered by blists - more mailing lists