[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZUZsPO9aN+E3qAng@equiv.tech>
Date: Sat, 4 Nov 2023 09:07:24 -0700
From: James Seo <james@...iv.tech>
To: Guenter Roeck <linux@...ck-us.net>
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 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
Powered by blists - more mailing lists