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: <2b48b41d-7d82-470a-a40e-c8f3c9de94dd@roeck-us.net>
Date:   Sat, 4 Nov 2023 09:29:43 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     James Seo <james@...iv.tech>
Cc:     Jean Delvare <jdelvare@...e.com>,
        Lukasz Stelmach <l.stelmach@...sung.com>,
        Armin Wolf <W_Armin@....de>, linux-hwmon@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [RFC] hwmon: (hp-wmi-sensors) Fix failure to load on EliteDesk
 800 G6

On 11/4/23 09:07, James Seo wrote:
> On Fri, Nov 03, 2023 at 12:36:49PM -0700, Guenter Roeck wrote:
>> On 11/3/23 11:19, James Seo wrote:
>>> +static bool is_raw_wmi_string(const acpi_object_type property_map[], int prop)
>>> +{
>>> +	const char *board_name;
>>> +
>>> +	if (property_map != hp_wmi_platform_events_property_map ||
>>> +	    prop != HP_WMI_PLATFORM_EVENTS_PROPERTY_NAME)
>>> +		return false;
>>> +
>>> +	board_name = dmi_get_system_info(DMI_BOARD_NAME);
>>> +	if (!board_name)
>>> +		return false;
>>> +
>>> +	return !strcmp(board_name, HP_WMI_BOARD_NAME_ELITEDESK_800_G6);
>>
>> Would it be possible to use a dmi table and dmi_check_system() ?
>> That would make it easier to add more platforms later on if needed.
>>
>> Thanks,
>> Guenter
>>
> 
> Hi Guenter,
> 
> Sure, I can do something like this:
> 
> 
> #define HP_WMI_WSTR_INFO(name, wids) {					\
> 	.matches = {							\
> 		DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),	\
> 		DMI_EXACT_MATCH(DMI_BOARD_NAME, (name)),		\
> 	},								\
> 	.driver_data = (void *)(wids),					\
> }
> 

Quite frankly, I dislike multi-line macros because they make it (more)
difficult to understand the code. If that is where you want to go,
I'd rather keep the current code (or wait until someone else maintains
the hwmon subsystem).

> struct hp_wmi_wstr_id {
> 	const acpi_object_type *property_map;
> 	int prop;
> };
> 
> static const struct hp_wmi_wstr_id elitedesk_800_g6_wstr_ids[] = {
> 	{
> 		.property_map = hp_wmi_platform_events_property_map,
> 		.prop = HP_WMI_PLATFORM_EVENTS_PROPERTY_NAME,
> 	},
> 	{ },
> };
> 
> static const struct dmi_system_id hp_wmi_dmi_wstr_table[] = {
> 	HP_WMI_WSTR_INFO("870C", elitedesk_800_g6_wstr_ids),
> 	{ },
> };
> 
> static bool is_raw_wmi_string(const acpi_object_type property_map[], int prop)
> {
> 	const struct hp_wmi_wstr_id *wstr_id;
> 	const struct dmi_system_id *id;
> 
> 	id = dmi_first_match(hp_wmi_dmi_wstr_table);
> 	if (!id)
> 		return false;
> 
> 	wstr_id = id->driver_data;
> 	for (; wstr_id->property_map; wstr_id++)
> 		if (property_map == wstr_id->property_map &&
> 		    prop == wstr_id->prop)
> 			return true;
> 
> 	return false;
> }
> 
> 
> Out of curiosity, how would you feel about just adding full raw WMI string
> support now? It wouldn't take much more work and for various small reasons
> it's starting to look like a better idea to me.
> 

I don't know; I would have to see the code.

Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ