Re: [PATCH net-next v6 1/1] net: dsa: hellcreek: Get rid of custom led_init_default_state_get()
From: kernel test robot
Date: Tue Mar 14 2023 - 21:06:08 EST
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/net-dsa-hellcreek-Get-rid-of-custom-led_init_default_state_get/20230315-021931
patch link: https://lore.kernel.org/r/20230314181824.56881-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH net-next v6 1/1] net: dsa: hellcreek: Get rid of custom led_init_default_state_get()
config: i386-randconfig-a015-20230313 (https://download.01.org/0day-ci/archive/20230315/202303150831.vgyKe8FD-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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://github.com/intel-lab-lkp/linux/commit/fdd54417a75386e7ad47065c21403835b7fda94a
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/net-dsa-hellcreek-Get-rid-of-custom-led_init_default_state_get/20230315-021931
git checkout fdd54417a75386e7ad47065c21403835b7fda94a
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/net/dsa/hirschmann/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202303150831.vgyKe8FD-lkp@xxxxxxxxx/
All errors (new ones prefixed by >>):
>> drivers/net/dsa/hirschmann/hellcreek_ptp.c:322:10: error: implicit declaration of function 'led_init_default_state_get' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
state = led_init_default_state_get(of_fwnode_handle(led));
^
1 error generated.
vim +/led_init_default_state_get +322 drivers/net/dsa/hirschmann/hellcreek_ptp.c
292
293 /* There two available LEDs internally called sync_good and is_gm. However, the
294 * user might want to use a different label and specify the default state. Take
295 * those properties from device tree.
296 */
297 static int hellcreek_led_setup(struct hellcreek *hellcreek)
298 {
299 struct device_node *leds, *led = NULL;
300 enum led_default_state state;
301 const char *label;
302 int ret = -EINVAL;
303
304 of_node_get(hellcreek->dev->of_node);
305 leds = of_find_node_by_name(hellcreek->dev->of_node, "leds");
306 if (!leds) {
307 dev_err(hellcreek->dev, "No LEDs specified in device tree!\n");
308 return ret;
309 }
310
311 hellcreek->status_out = 0;
312
313 led = of_get_next_available_child(leds, led);
314 if (!led) {
315 dev_err(hellcreek->dev, "First LED not specified!\n");
316 goto out;
317 }
318
319 ret = of_property_read_string(led, "label", &label);
320 hellcreek->led_sync_good.name = ret ? "sync_good" : label;
321
> 322 state = led_init_default_state_get(of_fwnode_handle(led));
323 switch (state) {
324 case LEDS_DEFSTATE_ON:
325 hellcreek->led_sync_good.brightness = 1;
326 break;
327 case LEDS_DEFSTATE_KEEP:
328 hellcreek->led_sync_good.brightness =
329 hellcreek_get_brightness(hellcreek, STATUS_OUT_SYNC_GOOD);
330 break;
331 default:
332 hellcreek->led_sync_good.brightness = 0;
333 }
334
335 hellcreek->led_sync_good.max_brightness = 1;
336 hellcreek->led_sync_good.brightness_set = hellcreek_led_sync_good_set;
337 hellcreek->led_sync_good.brightness_get = hellcreek_led_sync_good_get;
338
339 led = of_get_next_available_child(leds, led);
340 if (!led) {
341 dev_err(hellcreek->dev, "Second LED not specified!\n");
342 ret = -EINVAL;
343 goto out;
344 }
345
346 ret = of_property_read_string(led, "label", &label);
347 hellcreek->led_is_gm.name = ret ? "is_gm" : label;
348
349 state = led_init_default_state_get(of_fwnode_handle(led));
350 switch (state) {
351 case LEDS_DEFSTATE_ON:
352 hellcreek->led_is_gm.brightness = 1;
353 break;
354 case LEDS_DEFSTATE_KEEP:
355 hellcreek->led_is_gm.brightness =
356 hellcreek_get_brightness(hellcreek, STATUS_OUT_IS_GM);
357 break;
358 default:
359 hellcreek->led_is_gm.brightness = 0;
360 }
361
362 hellcreek->led_is_gm.max_brightness = 1;
363 hellcreek->led_is_gm.brightness_set = hellcreek_led_is_gm_set;
364 hellcreek->led_is_gm.brightness_get = hellcreek_led_is_gm_get;
365
366 /* Set initial state */
367 if (hellcreek->led_sync_good.brightness == 1)
368 hellcreek_set_brightness(hellcreek, STATUS_OUT_SYNC_GOOD, 1);
369 if (hellcreek->led_is_gm.brightness == 1)
370 hellcreek_set_brightness(hellcreek, STATUS_OUT_IS_GM, 1);
371
372 /* Register both leds */
373 led_classdev_register(hellcreek->dev, &hellcreek->led_sync_good);
374 led_classdev_register(hellcreek->dev, &hellcreek->led_is_gm);
375
376 ret = 0;
377
378 out:
379 of_node_put(leds);
380
381 return ret;
382 }
383
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests