Re: [PATCH v16 2/6] reboot: hw_protection_trigger: use standardized numeric shutdown/reboot reasons instead of strings
From: kernel test robot
Date: Mon Oct 12 2026 - 15:56:36 EST
Hi Faruque,
kernel test robot noticed the following build errors:
[auto build test ERROR on 5c4d4169604b335c38bbc79bc1fc03042981fc6f]
url: https://github.com/intel-lab-lkp/linux/commits/Faruque-Ansari/power-Extend-power_on_reason-h-for-upcoming-PSCRR-framework/20261007-123636
base: 5c4d4169604b335c38bbc79bc1fc03042981fc6f
patch link: https://lore.kernel.org/r/20261007-pscrr-framework-v16-2-3642c277bebb%40oss.qualcomm.com
patch subject: [PATCH v16 2/6] reboot: hw_protection_trigger: use standardized numeric shutdown/reboot reasons instead of strings
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20261013/202610130313.ziYum5Kq-lkp@xxxxxxxxx/config)
compiler: powerpc64-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261013/202610130313.ziYum5Kq-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/202610130313.ziYum5Kq-lkp@xxxxxxxxx/
All errors (new ones prefixed by >>):
drivers/power/supply/macsmc-power.c: In function 'macsmc_power_critical_work':
>> drivers/power/supply/macsmc-power.c:587:39: error: incompatible type for argument 1 of 'hw_protection_trigger'
587 | hw_protection_trigger("Battery voltage below design minimum", 1500);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| char *
In file included from drivers/power/supply/macsmc-power.c:22:
include/linux/reboot.h:276:58: note: expected 'enum psc_reason' but argument is of type 'char *'
276 | static inline void hw_protection_trigger(enum psc_reason reason,
| ~~~~~~~~~~~~~~~~^~~~~~
vim +/hw_protection_trigger +587 drivers/power/supply/macsmc-power.c
0ebf821cf6c75d Hector Martin 2026-02-17 554
0ebf821cf6c75d Hector Martin 2026-02-17 555 static void macsmc_power_critical_work(struct work_struct *wrk)
0ebf821cf6c75d Hector Martin 2026-02-17 556 {
0ebf821cf6c75d Hector Martin 2026-02-17 557 struct macsmc_power *power = container_of(wrk, struct macsmc_power, critical_work);
0ebf821cf6c75d Hector Martin 2026-02-17 558 u16 bitv, b0av;
0ebf821cf6c75d Hector Martin 2026-02-17 559 u32 bcf0;
0ebf821cf6c75d Hector Martin 2026-02-17 560
0ebf821cf6c75d Hector Martin 2026-02-17 561 if (!power->batt)
0ebf821cf6c75d Hector Martin 2026-02-17 562 return;
0ebf821cf6c75d Hector Martin 2026-02-17 563
0ebf821cf6c75d Hector Martin 2026-02-17 564 /*
0ebf821cf6c75d Hector Martin 2026-02-17 565 * Avoid duplicate atempts at emergency shutdown
0ebf821cf6c75d Hector Martin 2026-02-17 566 */
0ebf821cf6c75d Hector Martin 2026-02-17 567 if (power->emergency_shutdown_triggered || system_state > SYSTEM_RUNNING)
0ebf821cf6c75d Hector Martin 2026-02-17 568 return;
0ebf821cf6c75d Hector Martin 2026-02-17 569
0ebf821cf6c75d Hector Martin 2026-02-17 570 /*
0ebf821cf6c75d Hector Martin 2026-02-17 571 * EMERGENCY: Check voltage vs design minimum.
0ebf821cf6c75d Hector Martin 2026-02-17 572 * If we are below BITV, the battery is physically exhausted.
0ebf821cf6c75d Hector Martin 2026-02-17 573 * We must shut down NOW to protect the filesystem.
0ebf821cf6c75d Hector Martin 2026-02-17 574 */
0ebf821cf6c75d Hector Martin 2026-02-17 575 if (apple_smc_read_u16(power->smc, SMC_KEY(BITV), &bitv) >= 0 &&
0ebf821cf6c75d Hector Martin 2026-02-17 576 apple_smc_read_u16(power->smc, SMC_KEY(B0AV), &b0av) >= 0 &&
0ebf821cf6c75d Hector Martin 2026-02-17 577 b0av < bitv) {
0ebf821cf6c75d Hector Martin 2026-02-17 578 power->emergency_shutdown_triggered = true;
0ebf821cf6c75d Hector Martin 2026-02-17 579 dev_emerg(power->dev,
0ebf821cf6c75d Hector Martin 2026-02-17 580 "Battery voltage (%d mV) below design minimum (%d mV)! Emergency shutdown.\n",
0ebf821cf6c75d Hector Martin 2026-02-17 581 b0av, bitv);
0ebf821cf6c75d Hector Martin 2026-02-17 582
0ebf821cf6c75d Hector Martin 2026-02-17 583 /*
0ebf821cf6c75d Hector Martin 2026-02-17 584 * Shutdown is now imminent. Kick userspace again and give it some
0ebf821cf6c75d Hector Martin 2026-02-17 585 * brief time to (hopefully) flush what's needed, before forcing.
0ebf821cf6c75d Hector Martin 2026-02-17 586 */
0ebf821cf6c75d Hector Martin 2026-02-17 @587 hw_protection_trigger("Battery voltage below design minimum", 1500);
0ebf821cf6c75d Hector Martin 2026-02-17 588 }
0ebf821cf6c75d Hector Martin 2026-02-17 589
0ebf821cf6c75d Hector Martin 2026-02-17 590 /*
0ebf821cf6c75d Hector Martin 2026-02-17 591 * Avoid duplicate attempts at orderly shutdown.
0ebf821cf6c75d Hector Martin 2026-02-17 592 * Voltage check is above this as we may want to
0ebf821cf6c75d Hector Martin 2026-02-17 593 * "upgrade" an orderly shutdown to a critical power
0ebf821cf6c75d Hector Martin 2026-02-17 594 * off if voltage drops.
0ebf821cf6c75d Hector Martin 2026-02-17 595 */
0ebf821cf6c75d Hector Martin 2026-02-17 596 if (power->orderly_shutdown_triggered || system_state > SYSTEM_RUNNING)
0ebf821cf6c75d Hector Martin 2026-02-17 597 return;
0ebf821cf6c75d Hector Martin 2026-02-17 598
0ebf821cf6c75d Hector Martin 2026-02-17 599 /*
0ebf821cf6c75d Hector Martin 2026-02-17 600 * Check if SMC flagged the battery as empty.
0ebf821cf6c75d Hector Martin 2026-02-17 601 * We trigger a graceful shutdown to let the OS save data.
0ebf821cf6c75d Hector Martin 2026-02-17 602 */
f7b253a6e217f7 Sasha Finkelstein 2026-07-12 603 if (macsmc_battery_read_bcf0(power, &bcf0) == 0 && bcf0 != 0) {
0ebf821cf6c75d Hector Martin 2026-02-17 604 power->orderly_shutdown_triggered = true;
0ebf821cf6c75d Hector Martin 2026-02-17 605 dev_crit(power->dev, "Battery critical (empty flag set). Triggering orderly shutdown.\n");
0ebf821cf6c75d Hector Martin 2026-02-17 606 orderly_poweroff(true);
0ebf821cf6c75d Hector Martin 2026-02-17 607 }
0ebf821cf6c75d Hector Martin 2026-02-17 608 }
0ebf821cf6c75d Hector Martin 2026-02-17 609
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki