lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3BF1E193-F115-47F6-8412-895A39A27289@gmail.com>
Date: Tue, 29 Apr 2025 20:17:18 -0700
From: "Derek J. Clark" <derekjohn.clark@...il.com>
To: ALOK TIWARI <alok.a.tiwari@...cle.com>, Hans de Goede <hdegoede@...hat.com>,
 Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
CC: Armin Wolf <W_Armin@....de>, Jonathan Corbet <corbet@....net>,
 Mario Limonciello <superm1@...nel.org>, Luke Jones <luke@...nes.dev>,
 Xino Ni <nijs1@...ovo.com>, Zhixin Zhang <zhangzx36@...ovo.com>,
 Mia Shao <shaohz1@...ovo.com>, Mark Pearson <mpearson-lenovo@...ebb.ca>,
 "Pierre-Loup A . Griffais" <pgriffais@...vesoftware.com>,
 "Cody T . -H . Chiu" <codyit@...il.com>, John Martens <johnfanv2@...il.com>,
 platform-driver-x86@...r.kernel.org, linux-doc@...r.kernel.org,
 linux-kernel@...r.kernel.org, Mario Limonciello <mario.limonciello@....com>
Subject: Re: [PATCH v6 2/6] platform/x86: Add Lenovo WMI Helpers



On April 28, 2025 12:36:03 PM PDT, ALOK TIWARI <alok.a.tiwari@...cle.com> wrote:
>> diff --git a/drivers/platform/x86/lenovo-wmi-helpers.c b/drivers/platform/x86/lenovo-wmi-helpers.c
>> new file mode 100644
>> index 000000000000..2df0408e2a9c
>> --- /dev/null
>> +++ b/drivers/platform/x86/lenovo-wmi-helpers.c
>> @@ -0,0 +1,74 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later
>> +/*
>> + * Lenovo Legion WMI helpers driver.
>> + *
>> + * The Lenovo Legion WMI interface is broken up into multiple GUID interfaces
>> + * that require cross-references between GUID's for some functionality. The
>> + * "Custom Mode" interface is a legacy interface for managing and displaying
>> + * CPU & GPU power and hwmon settings and readings. The "Other Mode" interface
>> + * is a modern interface that replaces or extends the "Custom Mode" interface
>> + * methods. The "Gamezone" interface adds advanced features such as fan
>> + * profiles and overclocking. The "Lighting" interface adds control of various
>> + * status lights related to different hardware components. Each of these
>> + * drivers uses a common procedure to get data from the WMI interface,
>> + * enumerated here.
>> + *
>> + * Copyright(C) 2025 Derek J. Clark <derekjohn.clark@...il.com>
>> + */
>
>add a space after "Copyright" before "(C)".
>Copyright (C) 2025
>
>> +
>> +#include <linux/acpi.h>
>> +#include <linux/cleanup.h>
>> +#include <linux/errno.h>
>> +#include <linux/export.h>
>> +#include <linux/module.h>
>> +#include <linux/wmi.h>
>> +
>> +#include "lenovo-wmi-helpers.h"
>> +
>> +/**
>> + * lwmi_dev_evaluate_int() - Helper function for calling WMI methods that
>> + * return an integer.
>> + * @wdev: Pointer to the WMI device to be called.
>> + * @instance: Instance of the called method.
>> + * @method_id: WMI Method ID for the method to be called.
>> + * @buf: Buffer of all arguments for the given method_id.
>> + * @size: Length of the buffer.
>> + * @retval: Pointer for the return value to be assigned.
>> + *
>> + * Calls wmidev_valuate_method for Lenovo WMI devices that return an ACPI
>> + * integer. Validates the return value type and assigns the value to the
>> + * retval pointer.
>
>assuming you meant to refer to wmidev_evaluate_method, the real function
>typo wmidev_valuate_method -> wmidev_evaluate_method
>
>> + *
>> + * Return: 0 on success, or an error code.
>> + */
>> +int lwmi_dev_evaluate_int(struct wmi_device *wdev, u8 instance, u32 method_id,
>> +			  unsigned char *buf, size_t size, u32 *retval)
>> +{
>> +	struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
>> +	union acpi_object *ret_obj __free(kfree) = NULL;
>> +	struct acpi_buffer input = { size, buf };
>> +	acpi_status status;
>> +
>> +	status = wmidev_evaluate_method(wdev, instance, method_id, &input,
>> +					&output);
>> +
>> +	if (ACPI_FAILURE(status))
>> +		return -EIO;
>> +
>> +	if (retval) {
>> +		ret_obj = output.pointer;
>> +		if (!ret_obj)
>> +			return -ENODATA;
>> +
>> +		if (ret_obj->type != ACPI_TYPE_INTEGER)
>> +			return -ENXIO;
>> +
>> +		*retval = (u32)ret_obj->integer.value;
>> +	}
>> +	return 0;
>> +};
>
>Thanks,
>Alok

Ack all. Thanks for taking a look.
- Derek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ