* [linux-next:master 8287/11475] drivers/platform/x86/thinkpad_acpi.c:9600:9: error: implicit declaration of function 'power_supply_charge_behaviour_show'
@ 2022-01-07 20:08 kernel test robot
2022-01-08 10:24 ` Hans de Goede
0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2022-01-07 20:08 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: kbuild-all, Linux Memory Management List, Hans de Goede,
Thomas Koch, Nicolò Piazzalunga
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@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 <lkp@intel.com>
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/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [linux-next:master 8287/11475] drivers/platform/x86/thinkpad_acpi.c:9600:9: error: implicit declaration of function 'power_supply_charge_behaviour_show'
2022-01-07 20:08 [linux-next:master 8287/11475] drivers/platform/x86/thinkpad_acpi.c:9600:9: error: implicit declaration of function 'power_supply_charge_behaviour_show' kernel test robot
@ 2022-01-08 10:24 ` Hans de Goede
2022-01-08 15:31 ` [PATCH] power: supply: Provide stubs for charge_behaviour helpers Thomas Weißschuh
0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2022-01-08 10:24 UTC (permalink / raw)
To: kernel test robot, Thomas Weißschuh
Cc: kbuild-all, Linux Memory Management List, Thomas Koch,
Nicolò Piazzalunga
Hi,
On 1/7/22 21:08, kernel test robot wrote:
> 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@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 <lkp@intel.com>
>
> 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
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] power: supply: Provide stubs for charge_behaviour helpers
2022-01-08 10:24 ` Hans de Goede
@ 2022-01-08 15:31 ` Thomas Weißschuh
2022-01-08 15:58 ` Hans de Goede
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Weißschuh @ 2022-01-08 15:31 UTC (permalink / raw)
To: Hans de Goede, Sebastian Reichel
Cc: Thomas Weißschuh, kbuild-all, Linux Memory Management List,
Thomas Koch, Nicolò Piazzalunga, linux-pm,
kernel test robot
When CONFIG_SYSFS is 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 <lkp@intel.com>
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
include/linux/power_supply.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index d92de670d6a7..e218041cc000 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -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
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] power: supply: Provide stubs for charge_behaviour helpers
2022-01-08 15:31 ` [PATCH] power: supply: Provide stubs for charge_behaviour helpers Thomas Weißschuh
@ 2022-01-08 15:58 ` Hans de Goede
0 siblings, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2022-01-08 15:58 UTC (permalink / raw)
To: Thomas Weißschuh, Sebastian Reichel
Cc: kbuild-all, Linux Memory Management List, Thomas Koch,
Nicolò Piazzalunga, linux-pm, kernel test robot
Hi,
On 1/8/22 16:31, Thomas Weißschuh wrote:
> When CONFIG_SYSFS is 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 <lkp@intel.com>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
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
> ---
> include/linux/power_supply.h | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
> index d92de670d6a7..e218041cc000 100644
> --- a/include/linux/power_supply.h
> +++ b/include/linux/power_supply.h
> @@ -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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-01-08 15:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07 20:08 [linux-next:master 8287/11475] drivers/platform/x86/thinkpad_acpi.c:9600:9: error: implicit declaration of function 'power_supply_charge_behaviour_show' kernel test robot
2022-01-08 10:24 ` Hans de Goede
2022-01-08 15:31 ` [PATCH] power: supply: Provide stubs for charge_behaviour helpers Thomas Weißschuh
2022-01-08 15:58 ` Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox