Subject: Re: [PATCH v5 4/8] leds: trigger: netdev: rename and expose NETDEV trigger enum and struct

From: kernel test robot <[email-masked]>
Date: Sat, 13 Nov 2021 02:58:32 +0800

Hi Ansuel,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net/master]
[also build test ERROR on linus/master next-20211112]
[cannot apply to pavel-leds/for-next robh/for-next net-next/master v5.15]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Ansuel-Smith/Adds-support-for-PHY-LEDs-with-offload-triggers/20211112-233807
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 5833291ab6de9c3e2374336b51c814e515e8f3a5
config: i386-buildonly-randconfig-r004-20211112 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c3dddeeafb529e769cde87bd29ef6271ac6bfa5c)
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/0day-ci/linux/commit/4aa7005c8428f867be20ecd0afe4bc2ccdf6da4a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Ansuel-Smith/Adds-support-for-PHY-LEDs-with-offload-triggers/20211112-233807
        git checkout 4aa7005c8428f867be20ecd0afe4bc2ccdf6da4a
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/leds/trigger/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email-masked]>

All error/warnings (new ones prefixed by >>):

>> drivers/leds/trigger/ledtrig-netdev.c:45:39: warning: declaration of 'struct led_netdev_data' will not be visible outside of this function [-Wvisibility]
   static void set_baseline_state(struct led_netdev_data *trigger_data)
                                         ^
>> drivers/leds/trigger/ledtrig-netdev.c:48:46: error: incomplete definition of type 'struct led_netdev_data'
           struct led_classdev *led_cdev = trigger_data->led_cdev;
                                           ~~~~~~~~~~~~^
   drivers/leds/trigger/ledtrig-netdev.c:45:39: note: forward declaration of 'struct led_netdev_data'
   static void set_baseline_state(struct led_netdev_data *trigger_data)
                                         ^
   drivers/leds/trigger/ledtrig-netdev.c:56:19: error: incomplete definition of type 'struct led_netdev_data'
           if (!trigger_data->carrier_link_up) {
                ~~~~~~~~~~~~^
   drivers/leds/trigger/ledtrig-netdev.c:45:39: note: forward declaration of 'struct led_netdev_data'
   static void set_baseline_state(struct led_netdev_data *trigger_data)
                                         ^
   drivers/leds/trigger/ledtrig-netdev.c:59:50: error: incomplete definition of type 'struct led_netdev_data'
                   if (test_bit(TRIGGER_NETDEV_LINK, &trigger_data->mode))
                                                      ~~~~~~~~~~~~^
   drivers/leds/trigger/ledtrig-netdev.c:45:39: note: forward declaration of 'struct led_netdev_data'
   static void set_baseline_state(struct led_netdev_data *trigger_data)
                                         ^
>> drivers/leds/trigger/ledtrig-netdev.c:59:16: error: use of undeclared identifier 'TRIGGER_NETDEV_LINK'
                   if (test_bit(TRIGGER_NETDEV_LINK, &trigger_data->mode))
                                ^
   drivers/leds/trigger/ledtrig-netdev.c:68:48: error: incomplete definition of type 'struct led_netdev_data'
                   if (test_bit(TRIGGER_NETDEV_TX, &trigger_data->mode) ||
                                                    ~~~~~~~~~~~~^
   drivers/leds/trigger/ledtrig-netdev.c:45:39: note: forward declaration of 'struct led_netdev_data'
   static void set_baseline_state(struct led_netdev_data *trigger_data)
                                         ^
   drivers/leds/trigger/ledtrig-netdev.c:69:48: error: incomplete definition of type 'struct led_netdev_data'
                       test_bit(TRIGGER_NETDEV_RX, &trigger_data->mode))
                                                    ~~~~~~~~~~~~^
   drivers/leds/trigger/ledtrig-netdev.c:45:39: note: forward declaration of 'struct led_netdev_data'
   static void set_baseline_state(struct led_netdev_data *trigger_data)
                                         ^
>> drivers/leds/trigger/ledtrig-netdev.c:68:16: error: use of undeclared identifier 'TRIGGER_NETDEV_TX'
                   if (test_bit(TRIGGER_NETDEV_TX, &trigger_data->mode) ||
                                ^
>> drivers/leds/trigger/ledtrig-netdev.c:69:16: error: use of undeclared identifier 'TRIGGER_NETDEV_RX'
                       test_bit(TRIGGER_NETDEV_RX, &trigger_data->mode))
                                ^
   drivers/leds/trigger/ledtrig-netdev.c:70:39: error: incomplete definition of type 'struct led_netdev_data'
                           schedule_delayed_work(&trigger_data->work, 0);
                                                  ~~~~~~~~~~~~^
   drivers/leds/trigger/ledtrig-netdev.c:45:39: note: forward declaration of 'struct led_netdev_data'
   static void set_baseline_state(struct led_netdev_data *trigger_data)
                                         ^
   drivers/leds/trigger/ledtrig-netdev.c:80:28: error: incomplete definition of type 'struct led_netdev_data'
           spin_lock_bh(&trigger_data->lock);
                         ~~~~~~~~~~~~^
   drivers/leds/trigger/ledtrig-netdev.c:77:9: note: forward declaration of 'struct led_netdev_data'
           struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev);
                  ^
   drivers/leds/trigger/ledtrig-netdev.c:81:41: error: incomplete definition of type 'struct led_netdev_data'
           len = sprintf(buf, "%s\n", trigger_data->device_name);
                                      ~~~~~~~~~~~~^
   drivers/leds/trigger/ledtrig-netdev.c:77:9: note: forward declaration of 'struct led_netdev_data'
           struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev);
                  ^
   drivers/leds/trigger/ledtrig-netdev.c:82:30: error: incomplete definition of type 'struct led_netdev_data'
           spin_unlock_bh(&trigger_data->lock);
                           ~~~~~~~~~~~~^
   drivers/leds/trigger/ledtrig-netdev.c:77:9: note: forward declaration of 'struct led_netdev_data'
           struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev);
                  ^
   drivers/leds/trigger/ledtrig-netdev.c:96:40: error: incomplete definition of type 'struct led_netdev_data'
           cancel_delayed_work_sync(&trigger_data->work);
                                     ~~~~~~~~~~~~^
   drivers/leds/trigger/ledtrig-netdev.c:91:9: note: forward declaration of 'struct led_netdev_data'
           struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev);
                  ^
   drivers/leds/trigger/ledtrig-netdev.c:98:28: error: incomplete definition of type 'struct led_netdev_data'
           spin_lock_bh(&trigger_data->lock);
                         ~~~~~~~~~~~~^
   drivers/leds/trigger/ledtrig-netdev.c:91:9: note: forward declaration of 'struct led_netdev_data'
           struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev);
                  ^
   drivers/leds/trigger/ledtrig-netdev.c:100:18: error: incomplete definition of type 'struct led_netdev_data'
           if (trigger_data->net_dev) {
               ~~~~~~~~~~~~^
   drivers/leds/trigger/ledtrig-netdev.c:91:9: note: forward declaration of 'struct led_netdev_data'
           struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev);
                  ^
   drivers/leds/trigger/ledtrig-netdev.c:101:23: error: incomplete definition of type 'struct led_netdev_data'
                   dev_put(trigger_data->net_dev);
                           ~~~~~~~~~~~~^
   drivers/leds/trigger/ledtrig-netdev.c:91:9: note: forward declaration of 'struct led_netdev_data'
           struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev);
                  ^
   drivers/leds/trigger/ledtrig-netdev.c:102:15: error: incomplete definition of type 'struct led_netdev_data'
                   trigger_data->net_dev = NULL;
                   ~~~~~~~~~~~~^
   drivers/leds/trigger/ledtrig-netdev.c:91:9: note: forward declaration of 'struct led_netdev_data'
           struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev);
                  ^
   drivers/leds/trigger/ledtrig-netdev.c:105:21: error: incomplete definition of type 'struct led_netdev_data'
           memcpy(trigger_data->device_name, buf, size);
                  ~~~~~~~~~~~~^
   arch/x86/include/asm/string_32.h:182:42: note: expanded from macro 'memcpy'
   #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
                                            ^
   drivers/leds/trigger/ledtrig-netdev.c:91:9: note: forward declaration of 'struct led_netdev_data'
           struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev);
                  ^
   drivers/leds/trigger/ledtrig-netdev.c:106:14: error: incomplete definition of type 'struct led_netdev_data'
           trigger_data->device_name[size] = 0;
           ~~~~~~~~~~~~^
   drivers/leds/trigger/ledtrig-netdev.c:91:9: note: forward declaration of 'struct led_netdev_data'
           struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev);
                  ^
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   1 warning and 20 errors generated.

vim +48 drivers/leds/trigger/ledtrig-netdev.c

06f502f57d0d77 Ben Whitten  2017-12-10  44  
06f502f57d0d77 Ben Whitten  2017-12-10 @45  static void set_baseline_state(struct led_netdev_data *trigger_data)
06f502f57d0d77 Ben Whitten  2017-12-10  46  {
06f502f57d0d77 Ben Whitten  2017-12-10  47  	int current_brightness;
06f502f57d0d77 Ben Whitten  2017-12-10 @48  	struct led_classdev *led_cdev = trigger_data->led_cdev;
06f502f57d0d77 Ben Whitten  2017-12-10  49  
06f502f57d0d77 Ben Whitten  2017-12-10  50  	current_brightness = led_cdev->brightness;
06f502f57d0d77 Ben Whitten  2017-12-10  51  	if (current_brightness)
06f502f57d0d77 Ben Whitten  2017-12-10  52  		led_cdev->blink_brightness = current_brightness;
06f502f57d0d77 Ben Whitten  2017-12-10  53  	if (!led_cdev->blink_brightness)
06f502f57d0d77 Ben Whitten  2017-12-10  54  		led_cdev->blink_brightness = led_cdev->max_brightness;
06f502f57d0d77 Ben Whitten  2017-12-10  55  
df437de7347286 Ansuel Smith 2021-11-12  56  	if (!trigger_data->carrier_link_up) {
06f502f57d0d77 Ben Whitten  2017-12-10  57  		led_set_brightness(led_cdev, LED_OFF);
df437de7347286 Ansuel Smith 2021-11-12  58  	} else {
4aa7005c8428f8 Ansuel Smith 2021-11-12 @59  		if (test_bit(TRIGGER_NETDEV_LINK, &trigger_data->mode))
06f502f57d0d77 Ben Whitten  2017-12-10  60  			led_set_brightness(led_cdev,
06f502f57d0d77 Ben Whitten  2017-12-10  61  					   led_cdev->blink_brightness);
06f502f57d0d77 Ben Whitten  2017-12-10  62  		else
06f502f57d0d77 Ben Whitten  2017-12-10  63  			led_set_brightness(led_cdev, LED_OFF);
06f502f57d0d77 Ben Whitten  2017-12-10  64  
06f502f57d0d77 Ben Whitten  2017-12-10  65  		/* If we are looking for RX/TX start periodically
06f502f57d0d77 Ben Whitten  2017-12-10  66  		 * checking stats
06f502f57d0d77 Ben Whitten  2017-12-10  67  		 */
4aa7005c8428f8 Ansuel Smith 2021-11-12 @68  		if (test_bit(TRIGGER_NETDEV_TX, &trigger_data->mode) ||
4aa7005c8428f8 Ansuel Smith 2021-11-12 @69  		    test_bit(TRIGGER_NETDEV_RX, &trigger_data->mode))
06f502f57d0d77 Ben Whitten  2017-12-10  70  			schedule_delayed_work(&trigger_data->work, 0);
06f502f57d0d77 Ben Whitten  2017-12-10  71  	}
06f502f57d0d77 Ben Whitten  2017-12-10  72  }
06f502f57d0d77 Ben Whitten  2017-12-10  73  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email-masked]