Message ID | 20220802212537.7122-1-andriy.shevchenko@linux.intel.com |
---|---|
State | Superseded |
Headers | show |
Series | [v1,1/1] leds: mt6323: Get rid of custom led_init_default_state_get() | expand |
Hi Andy, I love your patch! Yet something to improve: [auto build test ERROR on pavel-leds/for-next] [also build test ERROR on linus/master v5.19 next-20220728] [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#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/leds-mt6323-Get-rid-of-custom-led_init_default_state_get/20220803-052811 base: git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git for-next config: x86_64-randconfig-a005-20220801 (https://download.01.org/0day-ci/archive/20220803/202208030841.jfVsINQD-lkp@intel.com/config) compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 52cd00cabf479aa7eb6dbb063b7ba41ea57bce9e) 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/30cc6458329b3d5a593e0d2173dc63d8dc6446f5 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Andy-Shevchenko/leds-mt6323-Get-rid-of-custom-led_init_default_state_get/20220803-052811 git checkout 30cc6458329b3d5a593e0d2173dc63d8dc6446f5 # 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=x86_64 SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> drivers/leds/leds-mt6323.c:345:10: error: call to undeclared function 'led_init_default_state_get'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] state = led_init_default_state_get(of_fwnode_handle(np)); ^ 1 error generated. vim +/led_init_default_state_get +345 drivers/leds/leds-mt6323.c 337 338 static int mt6323_led_set_dt_default(struct led_classdev *cdev, 339 struct device_node *np) 340 { 341 struct mt6323_led *led = container_of(cdev, struct mt6323_led, cdev); 342 enum led_default_state state; 343 int ret = 0; 344 > 345 state = led_init_default_state_get(of_fwnode_handle(np)); 346 switch (state) { 347 case LEDS_DEFSTATE_ON: 348 ret = mt6323_led_set_brightness(cdev, cdev->max_brightness); 349 break; 350 case LEDS_DEFSTATE_KEEP: 351 ret = mt6323_get_led_hw_brightness(cdev); 352 if (ret < 0) 353 return ret; 354 led->current_brightness = ret; 355 ret = 0; 356 break; 357 default: 358 ret = mt6323_led_set_brightness(cdev, LED_OFF); 359 } 360 361 return ret; 362 } 363
Hi Andy, I love your patch! Yet something to improve: [auto build test ERROR on pavel-leds/for-next] [also build test ERROR on linus/master v5.19 next-20220728] [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#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/leds-mt6323-Get-rid-of-custom-led_init_default_state_get/20220803-052811 base: git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git for-next config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20220803/202208031036.PJtAjxAm-lkp@intel.com/config) compiler: gcc-11 (Debian 11.3.0-3) 11.3.0 reproduce (this is a W=1 build): # https://github.com/intel-lab-lkp/linux/commit/30cc6458329b3d5a593e0d2173dc63d8dc6446f5 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Andy-Shevchenko/leds-mt6323-Get-rid-of-custom-led_init_default_state_get/20220803-052811 git checkout 30cc6458329b3d5a593e0d2173dc63d8dc6446f5 # save the config file mkdir build_dir && cp config build_dir/.config make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/ If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/leds/leds-mt6323.c: In function 'mt6323_led_set_dt_default': >> drivers/leds/leds-mt6323.c:345:17: error: implicit declaration of function 'led_init_default_state_get'; did you mean 'led_get_default_pattern'? [-Werror=implicit-function-declaration] 345 | state = led_init_default_state_get(of_fwnode_handle(np)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | led_get_default_pattern cc1: some warnings being treated as errors vim +345 drivers/leds/leds-mt6323.c 337 338 static int mt6323_led_set_dt_default(struct led_classdev *cdev, 339 struct device_node *np) 340 { 341 struct mt6323_led *led = container_of(cdev, struct mt6323_led, cdev); 342 enum led_default_state state; 343 int ret = 0; 344 > 345 state = led_init_default_state_get(of_fwnode_handle(np)); 346 switch (state) { 347 case LEDS_DEFSTATE_ON: 348 ret = mt6323_led_set_brightness(cdev, cdev->max_brightness); 349 break; 350 case LEDS_DEFSTATE_KEEP: 351 ret = mt6323_get_led_hw_brightness(cdev); 352 if (ret < 0) 353 return ret; 354 led->current_brightness = ret; 355 ret = 0; 356 break; 357 default: 358 ret = mt6323_led_set_brightness(cdev, LED_OFF); 359 } 360 361 return ret; 362 } 363
diff --git a/drivers/leds/leds-mt6323.c b/drivers/leds/leds-mt6323.c index f59e0e8bda8b..17ee88043f52 100644 --- a/drivers/leds/leds-mt6323.c +++ b/drivers/leds/leds-mt6323.c @@ -339,23 +339,23 @@ static int mt6323_led_set_dt_default(struct led_classdev *cdev, struct device_node *np) { struct mt6323_led *led = container_of(cdev, struct mt6323_led, cdev); - const char *state; + enum led_default_state state; int ret = 0; - state = of_get_property(np, "default-state", NULL); - if (state) { - if (!strcmp(state, "keep")) { - ret = mt6323_get_led_hw_brightness(cdev); - if (ret < 0) - return ret; - led->current_brightness = ret; - ret = 0; - } else if (!strcmp(state, "on")) { - ret = - mt6323_led_set_brightness(cdev, cdev->max_brightness); - } else { - ret = mt6323_led_set_brightness(cdev, LED_OFF); - } + state = led_init_default_state_get(of_fwnode_handle(np)); + switch (state) { + case LEDS_DEFSTATE_ON: + ret = mt6323_led_set_brightness(cdev, cdev->max_brightness); + break; + case LEDS_DEFSTATE_KEEP: + ret = mt6323_get_led_hw_brightness(cdev); + if (ret < 0) + return ret; + led->current_brightness = ret; + ret = 0; + break; + default: + ret = mt6323_led_set_brightness(cdev, LED_OFF); } return ret;
LED core provides a helper to parse default state from firmware node. Use it instead of custom implementation. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/leds/leds-mt6323.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)