[linusw-nomadik:ux500-href-charging-compiletest 23/23] drivers/power/supply/sc27xx_fuel_gauge.c:1020:49: error: passing argument 1 of 'power_supply_find_ocv2cap_table' from incompatible pointer type
kernel test robot
lkp at intel.com
Fri Dec 3 11:13:14 PST 2021
tree: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git ux500-href-charging-compiletest
head: c362e3ead88e4c099ba792a0e3813e8aaeb68732
commit: c362e3ead88e4c099ba792a0e3813e8aaeb68732 [23/23] power: supply_core: Pass pointer to battery info
config: ia64-randconfig-r026-20211203 (https://download.01.org/0day-ci/archive/20211204/202112040326.0OPdvwg5-lkp@intel.com/config)
compiler: ia64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git/commit/?id=c362e3ead88e4c099ba792a0e3813e8aaeb68732
git remote add linusw-nomadik https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git
git fetch --no-tags linusw-nomadik ux500-href-charging-compiletest
git checkout c362e3ead88e4c099ba792a0e3813e8aaeb68732
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/power/supply/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
drivers/power/supply/sc27xx_fuel_gauge.c: In function 'sc27xx_fgu_hw_init':
>> drivers/power/supply/sc27xx_fuel_gauge.c:1020:49: error: passing argument 1 of 'power_supply_find_ocv2cap_table' from incompatible pointer type [-Werror=incompatible-pointer-types]
1020 | table = power_supply_find_ocv2cap_table(&info, 20, &data->table_len);
| ^~~~~
| |
| struct power_supply_battery_info **
In file included from drivers/power/supply/sc27xx_fuel_gauge.c:13:
include/linux/power_supply.h:583:67: note: expected 'struct power_supply_battery_info *' but argument is of type 'struct power_supply_battery_info **'
583 | power_supply_find_ocv2cap_table(struct power_supply_battery_info *info,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
cc1: some warnings being treated as errors
vim +/power_supply_find_ocv2cap_table +1020 drivers/power/supply/sc27xx_fuel_gauge.c
65c9fab7bc4b3a Baolin Wang 2018-11-14 998
195ca1703784d1 Baolin Wang 2018-11-05 999 static int sc27xx_fgu_hw_init(struct sc27xx_fgu_data *data)
195ca1703784d1 Baolin Wang 2018-11-05 1000 {
c362e3ead88e4c Linus Walleij 2021-12-03 1001 struct power_supply_battery_info *info;
195ca1703784d1 Baolin Wang 2018-11-05 1002 struct power_supply_battery_ocv_table *table;
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1003 int ret, delta_clbcnt, alarm_adc;
195ca1703784d1 Baolin Wang 2018-11-05 1004
195ca1703784d1 Baolin Wang 2018-11-05 1005 ret = power_supply_get_battery_info(data->battery, &info);
195ca1703784d1 Baolin Wang 2018-11-05 1006 if (ret) {
195ca1703784d1 Baolin Wang 2018-11-05 1007 dev_err(data->dev, "failed to get battery information\n");
195ca1703784d1 Baolin Wang 2018-11-05 1008 return ret;
195ca1703784d1 Baolin Wang 2018-11-05 1009 }
195ca1703784d1 Baolin Wang 2018-11-05 1010
c362e3ead88e4c Linus Walleij 2021-12-03 1011 data->total_cap = info->charge_full_design_uah / 1000;
c362e3ead88e4c Linus Walleij 2021-12-03 1012 data->max_volt = info->constant_charge_voltage_max_uv / 1000;
c362e3ead88e4c Linus Walleij 2021-12-03 1013 data->internal_resist = info->factory_internal_resistance_uohm / 1000;
c362e3ead88e4c Linus Walleij 2021-12-03 1014 data->min_volt = info->voltage_min_design_uv;
195ca1703784d1 Baolin Wang 2018-11-05 1015
195ca1703784d1 Baolin Wang 2018-11-05 1016 /*
195ca1703784d1 Baolin Wang 2018-11-05 1017 * For SC27XX fuel gauge device, we only use one ocv-capacity
195ca1703784d1 Baolin Wang 2018-11-05 1018 * table in normal temperature 20 Celsius.
195ca1703784d1 Baolin Wang 2018-11-05 1019 */
195ca1703784d1 Baolin Wang 2018-11-05 @1020 table = power_supply_find_ocv2cap_table(&info, 20, &data->table_len);
195ca1703784d1 Baolin Wang 2018-11-05 1021 if (!table)
195ca1703784d1 Baolin Wang 2018-11-05 1022 return -EINVAL;
195ca1703784d1 Baolin Wang 2018-11-05 1023
195ca1703784d1 Baolin Wang 2018-11-05 1024 data->cap_table = devm_kmemdup(data->dev, table,
195ca1703784d1 Baolin Wang 2018-11-05 1025 data->table_len * sizeof(*table),
195ca1703784d1 Baolin Wang 2018-11-05 1026 GFP_KERNEL);
195ca1703784d1 Baolin Wang 2018-11-05 1027 if (!data->cap_table) {
c362e3ead88e4c Linus Walleij 2021-12-03 1028 power_supply_put_battery_info(data->battery, info);
195ca1703784d1 Baolin Wang 2018-11-05 1029 return -ENOMEM;
195ca1703784d1 Baolin Wang 2018-11-05 1030 }
195ca1703784d1 Baolin Wang 2018-11-05 1031
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1032 data->alarm_cap = power_supply_ocv2cap_simple(data->cap_table,
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1033 data->table_len,
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1034 data->min_volt);
ff062d06948c01 Yuanjiang Yu 2019-07-31 1035 if (!data->alarm_cap)
ff062d06948c01 Yuanjiang Yu 2019-07-31 1036 data->alarm_cap += 1;
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1037
c362e3ead88e4c Linus Walleij 2021-12-03 1038 data->resist_table_len = info->resist_table_size;
6af8288834b6a9 Yuanjiang Yu 2019-12-09 1039 if (data->resist_table_len > 0) {
c362e3ead88e4c Linus Walleij 2021-12-03 1040 data->resist_table = devm_kmemdup(data->dev, info->resist_table,
6af8288834b6a9 Yuanjiang Yu 2019-12-09 1041 data->resist_table_len *
6af8288834b6a9 Yuanjiang Yu 2019-12-09 1042 sizeof(struct power_supply_resistance_temp_table),
6af8288834b6a9 Yuanjiang Yu 2019-12-09 1043 GFP_KERNEL);
6af8288834b6a9 Yuanjiang Yu 2019-12-09 1044 if (!data->resist_table) {
c362e3ead88e4c Linus Walleij 2021-12-03 1045 power_supply_put_battery_info(data->battery, info);
6af8288834b6a9 Yuanjiang Yu 2019-12-09 1046 return -ENOMEM;
6af8288834b6a9 Yuanjiang Yu 2019-12-09 1047 }
6af8288834b6a9 Yuanjiang Yu 2019-12-09 1048 }
6af8288834b6a9 Yuanjiang Yu 2019-12-09 1049
c362e3ead88e4c Linus Walleij 2021-12-03 1050 power_supply_put_battery_info(data->battery, info);
195ca1703784d1 Baolin Wang 2018-11-05 1051
65c9fab7bc4b3a Baolin Wang 2018-11-14 1052 ret = sc27xx_fgu_calibration(data);
65c9fab7bc4b3a Baolin Wang 2018-11-14 1053 if (ret)
65c9fab7bc4b3a Baolin Wang 2018-11-14 1054 return ret;
65c9fab7bc4b3a Baolin Wang 2018-11-14 1055
195ca1703784d1 Baolin Wang 2018-11-05 1056 /* Enable the FGU module */
195ca1703784d1 Baolin Wang 2018-11-05 1057 ret = regmap_update_bits(data->regmap, SC27XX_MODULE_EN0,
195ca1703784d1 Baolin Wang 2018-11-05 1058 SC27XX_FGU_EN, SC27XX_FGU_EN);
195ca1703784d1 Baolin Wang 2018-11-05 1059 if (ret) {
195ca1703784d1 Baolin Wang 2018-11-05 1060 dev_err(data->dev, "failed to enable fgu\n");
195ca1703784d1 Baolin Wang 2018-11-05 1061 return ret;
195ca1703784d1 Baolin Wang 2018-11-05 1062 }
195ca1703784d1 Baolin Wang 2018-11-05 1063
195ca1703784d1 Baolin Wang 2018-11-05 1064 /* Enable the FGU RTC clock to make it work */
195ca1703784d1 Baolin Wang 2018-11-05 1065 ret = regmap_update_bits(data->regmap, SC27XX_CLK_EN0,
195ca1703784d1 Baolin Wang 2018-11-05 1066 SC27XX_FGU_RTC_EN, SC27XX_FGU_RTC_EN);
195ca1703784d1 Baolin Wang 2018-11-05 1067 if (ret) {
195ca1703784d1 Baolin Wang 2018-11-05 1068 dev_err(data->dev, "failed to enable fgu RTC clock\n");
195ca1703784d1 Baolin Wang 2018-11-05 1069 goto disable_fgu;
195ca1703784d1 Baolin Wang 2018-11-05 1070 }
195ca1703784d1 Baolin Wang 2018-11-05 1071
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1072 ret = regmap_update_bits(data->regmap, data->base + SC27XX_FGU_INT_CLR,
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1073 SC27XX_FGU_INT_MASK, SC27XX_FGU_INT_MASK);
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1074 if (ret) {
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1075 dev_err(data->dev, "failed to clear interrupt status\n");
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1076 goto disable_clk;
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1077 }
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1078
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1079 /*
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1080 * Set the voltage low overload threshold, which means when the battery
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1081 * voltage is lower than this threshold, the controller will generate
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1082 * one interrupt to notify.
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1083 */
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1084 alarm_adc = sc27xx_fgu_voltage_to_adc(data, data->min_volt / 1000);
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1085 ret = regmap_update_bits(data->regmap, data->base + SC27XX_FGU_LOW_OVERLOAD,
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1086 SC27XX_FGU_LOW_OVERLOAD_MASK, alarm_adc);
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1087 if (ret) {
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1088 dev_err(data->dev, "failed to set fgu low overload\n");
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1089 goto disable_clk;
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1090 }
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1091
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1092 /*
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1093 * Set the coulomb counter delta threshold, that means when the coulomb
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1094 * counter change is multiples of the delta threshold, the controller
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1095 * will generate one interrupt to notify the users to update the battery
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1096 * capacity. Now we set the delta threshold as a counter value of 1%
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1097 * capacity.
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1098 */
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1099 delta_clbcnt = sc27xx_fgu_cap_to_clbcnt(data, 1);
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1100
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1101 ret = regmap_update_bits(data->regmap, data->base + SC27XX_FGU_CLBCNT_DELTL,
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1102 SC27XX_FGU_CLBCNT_MASK, delta_clbcnt);
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1103 if (ret) {
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1104 dev_err(data->dev, "failed to set low delta coulomb counter\n");
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1105 goto disable_clk;
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1106 }
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1107
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1108 ret = regmap_update_bits(data->regmap, data->base + SC27XX_FGU_CLBCNT_DELTH,
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1109 SC27XX_FGU_CLBCNT_MASK,
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1110 delta_clbcnt >> SC27XX_FGU_CLBCNT_SHIFT);
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1111 if (ret) {
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1112 dev_err(data->dev, "failed to set high delta coulomb counter\n");
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1113 goto disable_clk;
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1114 }
edcb1c0a3f6377 Yuanjiang Yu 2018-11-14 1115
195ca1703784d1 Baolin Wang 2018-11-05 1116 /*
195ca1703784d1 Baolin Wang 2018-11-05 1117 * Get the boot battery capacity when system powers on, which is used to
195ca1703784d1 Baolin Wang 2018-11-05 1118 * initialize the coulomb counter. After that, we can read the coulomb
195ca1703784d1 Baolin Wang 2018-11-05 1119 * counter to measure the battery capacity.
195ca1703784d1 Baolin Wang 2018-11-05 1120 */
195ca1703784d1 Baolin Wang 2018-11-05 1121 ret = sc27xx_fgu_get_boot_capacity(data, &data->init_cap);
195ca1703784d1 Baolin Wang 2018-11-05 1122 if (ret) {
195ca1703784d1 Baolin Wang 2018-11-05 1123 dev_err(data->dev, "failed to get boot capacity\n");
195ca1703784d1 Baolin Wang 2018-11-05 1124 goto disable_clk;
195ca1703784d1 Baolin Wang 2018-11-05 1125 }
195ca1703784d1 Baolin Wang 2018-11-05 1126
195ca1703784d1 Baolin Wang 2018-11-05 1127 /*
195ca1703784d1 Baolin Wang 2018-11-05 1128 * Convert battery capacity to the corresponding initial coulomb counter
195ca1703784d1 Baolin Wang 2018-11-05 1129 * and set into coulomb counter registers.
195ca1703784d1 Baolin Wang 2018-11-05 1130 */
195ca1703784d1 Baolin Wang 2018-11-05 1131 data->init_clbcnt = sc27xx_fgu_cap_to_clbcnt(data, data->init_cap);
195ca1703784d1 Baolin Wang 2018-11-05 1132 ret = sc27xx_fgu_set_clbcnt(data, data->init_clbcnt);
195ca1703784d1 Baolin Wang 2018-11-05 1133 if (ret) {
195ca1703784d1 Baolin Wang 2018-11-05 1134 dev_err(data->dev, "failed to initialize coulomb counter\n");
195ca1703784d1 Baolin Wang 2018-11-05 1135 goto disable_clk;
195ca1703784d1 Baolin Wang 2018-11-05 1136 }
195ca1703784d1 Baolin Wang 2018-11-05 1137
195ca1703784d1 Baolin Wang 2018-11-05 1138 return 0;
195ca1703784d1 Baolin Wang 2018-11-05 1139
195ca1703784d1 Baolin Wang 2018-11-05 1140 disable_clk:
195ca1703784d1 Baolin Wang 2018-11-05 1141 regmap_update_bits(data->regmap, SC27XX_CLK_EN0, SC27XX_FGU_RTC_EN, 0);
195ca1703784d1 Baolin Wang 2018-11-05 1142 disable_fgu:
195ca1703784d1 Baolin Wang 2018-11-05 1143 regmap_update_bits(data->regmap, SC27XX_MODULE_EN0, SC27XX_FGU_EN, 0);
195ca1703784d1 Baolin Wang 2018-11-05 1144
195ca1703784d1 Baolin Wang 2018-11-05 1145 return ret;
195ca1703784d1 Baolin Wang 2018-11-05 1146 }
195ca1703784d1 Baolin Wang 2018-11-05 1147
:::::: The code at line 1020 was first introduced by commit
:::::: 195ca1703784d1fbc34b38019aedcb74f08154f1 power: supply: Add Spreadtrum SC27XX fuel gauge unit driver
:::::: TO: Baolin Wang <baolin.wang at linaro.org>
:::::: CC: Sebastian Reichel <sebastian.reichel at collabora.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
More information about the linux-arm-kernel
mailing list