drivers/leds/flash/leds-rt8515.c:354: undefined reference to `v4l2_flash_init'

From: kernel test robot
Date: Thu Feb 11 2021 - 12:13:34 EST


Hi Linus,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 291009f656e8eaebbdfd3a8d99f6b190a9ce9deb
commit: e1c6edcbea13de025c3406645b4cce4ac3baf973 leds: rt8515: Add Richtek RT8515 LED driver
date: 11 days ago
config: i386-randconfig-a005-20210209 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e1c6edcbea13de025c3406645b4cce4ac3baf973
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout e1c6edcbea13de025c3406645b4cce4ac3baf973
# save the attached .config to linux build tree
make W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

ld: drivers/leds/flash/leds-rt8515.o: in function `rt8515_v4l2_flash_release':
drivers/leds/flash/leds-rt8515.c:216: undefined reference to `v4l2_flash_release'
ld: drivers/leds/flash/leds-rt8515.o: in function `rt8515_probe':
>> drivers/leds/flash/leds-rt8515.c:354: undefined reference to `v4l2_flash_init'


vim +354 drivers/leds/flash/leds-rt8515.c

275
276 static int rt8515_probe(struct platform_device *pdev)
277 {
278 struct device *dev = &pdev->dev;
279 struct fwnode_handle *child;
280 struct rt8515 *rt;
281 struct led_classdev *led;
282 struct led_classdev_flash *fled;
283 struct led_init_data init_data = {};
284 struct v4l2_flash_config v4l2_sd_cfg = {};
285 int ret;
286
287 rt = devm_kzalloc(dev, sizeof(*rt), GFP_KERNEL);
288 if (!rt)
289 return -ENOMEM;
290
291 rt->dev = dev;
292 fled = &rt->fled;
293 led = &fled->led_cdev;
294
295 /* ENF - Enable Flash line */
296 rt->enable_flash = devm_gpiod_get(dev, "enf", GPIOD_OUT_LOW);
297 if (IS_ERR(rt->enable_flash))
298 return dev_err_probe(dev, PTR_ERR(rt->enable_flash),
299 "cannot get ENF (enable flash) GPIO\n");
300
301 /* ENT - Enable Torch line */
302 rt->enable_torch = devm_gpiod_get(dev, "ent", GPIOD_OUT_LOW);
303 if (IS_ERR(rt->enable_torch))
304 return dev_err_probe(dev, PTR_ERR(rt->enable_torch),
305 "cannot get ENT (enable torch) GPIO\n");
306
307 child = fwnode_get_next_available_child_node(dev->fwnode, NULL);
308 if (!child) {
309 dev_err(dev,
310 "No fwnode child node found for connected LED.\n");
311 return -EINVAL;
312 }
313 init_data.fwnode = child;
314
315 rt8515_determine_max_intensity(rt, child, "richtek,rfs-ohms",
316 "flash-max-microamp",
317 RT8515_FLASH_MAX,
318 &rt->flash_max_intensity);
319 rt8515_determine_max_intensity(rt, child, "richtek,rts-ohms",
320 "led-max-microamp",
321 RT8515_TORCH_MAX,
322 &rt->torch_max_intensity);
323
324 ret = fwnode_property_read_u32(child, "flash-max-timeout-us",
325 &rt->max_timeout);
326 if (ret) {
327 rt->max_timeout = RT8515_MAX_TIMEOUT_US;
328 dev_warn(dev,
329 "flash-max-timeout-us property missing\n");
330 }
331 timer_setup(&rt->powerdown_timer, rt8515_powerdown_timer, 0);
332 rt8515_init_flash_timeout(rt);
333
334 fled->ops = &rt8515_flash_ops;
335
336 led->max_brightness = rt->torch_max_intensity;
337 led->brightness_set_blocking = rt8515_led_brightness_set;
338 led->flags |= LED_CORE_SUSPENDRESUME | LED_DEV_CAP_FLASH;
339
340 mutex_init(&rt->lock);
341
342 platform_set_drvdata(pdev, rt);
343
344 ret = devm_led_classdev_flash_register_ext(dev, fled, &init_data);
345 if (ret) {
346 dev_err(dev, "can't register LED %s\n", led->name);
347 mutex_destroy(&rt->lock);
348 return ret;
349 }
350
351 rt8515_init_v4l2_flash_config(rt, &v4l2_sd_cfg);
352
353 /* Create a V4L2 Flash device if V4L2 flash is enabled */
> 354 rt->v4l2_flash = v4l2_flash_init(dev, child, fled, NULL, &v4l2_sd_cfg);
355 if (IS_ERR(rt->v4l2_flash)) {
356 ret = PTR_ERR(rt->v4l2_flash);
357 dev_err(dev, "failed to register V4L2 flash device (%d)\n",
358 ret);
359 /*
360 * Continue without the V4L2 flash
361 * (we still have the classdev)
362 */
363 }
364
365 return 0;
366 }
367

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

Attachment: .config.gz
Description: application/gzip