[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAB95QASk7JGqP2_qLtkb-PXUmKPDMcOvLr_8FLrKpv3S2602mw@mail.gmail.com>
Date: Sat, 2 Oct 2021 23:56:20 +0200
From: Eugene Shalygin <eugene.shalygin@...il.com>
To: Denis Pauk <pauk.denis@...il.com>
Cc: Andy Shevchenko <andriy.shevchenko@...el.com>,
Guenter Roeck <linux@...ck-us.net>,
Jean Delvare <jdelvare@...e.com>, linux-kernel@...r.kernel.org,
linux-hwmon@...r.kernel.org
Subject: Re: [PATCH 3/3] hwmon: (asus_wmi_sensors) Support access via Asus WMI.
Hi, Denis!
Thank you for submitting this driver to the mainline! I have a few
comments/suggestions, please find them below.
> +#define HWMON_MAX 9
There is a hwmon_max enum member, whose current value is 10.
> +#define ASUS_WMI_BLOCK_READ_REGISTERS_MAX 0x10 /* from the ASUS DSDT source */
> +/* from the ASUS_WMI_BLOCK_READ_REGISTERS_MAX value */
> +#define ASUS_WMI_MAX_BUF_LEN 0x80
Suggestion:
#define ASUS_WMI_MAX_BUF_LEN 0x80 /* from the
ASUS_WMI_BLOCK_READ_REGISTERS_MAX value */
> +#define ASUSWMI_SENSORS_MAX 11
This one is for the EC only, maybe rename it accordingly?
> +struct asus_wmi_data {
> + int ec_board;
> +};
Duplicates the value in the asus_wmi_sensors struct. Refactoring artifact?
asus_wmi_ec_set_sensor_info(si++, "Water", hwmon_fan,
> + asus_wmi_ec_make_sensor_address(2, 0x00, 0xBC),
> + &ec->nr_registers);
This one is named "W_FLOW" in the BIOS and ASUS software. Maybe append
"_flow" to the label?
> + * The next four functions converts to/from BRxx string argument format
convert (remove "s")
> + // assert(len <= 30)
Makes little sense in the kernel.
> +static void asus_wmi_ec_make_block_read_query(struct asus_wmi_ec_info *ec)
> +{
> + u16 registers[ASUS_EC_KNOWN_EC_REGISTERS];
> + u8 i, j, register_idx = 0;
> +
> + /* if we can get values for all the registers in a single query,
> + * the query will not change from call to call
> + */
> + if (ec->nr_registers <= ASUS_WMI_BLOCK_READ_REGISTERS_MAX &&
> + ec->read_arg[0] > 0) {
> + /* no need to update */
> + return;
> + }
> +
I would add a test for ec->nr_registers >
ASUS_WMI_BLOCK_READ_REGISTERS_MAX and a warning log message here.
> +static int asus_wmi_probe(struct platform_device *pdev)
Can we add a module alias or to load the module automatically by other
means? For module aliases we know DMI parameters for the supported
boards.
Best regards,
Eugene
Powered by blists - more mailing lists