public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: James Seo <james@equiv.tech>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Jean Delvare <jdelvare@suse.com>,
	Lukasz Stelmach <l.stelmach@samsung.com>,
	Armin Wolf <W_Armin@gmx.de>,
	linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] hwmon: (hp-wmi-sensors) Fix failure to load on EliteDesk 800 G6
Date: Sat, 4 Nov 2023 09:07:24 -0700	[thread overview]
Message-ID: <ZUZsPO9aN+E3qAng@equiv.tech> (raw)
In-Reply-To: <dec086cc-7403-4a06-b860-aae6daf8f0e7@roeck-us.net>

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),					\
}

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.

James

  reply	other threads:[~2023-11-04 16:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03 18:19 [RFC] hwmon: (hp-wmi-sensors) Fix failure to load on EliteDesk 800 G6 James Seo
2023-11-03 19:36 ` Guenter Roeck
2023-11-04 16:07   ` James Seo [this message]
2023-11-04 16:29     ` Guenter Roeck
2023-11-05 18:51       ` James Seo

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=ZUZsPO9aN+E3qAng@equiv.tech \
    --to=james@equiv.tech \
    --cc=W_Armin@gmx.de \
    --cc=jdelvare@suse.com \
    --cc=l.stelmach@samsung.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /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