drivers/platform/x86/thinkpad_acpi.c:9600:9: error: implicit declaration of function 'power_supply_charge_behaviour_show'
Subsystems (2)
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: b8170452cd5121b11a5726e3ea8dbdfc2d74e771 commit: b55d416d48f5907f66218ae3d878e3bfb69ae4e6 [8287/11475] platform/x86: thinkpad_acpi: support force-discharge config: x86_64-buildonly-randconfig-r005-20220107 (https://download.01.org/0day-ci/archive/20220108/202201080424.U284YcVw-lkp(a)intel.com/config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=b55d416d48f5907f66218ae3d878e3bfb69ae4e6 git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout b55d416d48f5907f66218ae3d878e3bfb69ae4e6 # save the config file to linux build tree mkdir build_dir make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/platform/x86/
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/platform/x86/thinkpad_acpi.c: In function 'charge_behaviour_show':
>> drivers/platform/x86/thinkpad_acpi.c:9600:9: error: implicit declaration of function 'power_supply_charge_behaviour_show' [-Werror=implicit-function-declaration]
9600 | return power_supply_charge_behaviour_show(dev, available, active, buf);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/x86/thinkpad_acpi.c: In function 'charge_behaviour_store':
>> drivers/platform/x86/thinkpad_acpi.c:9627:13: error: implicit declaration of function 'power_supply_charge_behaviour_parse' [-Werror=implicit-function-declaration]
9627 | selected = power_supply_charge_behaviour_parse(available, buf);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cc1: some warnings being treated as errors
vim +/power_supply_charge_behaviour_show +9600 drivers/platform/x86/thinkpad_acpi.c
9580
9581 static ssize_t charge_behaviour_show(struct device *dev,
9582 struct device_attribute *attr,
9583 char *buf)
9584 {
9585 enum power_supply_charge_behaviour active = POWER_SUPPLY_CHARGE_BEHAVIOUR_AUTO;
9586 struct power_supply *supply = to_power_supply(dev);
9587 unsigned int available;
9588 int ret, battery;
9589
9590 battery = tpacpi_battery_get_id(supply->desc->name);
9591 available = battery_info.batteries[battery].charge_behaviours;
9592
9593 if (available & BIT(POWER_SUPPLY_CHARGE_BEHAVIOUR_FORCE_DISCHARGE)) {
9594 if (tpacpi_battery_get(FORCE_DISCHARGE, battery, &ret))
9595 return -ENODEV;
9596 if (ret)
9597 active = POWER_SUPPLY_CHARGE_BEHAVIOUR_FORCE_DISCHARGE;
9598 }
9599
> 9600 return power_supply_charge_behaviour_show(dev, available, active, buf);
9601 }
9602
9603 static ssize_t charge_control_start_threshold_store(struct device *dev,
9604 struct device_attribute *attr,
9605 const char *buf, size_t count)
9606 {
9607 return tpacpi_battery_store(THRESHOLD_START, dev, buf, count);
9608 }
9609
9610 static ssize_t charge_control_end_threshold_store(struct device *dev,
9611 struct device_attribute *attr,
9612 const char *buf, size_t count)
9613 {
9614 return tpacpi_battery_store(THRESHOLD_STOP, dev, buf, count);
9615 }
9616
9617 static ssize_t charge_behaviour_store(struct device *dev,
9618 struct device_attribute *attr,
9619 const char *buf, size_t count)
9620 {
9621 struct power_supply *supply = to_power_supply(dev);
9622 int selected, battery, ret = 0;
9623 unsigned int available;
9624
9625 battery = tpacpi_battery_get_id(supply->desc->name);
9626 available = battery_info.batteries[battery].charge_behaviours;
> 9627 selected = power_supply_charge_behaviour_parse(available, buf); 9628
9629 if (selected < 0)
9630 return selected;
9631
9632 switch (selected) {
9633 case POWER_SUPPLY_CHARGE_BEHAVIOUR_AUTO:
9634 if (available & BIT(POWER_SUPPLY_CHARGE_BEHAVIOUR_FORCE_DISCHARGE))
9635 ret = tpacpi_battery_set_validate(FORCE_DISCHARGE, battery, 0);
9636 if (ret < 0)
9637 return ret;
9638 break;
9639 case POWER_SUPPLY_CHARGE_BEHAVIOUR_FORCE_DISCHARGE:
9640 ret = tpacpi_battery_set_validate(FORCE_DISCHARGE, battery, 1);
9641 if (ret < 0)
9642 return ret;
9643 break;
9644 default:
9645 dev_err(dev, "Unexpected charge behaviour: %d\n", selected);
9646 return -EINVAL;
9647 }
9648
9649 return count;
9650 }
9651
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
Hi,
Quoted 20 lines · kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: b8170452cd5121b11a5726e3ea8dbdfc2d74e771 commit: b55d416d48f5907f66218ae3d878e3bfb69ae4e6 [8287/11475] platform/x86: thinkpad_acpi: support force-discharge config: x86_64-buildonly-randconfig-r005-20220107 (https://download.01.org/0day-ci/archive/20220108/202201080424.U284YcVw-lkp(a)intel.com/config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=b55d416d48f5907f66218ae3d878e3bfb69ae4e6 git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout b55d416d48f5907f66218ae3d878e3bfb69ae4e6 # save the config file to linux build tree mkdir build_dir make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/platform/x86/If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>All errors (new ones prefixed by >>):
drivers/platform/x86/thinkpad_acpi.c: In function 'charge_behaviour_show':
Quoted 8 lines
Quoted 1 line
Quoted 1 line
drivers/platform/x86/thinkpad_acpi.c:9600:9: error: implicit declaration of function 'power_supply_charge_behaviour_show' [-Werror=implicit-function-declaration]9600 | return power_supply_charge_behaviour_show(dev, available, active, buf); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/x86/thinkpad_acpi.c: In function 'charge_behaviour_store':Quoted 1 line
Quoted 1 line
drivers/platform/x86/thinkpad_acpi.c:9627:13: error: implicit declaration of function 'power_supply_charge_behaviour_parse' [-Werror=implicit-function-declaration]9627 | selected = power_supply_charge_behaviour_parse(available, buf); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cc1: some warnings being treated as errors
Ok, so this is caused by the config used by this test having the following:
# CONFIG_SYSFS is not set
Thomas, can you do a patch adding static inline stubs for these 2 functions to include/linux/power_supply.h ? Like it is done for the:
power_supply_add_hwmon_sysfs()power_supply_remove_hwmon_sysfs()
Just above the declaration of these 2 functions.
Regards,
Hans
PATCH 1/1 power: supply: Provide stubs for charge_behaviour helpers
When CONFIG_SYSFS is not enabled provide stubs for the helper functions to not break their callers.
--- include/linux/power_supply.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
include/linux/power_supply.h +15 -0
@@ -723,6 +723,21 @@ ssize_t power_supply_charge_behaviour_show(struct device *dev, char *buf);int power_supply_charge_behaviour_parse (unsigned int available_behaviours,const char *buf); +#else +static inline +ssize_t power_supply_charge_behaviour_show (struct device *dev, +unsigned int available_behaviours, +enum power_supply_charge_behaviour behaviour, +char *buf) +{ +return -EOPNOTSUPP ; +} + +static inline int power_supply_charge_behaviour_parse (unsigned int available_behaviours, +const char *buf) +{ +return -EOPNOTSUPP ; +}#endif #endif /* __LINUX_POWER_SUPPLY_H__ */
base-commit: b8170452cd5121b11a5726e3ea8dbdfc2d74e771
Signature · 1 line
2.34.1
Re: [PATCH] power: supply: Provide stubs for charge_behaviour helpers
Hi,
Quoted 6 lines · Thomas Weißschuh
When
CONFIG_SYSFSis not enabled provide stubs for the helper functions to not break their callers.Fixes 539b9c94ac83 ("power: supply: add helpers for charge_behaviour sysfs")Reported-by kernel test robot <[email protected]>Signed-off-by Thomas Weißschuh <[email protected]>
Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.
Regards,
Hans
Quoted 33 lines
--- include/linux/power_supply.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)include/linux/power_supply.h +15
-0@@ -723,6 +723,21 @@ ssize_t power_supply_charge_behaviour_show(struct device *dev, char *buf);int power_supply_charge_behaviour_parse (unsigned int available_behaviours,const char *buf); +#else +static inline +ssize_t power_supply_charge_behaviour_show (struct device *dev, +unsigned int available_behaviours, +enum power_supply_charge_behaviour behaviour, +char *buf) +{ +return -EOPNOTSUPP ; +} + +static inline int power_supply_charge_behaviour_parse (unsigned int available_behaviours, +const char *buf) +{ +return -EOPNOTSUPP ; +}#endif #endif /* __LINUX_POWER_SUPPLY_H__ */ base-commit:
b8170452cd5121b11a5726e3ea8dbdfc2d74e771