Re: [PATCH v10 03/14] HP BIOSCFG driver - bioscfg

From: Hans de Goede
Date: Tue Apr 25 2023 - 11:00:37 EST


Hi,

On 4/25/23 16:32, Jorge Lopez wrote:
> On Tue, Apr 25, 2023 at 5:34 AM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
>>
>> Hi All,
>>
>> On 4/19/23 20:04, Armin Wolf wrote:
>>> Am 19.04.23 um 17:13 schrieb Jorge Lopez:
>>
>> <snip>
>>
>>>> +static int __init bioscfg_init(void)
>>>> +{
>>>> + int ret = 0;
>>>> + int bios_capable = wmi_has_guid(HP_WMI_BIOS_GUID);
>>>> +
>>>> + if (!bios_capable) {
>>>> + pr_err("Unable to run on non-HP system\n");
>>>> + return -ENODEV;
>>>> + }
>>>> +
>>>
>>> Currently, this driver will no get automatically loaded on supported hardware,
>>> something which would be quite beneficial for users to have.
>>> Since the HP_WMI_BIOS_GUID is already handled by the hp-wmi driver, maybe this
>>> driver (which also already implements a function similar to hp_wmi_perform_query())
>>> could register a platform device which is then used by this driver? This together
>>> with MODULE_DEVICE_TABLE() would allow for automatically loading the module on supported hardware.
>>
>> Both drivers can already co-exist since the old hp-wmi driver uses the old
>> wmi kernel functions and is not a "wmi_driver" so there is no need for
>> a platform_device for this driver to bind to since the wmi_device is
>> still free for it to bind to.
>>
>> This does indeed need a MODULE_DEVICE_TABLE() statement for
>> the bios_attr_pass_interface_id_table[] id-table. Note only for that
>> table, because the HP_WMI_BIOS_GUID is present on models which do
>> not support this and we don't want the module to auto-load there.
>>
>
> I am considering adding a check for the HP_WMI_SET_BIOS_SETTING_GUID
> and HP_WMI_BIOS_GUID during the initialization process.
> The driver will report a message If HP_WMI_SET_BIOS_SETTING_GUID is
> found or not.
> If HP_WMI_SET_BIOS_SETTING_GUID does not exist, the driver cannot
> change the BIOS settings.

Right, adding a check for HP_WMI_BIOS_GUID to bioscfg_init()
sounds like a good idea.

That + add a a MODULE_DEVICE_TABLE() statement to
the bios_attr_pass_interface_id_table[] id-table.

Regards,

Hans