Re: [PATCH v3 2/6] platform/x86: huawei-wmi: Add quirks and module parameters

From: Takashi Iwai
Date: Fri Sep 20 2019 - 03:29:14 EST


On Fri, 20 Sep 2019 09:24:08 +0200,
Hans de Goede wrote:
>
> Hi,
>
> On 20-09-2019 08:08, Greg Kroah-Hartman wrote:
> > On Thu, Sep 19, 2019 at 08:39:07PM -0400, Ayman Bagabas wrote:
> >> Introduce quirks and module parameters. 3 quirks are added:
> >> 1. Fixes reporting brightness keys twice since it's already handled by
> >> acpi-video.
> >> 2. Some models need a short delay when setting battery thresholds to
> >> prevent a race condition when two processes read/write. (will be used later)
> >> 3. Matebook X (2017) handles micmute led through the "legacy" interface
> >> which is not currently implemented. Use ACPI EC method to control
> >> this led. (will be used later)
> >>
> >> 2 module parameters are added to enable this short delay and/or report
> >> brightness keys through this driver.
> >
> > module parameters are a pain to manage and handle over time. Is there
> > any way you can "automatically" figure this out, or use a sysfs file
> > instead?
>
> The patch also adds dmi matches to set the quirks, so the module params
> are there to override those and/or to easily test which are the right options
> with new modules. The normal / expected use-case for everything to be set
> automatically based on the DMI table.
>
> With that said, the module-params should really always override the dmi values,
> so I would like to suggest to make the module-params int-s instead of bool-s
> and to do something like this:
>
> static int battery_reset = -1;
> static int report_brightness = -1;
>
> quirks = &quirk_unknown;
> dmi_check_system(huawei_quirks);
> /* If set the module options override the vale from the DMI table */
> if (battery_reset != -1)
> quirks->battery_reset = battery_reset;
> if (report_brightness != -1)
> quirks->report_brightness = report_brightness;

... and use "bint" for module_param() type.


thanks,

Takashi