All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: "Barnabás Pőcze" <pobrn@protonmail.com>
Cc: "platform-driver-x86@vger.kernel.org" 
	<platform-driver-x86@vger.kernel.org>,
	Mark Gross <mgross@linux.intel.com>,
	Hans de Goede <hdegoede@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Matthew Garrett <mjg59@srcf.ucam.org>
Subject: Re: [PATCH v2] platform/x86: add Gigabyte WMI temperature driver
Date: Thu, 8 Apr 2021 16:39:47 +0200	[thread overview]
Message-ID: <0c3ef6d2-6e95-4dd9-b9d4-41f5e70bc574@t-8ch.de> (raw)
In-Reply-To: <eAi-yoXOCIOZAGOkYXGYZrUI6OuRrL5Fn9xBzHI1tJSgURTkMRifhlz9OHPB5FUxYLLzMARFmIP0HHR5oPgQMS0LJkga6deoVol0MYQuceA=@protonmail.com>

Hi,

On Mi, 2021-04-07T18:27+0000, Barnabás Pőcze wrote:
> 2021. április 5., hétfő 22:48 keltezéssel, Thomas Weißschuh írta:
> > Tested with a X570 I Aorus Pro Wifi.
> > The mainboard contains an ITE IT8688E chip for management.
> > This chips is also handled by drivers/hwmon/i87.c but as it is also used
> > by the firmware itself it needs an ACPI driver.
> 
> I gather this means you're getting the
> 
>   ACPI Warning: SystemIO range ... conflicts with ...
>   ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
> 
> warning?

Exactly.

> > +struct gigabyte_wmi_args {
> > +	u32 arg1;
> > +};
> > +
> > +static int gigabyte_wmi_perform_query(enum gigabyte_wmi_commandtype command,
> > +		struct gigabyte_wmi_args *args, struct acpi_buffer *out)
> > +{
> > +	const struct acpi_buffer in = {
> > +		.length = sizeof(*args),
> > +		.pointer = args,
> > +	};
> > +
> > +	acpi_status ret = wmi_evaluate_method(GIGABYTE_WMI_GUID, 0x0, command, &in, out);
> 
> Ideally, you'd use the WMI device that was passed to the probe method to do the query
> using `wmidev_evaluate_method()`. You can pass the WMI device pointer
> to `devm_hwmon_device_register_with_info()` in the `drvdata` argument,
> then in the ->read() callback you can retrieve it:
> 
>   static int gigabyte_wmi_hwmon_read(struct device *dev, ...)
>   {
>     struct wmi_device *wdev = dev_get_drvdata(dev);
> 
> and then you can pass that to the other functions.

Done.

> > +	if (ret == AE_OK) {
> > +		return 0;
> > +	} else {
> > +		return -EIO;
> > +	};
> 
> The `;` is not needed. And please use `ACPI_FAILURE()` or `ACPI_SUCCESS()`
> to check the returned value. For example:
> 
>   acpi_status ret = ...;
>   if (ACPI_FAILURE(ret))
>     return -EIO;
> 
>   return 0;

Done.

> > +}
> > +
> > +static int gigabyte_wmi_query_integer(enum gigabyte_wmi_commandtype command,
> > +		struct gigabyte_wmi_args *args, u64 *res)
> > +{
> > +	union acpi_object *obj;
> > +	struct acpi_buffer result = { ACPI_ALLOCATE_BUFFER, NULL };
> > +	int ret;
> > +
> > +	ret = gigabyte_wmi_perform_query(command, args, &result);
> > +	if (ret) {
> > +		goto out;
> 
> I believe if this branch is taken, no buffer is allocated (due to the failure),
> so you can just `return ret;` here and do away with the goto completely - if I'm not mistaken.

Done.

> > +static const struct hwmon_channel_info *gigabyte_wmi_hwmon_info[] = {
> > +	HWMON_CHANNEL_INFO(temp,
> > +			HWMON_T_INPUT,
> > +			HWMON_T_INPUT,
> > +			HWMON_T_INPUT,
> > +			HWMON_T_INPUT,
> > +			HWMON_T_INPUT,
> > +			HWMON_T_INPUT),
> > +	NULL,
>             ^
> Minor thing: usually commas after sentinel values are omitted.

Done.

> > +static const struct wmi_device_id gigabyte_wmi_id_table[] = {
> > +	{ GIGABYTE_WMI_GUID, NULL },
> > +	{ },
>            ^
> Same here.

Done.

> 
> > +};
> > +
> > +static struct wmi_driver gigabyte_wmi_driver = {
> > +	.driver = {
> > +		.name = "gigabyte-wmi",
> > +	},
> > +	.id_table = gigabyte_wmi_id_table,
> > +	.probe = gigabyte_wmi_probe,
> > +};
> > +module_wmi_driver(gigabyte_wmi_driver);
> > +
> > +MODULE_DEVICE_TABLE(wmi, gigabyte_wmi_id_table);
> > +MODULE_AUTHOR("Thomas Weißschuh <thomas@weissschuh.net>");
> > +MODULE_DESCRIPTION("Gigabyte Temperature WMI Driver");
> 
> It's a very minor thing, but could you please
> synchronize this description with the Kconfig?

Of course.

Thanks again for the review!

Thomas

  reply	other threads:[~2021-04-08 14:40 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-05 13:20 [PATCH] platform/x86: add Gigabyte WMI temperature driver Thomas Weißschuh
2021-04-05 17:13 ` Barnabás Pőcze
2021-04-05 20:48   ` [PATCH v2] " Thomas Weißschuh
2021-04-07 15:54     ` Hans de Goede
2021-04-07 19:43       ` Thomas Weißschuh
2021-04-08  9:36         ` Hans de Goede
2021-04-08 14:54           ` Thomas Weißschuh
2021-04-08 15:00           ` Guenter Roeck
2021-04-09  6:02             ` Thomas Weißschuh
2021-04-10  6:56               ` Guenter Roeck
2021-04-10 14:21                 ` Hans de Goede
2021-04-10 14:40                   ` [PATCH v3] " Thomas Weißschuh
2021-04-10 14:57                     ` Hans de Goede
2021-04-10 15:21                       ` Guenter Roeck
2021-04-10 15:15                     ` Guenter Roeck
2021-04-10 15:23                       ` Hans de Goede
2021-04-10 18:18                         ` [PATCH v4] " Thomas Weißschuh
2021-04-11  0:58                           ` Guenter Roeck
2021-04-11 14:05                           ` Barnabás Pőcze
2021-04-12 12:35                           ` [PATCH v5] " Thomas Weißschuh
2021-04-13  8:14                             ` Hans de Goede
2021-04-07 18:27     ` [PATCH v2] " Barnabás Pőcze
2021-04-08 14:39       ` Thomas Weißschuh [this message]
2021-04-08 15:08     ` Guenter Roeck
2021-04-08 16:07       ` Hans de Goede
2021-04-10  6:40         ` Guenter Roeck

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=0c3ef6d2-6e95-4dd9-b9d4-41f5e70bc574@t-8ch.de \
    --to=linux@weissschuh.net \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgross@linux.intel.com \
    --cc=mjg59@srcf.ucam.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=pobrn@protonmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.