Re: [PATCH v5 8/8] platform/x86: lenovo-wmi-other: Add WMI battery charge limiting
From: Derek J. Clark
Date: Thu Mar 26 2026 - 12:29:02 EST
On March 26, 2026 9:12:41 AM PDT, Rong Zhang <i@xxxxxxxx> wrote:
>Hi Derek,
>
>On Wed, 2026-03-25 at 19:12 -0700, Derek John Clark wrote:
>> On Wed, Mar 25, 2026 at 12:43 PM kernel test robot <lkp@xxxxxxxxx> wrote:
>> >
>> > Hi Derek,
>> >
>> > kernel test robot noticed the following build errors:
>> >
>> > [auto build test ERROR on linus/master]
>> > [also build test ERROR on v7.0-rc5 next-20260324]
>> > [If your patch is applied to the wrong git tree, kindly drop us a note.
>> > And when submitting patch, we suggest to use '--base' as documented in
>> > https://git-scm.com/docs/git-format-patch#_base_tree_information]
>> >
>> > url: https://github.com/intel-lab-lkp/linux/commits/Derek-J-Clark/platform-x86-lenovo-wmi-other-Move-LWMI_FAN_DIV/20260325-070851
>> > base: linus/master
>> > patch link: https://lore.kernel.org/r/20260324221032.1333636-9-derekjohn.clark%40gmail.com
>> > patch subject: [PATCH v5 8/8] platform/x86: lenovo-wmi-other: Add WMI battery charge limiting
>> > config: x86_64-randconfig-005-20260325 (https://download.01.org/0day-ci/archive/20260326/202603260302.X0NjQOda-lkp@xxxxxxxxx/config)
>
> CONFIG_DMI=y
>
> CONFIG_HWMON=y
>
> CONFIG_FW_ATTR_CLASS=m
>
> CONFIG_ACPI_BATTERY=m
>
> CONFIG_ACPI_PLATFORM_PROFILE=y
>
> CONFIG_ACPI_WMI=y
>
> CONFIG_LENOVO_WMI_CAPDATA=m
> CONFIG_LENOVO_WMI_EVENTS=y
> CONFIG_LENOVO_WMI_HELPERS=y
> CONFIG_LENOVO_WMI_GAMEZONE=y
> CONFIG_LENOVO_WMI_TUNING=y
>
>This isn't a legit config, as CONFIG_LENOVO_WMI_TUNING=y should have
>ensured CONFIG_LENOVO_WMI_CAPDATA=y, CONFIG_ACPI_BATTERY=y, and
>CONFIG_FW_ATTR_CLASS=y.
>
>> > compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
>> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260326/202603260302.X0NjQOda-lkp@xxxxxxxxx/reproduce)
>> >
>> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
>> > the same patch/commit), kindly add following tags
>> > > Reported-by: kernel test robot <lkp@xxxxxxxxx>
>> > > Closes: https://lore.kernel.org/oe-kbuild-all/202603260302.X0NjQOda-lkp@xxxxxxxxx/
>> >
>> > All errors (new ones prefixed by >>):
>> >
>> > ld: vmlinux.o: in function `lwmi_om_fan_get_set':
>> > > > drivers/platform/x86/lenovo/wmi-other.c:206:(.text+0x1b74542): undefined reference to `lwmi_attr_id'
>> > ld: vmlinux.o: in function `lwmi_attr_01_is_supported':
>> > drivers/platform/x86/lenovo/wmi-other.c:1267:(.text+0x1b74fdf): undefined reference to `lwmi_attr_id'
>> > > > ld: drivers/platform/x86/lenovo/wmi-other.c:1270:(.text+0x1b75013): undefined reference to `lwmi_cd01_get_data'
>> > > > ld: drivers/platform/x86/lenovo/wmi-other.c:1283:(.text+0x1b7515b): undefined reference to `lwmi_attr_id'
>> > ld: drivers/platform/x86/lenovo/wmi-other.c:1299:(.text+0x1b752f4): undefined reference to `lwmi_attr_id'
>> > ld: vmlinux.o: in function `lwmi_om_fan_info_collect_cd_fan':
>> > > > drivers/platform/x86/lenovo/wmi-other.c:565:(.text+0x1b75ca3): undefined reference to `lwmi_cd_fan_get_data'
>> > ld: vmlinux.o: in function `lwmi_psy_prop_is_writeable':
>> > drivers/platform/x86/lenovo/wmi-other.c:687:(.text+0x1b75e2f): undefined reference to `lwmi_attr_id'
>> > > > ld: drivers/platform/x86/lenovo/wmi-other.c:690:(.text+0x1b75e5a): undefined reference to `lwmi_cd00_get_data'
>> > ld: vmlinux.o: in function `lwmi_psy_ext_set_prop':
>> > drivers/platform/x86/lenovo/wmi-other.c:649:(.text+0x1b75f9b): undefined reference to `lwmi_attr_id'
>> > ld: vmlinux.o: in function `lwmi_psy_ext_get_prop':
>> > drivers/platform/x86/lenovo/wmi-other.c:603:(.text+0x1b761aa): undefined reference to `lwmi_attr_id'
>> > ld: vmlinux.o: in function `lwmi_other_probe':
>> > > > drivers/platform/x86/lenovo/wmi-other.c:1612:(.text+0x1b764eb): undefined reference to `lwmi_cd_match_add_all'
>> > ld: vmlinux.o: in function `lwmi_om_fan_info_collect_cd00':
>> > drivers/platform/x86/lenovo/wmi-other.c:540:(.text+0x1b7680f): undefined reference to `lwmi_attr_id'
>> > ld: drivers/platform/x86/lenovo/wmi-other.c:540:(.text+0x1b76838): undefined reference to `lwmi_cd00_get_data'
>> > ld: vmlinux.o: in function `lwmi_om_ps_ext_init':
>> > > > drivers/platform/x86/lenovo/wmi-other.c:806:(.text+0x1b76a57): undefined reference to `devm_battery_hook_register'
>> > ld: vmlinux.o: in function `lwmi_om_fw_attr_add':
>> > > > drivers/platform/x86/lenovo/wmi-other.c:1474:(.text+0x1b76afa): undefined reference to `firmware_attributes_class'
>> > ld: vmlinux.o: in function `attr_current_value_show':
>> > drivers/platform/x86/lenovo/wmi-other.c:1225:(.text+0x1b77015): undefined reference to `lwmi_attr_id'
>> > ld: vmlinux.o: in function `attr_current_value_store':
>> > drivers/platform/x86/lenovo/wmi-other.c:1165:(.text+0x1b776e2): undefined reference to `lwmi_attr_id'
>> > ld: drivers/platform/x86/lenovo/wmi-other.c:1168:(.text+0x1b7771c): undefined reference to `lwmi_cd01_get_data'
>> > ld: drivers/platform/x86/lenovo/wmi-other.c:1179:(.text+0x1b7781e): undefined reference to `lwmi_attr_id'
>> > ld: vmlinux.o: in function `attr_capdata01_show':
>> > drivers/platform/x86/lenovo/wmi-other.c:1099:(.text+0x1b77e38): undefined reference to `lwmi_attr_id'
>> > ld: drivers/platform/x86/lenovo/wmi-other.c:1102:(.text+0x1b77e67): undefined reference to `lwmi_cd01_get_data'
>> >
>> > Kconfig warnings: (for reference only)
>> > WARNING: unmet direct dependencies detected for LENOVO_WMI_TUNING
>
>When randconfig selects symbols, some are selected by the randomizer,
>while some are selected by Kconfig `select SYMBOL'. In this lkp test,
>CONFIG_LENOVO_WMI_GAMEZONE=y was selected by the randomizer, while
>CONFIG_LENOVO_WMI_TUNING=y was selected by `select LENOVO_WMI_TUNING' in
>`config LENOVO_WMI_GAMEZONE'.
>
>Documentation/kbuild/kconfig-language.rst says "select will force a
>symbol to a value without visiting the dependencies", resulting in unmet
>dependencies in this test and
>https://lore.kernel.org/r/202603252259.gHvJDyh3-lkp@xxxxxxxxx
>
>> > Depends on [m]: X86_PLATFORM_DEVICES [=y] && ACPI_WMI [=y] && ACPI_BATTERY [=m]
>> > Selected by [y]:
>> > - LENOVO_WMI_GAMEZONE [=y] && X86_PLATFORM_DEVICES [=y] && ACPI_WMI [=y] && DMI [=y]
>> >
>> >
>> > vim +206 drivers/platform/x86/lenovo/wmi-other.c
>> >
>> > 51ed34282f63fa Rong Zhang 2026-01-21 186
>> > 51ed34282f63fa Rong Zhang 2026-01-21 187 /**
>> > 51ed34282f63fa Rong Zhang 2026-01-21 188 * lwmi_om_fan_get_set() - Get or set fan RPM value of specified fan
>> > 51ed34282f63fa Rong Zhang 2026-01-21 189 * @priv: Driver private data structure
>> > 51ed34282f63fa Rong Zhang 2026-01-21 190 * @channel: Fan channel index (0-based)
>> > 51ed34282f63fa Rong Zhang 2026-01-21 191 * @val: Pointer to value (input for set, output for get)
>> > 51ed34282f63fa Rong Zhang 2026-01-21 192 * @set: True to set value, false to get value
>> > 51ed34282f63fa Rong Zhang 2026-01-21 193 *
>> > 51ed34282f63fa Rong Zhang 2026-01-21 194 * Communicates with WMI interface to either retrieve current fan RPM
>> > 51ed34282f63fa Rong Zhang 2026-01-21 195 * or set target fan RPM.
>> > 51ed34282f63fa Rong Zhang 2026-01-21 196 *
>> > 51ed34282f63fa Rong Zhang 2026-01-21 197 * Return: 0 on success, or an error code.
>> > 51ed34282f63fa Rong Zhang 2026-01-21 198 */
>> > 51ed34282f63fa Rong Zhang 2026-01-21 199 static int lwmi_om_fan_get_set(struct lwmi_om_priv *priv, int channel, u32 *val, bool set)
>> > 51ed34282f63fa Rong Zhang 2026-01-21 200 {
>> > 51ed34282f63fa Rong Zhang 2026-01-21 201 struct wmi_method_args_32 args;
>> > 51ed34282f63fa Rong Zhang 2026-01-21 202 u32 method_id, retval;
>> > 51ed34282f63fa Rong Zhang 2026-01-21 203 int err;
>> > 51ed34282f63fa Rong Zhang 2026-01-21 204
>> > 51ed34282f63fa Rong Zhang 2026-01-21 205 method_id = set ? LWMI_FEATURE_VALUE_SET : LWMI_FEATURE_VALUE_GET;
>> > 51ed34282f63fa Rong Zhang 2026-01-21 @206 args.arg0 = LWMI_ATTR_ID_FAN_RPM(channel);
>> > 51ed34282f63fa Rong Zhang 2026-01-21 207 args.arg1 = set ? *val : 0;
>> > 51ed34282f63fa Rong Zhang 2026-01-21 208
>> > 51ed34282f63fa Rong Zhang 2026-01-21 209 err = lwmi_dev_evaluate_int(priv->wdev, 0x0, method_id,
>> > 51ed34282f63fa Rong Zhang 2026-01-21 210 (unsigned char *)&args, sizeof(args), &retval);
>> > 51ed34282f63fa Rong Zhang 2026-01-21 211 if (err)
>> > 51ed34282f63fa Rong Zhang 2026-01-21 212 return err;
>> > 51ed34282f63fa Rong Zhang 2026-01-21 213
>> > 51ed34282f63fa Rong Zhang 2026-01-21 214 if (!set) {
>> > 51ed34282f63fa Rong Zhang 2026-01-21 215 *val = retval;
>> > 51ed34282f63fa Rong Zhang 2026-01-21 216 return 0;
>> > 51ed34282f63fa Rong Zhang 2026-01-21 217 }
>> > 51ed34282f63fa Rong Zhang 2026-01-21 218
>> > 51ed34282f63fa Rong Zhang 2026-01-21 219 /*
>> > 51ed34282f63fa Rong Zhang 2026-01-21 220 * It seems that 0 means "no error" and 1 means "done". Apparently
>> > 51ed34282f63fa Rong Zhang 2026-01-21 221 * different firmware teams have different thoughts on indicating
>> > 51ed34282f63fa Rong Zhang 2026-01-21 222 * success, so we accepts both.
>> > 51ed34282f63fa Rong Zhang 2026-01-21 223 */
>> > 51ed34282f63fa Rong Zhang 2026-01-21 224 return (retval == 0 || retval == 1) ? 0 : -EIO;
>> > 51ed34282f63fa Rong Zhang 2026-01-21 225 }
>> > 51ed34282f63fa Rong Zhang 2026-01-21 226
>> >
>> > --
>> > 0-DAY CI Kernel Test Service
>> > https://github.com/intel/lkp-tests/wiki
>>
>> Can someone explain to me why this is happening? I cannot reproduce
>> these locally with W=1 and/or C=1. I'd prefer to resolve this before
>> submitting a v6.
>
>The issue exists since commit 6e38b9fcbfa3 ('platform/x86: lenovo:
>gamezone needs "other mode"'). It might be a coincidence that lkp didn't
>running into a similar issue before. IMO `select LENOVO_WMI_TUNING'
>shouldn't be used in the first place since LENOVO_WMI_TUNING has
>numerous dependencies.
>
>To fix this, we need to decouple lenovo-wmi-gamezone and lenovo-wmi-
>other by moving the notifier chain into lenovo-wmi-helpers. I will reply
>with a patch soon. Fell free to integrate it into your series.
>
>Note that I couldn't completely test my patch since the lack of gamezone
>support on my device.
>
>BTW, the fix patch has conflicts with my debugfs series since both touch
>lenovo-wmi-helpers. If you decide to integrate the fix patch into your
>series, could you integrate the debugfs series into yours too? The
>conflicts are trivial and contextual. You can resolve them yourself if
>you don't mind it ;-)
>
>Thanks,
>Rong
>
Absolutely, that's a good plan. If you want, send the new patch to me directly. Also, please leave a note on that other series in case Ilpo doesn't see this first.
And thanks for the clear explanation. Hopefully it all works like we expect.
Cheers,
Derek
>>
>> Thanks,
>> Derek