From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Denis Pauk <pauk.denis@gmail.com>
Cc: eugene.shalygin@gmail.com, platform-driver-x86@vger.kernel.org,
thomas@weissschuh.net, Tor Vic <torvic9@mailbox.org>,
Oleksandr Natalenko <oleksandr@natalenko.name>,
Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>,
Jonathan Corbet <corbet@lwn.net>,
linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 1/3] hwmon: (asus_wmi_ec_sensors) Support B550 Asus WMI.
Date: Mon, 25 Oct 2021 22:49:02 +0300 [thread overview]
Message-ID: <YXcKLvRu3gRm3zUF@smile.fi.intel.com> (raw)
In-Reply-To: <YXcHYvleoOr6sqMK@smile.fi.intel.com>
On Mon, Oct 25, 2021 at 10:37:06PM +0300, Andy Shevchenko wrote:
> On Mon, Oct 25, 2021 at 10:20:17PM +0300, Andy Shevchenko wrote:
> > On Fri, Oct 22, 2021 at 11:00:29PM +0300, Denis Pauk wrote:
...
> > Below is a follow up, I have not compiled it.
> > Feel free to take fully or partially.
Okay, here a few additional fixes (make them symmetrical and hope that
it will compile now):
diff --git a/drivers/hwmon/asus_wmi_ec_sensors.c b/drivers/hwmon/asus_wmi_ec_sensors.c
index 870de5a7f20d..d39271b5e50c 100644
--- a/drivers/hwmon/asus_wmi_ec_sensors.c
+++ b/drivers/hwmon/asus_wmi_ec_sensors.c
@@ -261,10 +261,7 @@ static int asus_wmi_ec_fill_board_sensors(struct asus_wmi_ec_info *ec,
static int asus_wmi_ec_decode_reply_buffer(const u8 *in, u32 length, u8 *out)
{
char buffer[ASUSWMI_MAX_BUF_LEN * 2];
- u32 len;
-
- /* Minimum of size of response and size of ACPI result (in bytes) */
- len = min_t(u32, in[0], length - 2);
+ u32 len = min_t(u32, get_unaligned_le16(in), length - 2);
utf16s_to_utf8s((wchar_t *)(in + 2), len / 2, UTF16_LITTLE_ENDIAN, buffer, sizeof(buffer));
@@ -274,13 +271,13 @@ static int asus_wmi_ec_decode_reply_buffer(const u8 *in, u32 length, u8 *out)
static void asus_wmi_ec_encode_registers(const u8 *in, u32 length, char *out)
{
char buffer[ASUSWMI_MAX_BUF_LEN * 2];
- u16 len = nr_registers * 2;
-
- put_unaligned_le16(len * 2, out);
+ u32 len = length;
bin2hex(buffer, in, len);
utf8s_to_utf16s(buffer, len * 2, UTF16_LITTLE_ENDIAN, (wchar_t *)(out + 2), len);
+
+ put_unaligned_le16(len * 2, out);
}
static void asus_wmi_ec_make_block_read_query(struct asus_wmi_ec_info *ec)
@@ -298,7 +295,7 @@ static void asus_wmi_ec_make_block_read_query(struct asus_wmi_ec_info *ec)
}
}
- asus_wmi_ec_encode_registers(registers, ec->nr_registers, ec->read_arg);
+ asus_wmi_ec_encode_registers(registers, offset, ec->read_arg);
}
static int asus_wmi_ec_block_read(u32 method_id, char *query, u8 *out)
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2021-10-25 20:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-22 20:00 [PATCH v8 0/3] Update ASUS WMI supported boards Denis Pauk
2021-10-22 20:00 ` [PATCH v8 1/3] hwmon: (asus_wmi_ec_sensors) Support B550 Asus WMI Denis Pauk
2021-10-25 14:42 ` Guenter Roeck
2021-10-25 19:20 ` Andy Shevchenko
2021-10-25 19:37 ` Andy Shevchenko
2021-10-25 19:49 ` Andy Shevchenko [this message]
2021-10-26 19:58 ` Denis Pauk
2021-10-27 9:00 ` Andy Shevchenko
2021-10-22 20:00 ` [PATCH v8 2/3] hwmon: (asus_wmi_sensors) Support X370 " Denis Pauk
2021-10-25 15:10 ` Guenter Roeck
2021-10-22 20:00 ` [PATCH v8 3/3] hwmon: (nct6775) Add ProArt X570-CREATOR WIFI support Denis Pauk
2021-10-25 14:32 ` Guenter Roeck
2021-10-25 9:34 ` [PATCH v8 0/3] Update ASUS WMI supported boards Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YXcKLvRu3gRm3zUF@smile.fi.intel.com \
--to=andy.shevchenko@gmail.com \
--cc=corbet@lwn.net \
--cc=eugene.shalygin@gmail.com \
--cc=jdelvare@suse.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=oleksandr@natalenko.name \
--cc=pauk.denis@gmail.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=thomas@weissschuh.net \
--cc=torvic9@mailbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).