[sre-power-supply:for-next 5/5] drivers/power/supply/power_supply_core.c:1137:13: error: implicit declaration of function 'psy_has_property'

kernel test robot
2021-09-30T02:54:16Z

[-- Attachment #1: Type: text/plain, Size: 5494 bytes --]

tree: https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next
head: 9ba533eb99bb2acf8b2268c6f48dcf73e1e47753
commit: 9ba533eb99bb2acf8b2268c6f48dcf73e1e47753 [5/5] power: supply: core: Add psy_has_property()
config: riscv-defconfig (attached as .config)
compiler: riscv64-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/sre/linux-power-supply.git/commit/?id=9ba533eb99bb2acf8b2268c6f48dcf73e1e47753
git remote add sre-power-supply https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git
git fetch --no-tags sre-power-supply for-next
git checkout 9ba533eb99bb2acf8b2268c6f48dcf73e1e47753
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=riscv

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/power/supply/power_supply_core.c: In function '__power_supply_register':
>> drivers/power/supply/power_supply_core.c:1137:13: error: implicit declaration of function 'psy_has_property' [-Werror=implicit-function-declaration]
1137 | if (psy_has_property(desc, POWER_SUPPLY_PROP_USB_TYPE) &&
| ^~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +/psy_has_property +1137 drivers/power/supply/power_supply_core.c

1119
1120 static struct power_supply *__must_check
1121 __power_supply_register(struct device *parent,
1122 const struct power_supply_desc *desc,
1123 const struct power_supply_config *cfg,
1124 bool ws)
1125 {
1126 struct device *dev;
1127 struct power_supply *psy;
1128 int rc;
1129
1130 if (!parent)
1131 pr_warn("%s: Expected proper parent device for '%s'\n",
1132 __func__, desc->name);
1133
1134 if (!desc || !desc->name || !desc->properties || !desc->num_properties)
1135 return ERR_PTR(-EINVAL);
1136
> 1137 if (psy_has_property(desc, POWER_SUPPLY_PROP_USB_TYPE) &&
1138 (!desc->usb_types || !desc->num_usb_types))
1139 return ERR_PTR(-EINVAL);
1140
1141 psy = kzalloc(sizeof(*psy), GFP_KERNEL);
1142 if (!psy)
1143 return ERR_PTR(-ENOMEM);
1144
1145 dev = &psy->dev;
1146
1147 device_initialize(dev);
1148
1149 dev->class = power_supply_class;
1150 dev->type = &power_supply_dev_type;
1151 dev->parent = parent;
1152 dev->release = power_supply_dev_release;
1153 dev_set_drvdata(dev, psy);
1154 psy->desc = desc;
1155 if (cfg) {
1156 dev->groups = cfg->attr_grp;
1157 psy->drv_data = cfg->drv_data;
1158 psy->of_node =
1159 cfg->fwnode ? to_of_node(cfg->fwnode) : cfg->of_node;
1160 psy->supplied_to = cfg->supplied_to;
1161 psy->num_supplicants = cfg->num_supplicants;
1162 }
1163
1164 rc = dev_set_name(dev, "%s", desc->name);
1165 if (rc)
1166 goto dev_set_name_failed;
1167
1168 INIT_WORK(&psy->changed_work, power_supply_changed_work);
1169 INIT_DELAYED_WORK(&psy->deferred_register_work,
1170 power_supply_deferred_register_work);
1171
1172 rc = power_supply_check_supplies(psy);
1173 if (rc) {
1174 dev_dbg(dev, "Not all required supplies found, defer probe\n");
1175 goto check_supplies_failed;
1176 }
1177
1178 spin_lock_init(&psy->changed_lock);
1179 rc = device_add(dev);
1180 if (rc)
1181 goto device_add_failed;
1182
1183 rc = device_init_wakeup(dev, ws);
1184 if (rc)
1185 goto wakeup_init_failed;
1186
1187 rc = psy_register_thermal(psy);
1188 if (rc)
1189 goto register_thermal_failed;
1190
1191 rc = psy_register_cooler(psy);
1192 if (rc)
1193 goto register_cooler_failed;
1194
1195 rc = power_supply_create_triggers(psy);
1196 if (rc)
1197 goto create_triggers_failed;
1198
1199 rc = power_supply_add_hwmon_sysfs(psy);
1200 if (rc)
1201 goto add_hwmon_sysfs_failed;
1202
1203 /*
1204 * Update use_cnt after any uevents (most notably from device_add()).
1205 * We are here still during driver's probe but
1206 * the power_supply_uevent() calls back driver's get_property
1207 * method so:
1208 * 1. Driver did not assigned the returned struct power_supply,
1209 * 2. Driver could not finish initialization (anything in its probe
1210 * after calling power_supply_register()).
1211 */
1212 atomic_inc(&psy->use_cnt);
1213 psy->initialized = true;
1214
1215 queue_delayed_work(system_power_efficient_wq,
1216 &psy->deferred_register_work,
1217 POWER_SUPPLY_DEFERRED_REGISTER_TIME);
1218
1219 return psy;
1220
1221 add_hwmon_sysfs_failed:
1222 power_supply_remove_triggers(psy);
1223 create_triggers_failed:
1224 psy_unregister_cooler(psy);
1225 register_cooler_failed:
1226 psy_unregister_thermal(psy);
1227 register_thermal_failed:
1228 device_del(dev);
1229 wakeup_init_failed:
1230 device_add_failed:
1231 check_supplies_failed:
1232 dev_set_name_failed:
1233 put_device(dev);
1234 return ERR_PTR(rc);
1235 }
1236

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 21930 bytes --]