* [PATCH v1 1/1] leds: an30259a: Get rid of custom led_init_default_state_get()
@ 2022-08-02 21:25 Andy Shevchenko
2022-08-02 23:43 ` kernel test robot
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andy Shevchenko @ 2022-08-02 21:25 UTC (permalink / raw)
To: Andy Shevchenko, linux-leds, linux-kernel; +Cc: Pavel Machek
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-an30259a.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/drivers/leds/leds-an30259a.c b/drivers/leds/leds-an30259a.c
index a0df1fb28774..d368df776153 100644
--- a/drivers/leds/leds-an30259a.c
+++ b/drivers/leds/leds-an30259a.c
@@ -55,10 +55,6 @@
#define AN30259A_NAME "an30259a"
-#define STATE_OFF 0
-#define STATE_KEEP 1
-#define STATE_ON 2
-
struct an30259a;
struct an30259a_led {
@@ -66,7 +62,7 @@ struct an30259a_led {
struct fwnode_handle *fwnode;
struct led_classdev cdev;
u32 num;
- u32 default_state;
+ enum led_default_state default_state;
bool sloping;
};
@@ -228,15 +224,7 @@ static int an30259a_dt_init(struct i2c_client *client,
led->num = source;
led->chip = chip;
led->fwnode = of_fwnode_handle(child);
-
- if (!of_property_read_string(child, "default-state", &str)) {
- if (!strcmp(str, "on"))
- led->default_state = STATE_ON;
- else if (!strcmp(str, "keep"))
- led->default_state = STATE_KEEP;
- else
- led->default_state = STATE_OFF;
- }
+ led->default_state = led_init_default_state_get(led->fwnode);
i++;
}
@@ -261,10 +249,10 @@ static void an30259a_init_default_state(struct an30259a_led *led)
int led_on, err;
switch (led->default_state) {
- case STATE_ON:
+ case LEDS_DEFSTATE_ON:
led->cdev.brightness = LED_FULL;
break;
- case STATE_KEEP:
+ case LEDS_DEFSTATE_KEEP:
err = regmap_read(chip->regmap, AN30259A_REG_LED_ON, &led_on);
if (err)
break;
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] leds: an30259a: Get rid of custom led_init_default_state_get()
2022-08-02 21:25 [PATCH v1 1/1] leds: an30259a: Get rid of custom led_init_default_state_get() Andy Shevchenko
@ 2022-08-02 23:43 ` kernel test robot
2022-08-03 1:26 ` kernel test robot
2022-08-03 2:07 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-08-02 23:43 UTC (permalink / raw)
To: Andy Shevchenko, linux-leds, linux-kernel; +Cc: llvm, kbuild-all, Pavel Machek
Hi Andy,
I love your patch! Perhaps something to improve:
[auto build test WARNING on pavel-leds/for-next]
[also build test WARNING 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-an30259a-Get-rid-of-custom-led_init_default_state_get/20220803-053038
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/202208030728.77z65TO4-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/757448b8fc5bcbc4303ce9570d5dd555f1e2b22e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/leds-an30259a-Get-rid-of-custom-led_init_default_state_get/20220803-053038
git checkout 757448b8fc5bcbc4303ce9570d5dd555f1e2b22e
# 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 drivers/leds/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/leds/leds-an30259a.c:227:24: error: call to undeclared function 'led_init_default_state_get'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
led->default_state = led_init_default_state_get(led->fwnode);
^
>> drivers/leds/leds-an30259a.c:204:14: warning: unused variable 'str' [-Wunused-variable]
const char *str;
^
1 warning and 1 error generated.
vim +/str +204 drivers/leds/leds-an30259a.c
2d00f35c55e74f Simon Shields 2018-09-09 197
2d00f35c55e74f Simon Shields 2018-09-09 198 static int an30259a_dt_init(struct i2c_client *client,
2d00f35c55e74f Simon Shields 2018-09-09 199 struct an30259a *chip)
2d00f35c55e74f Simon Shields 2018-09-09 200 {
8853c95e997e0a Marek Behún 2020-09-18 201 struct device_node *np = dev_of_node(&client->dev), *child;
2d00f35c55e74f Simon Shields 2018-09-09 202 int count, ret;
2d00f35c55e74f Simon Shields 2018-09-09 203 int i = 0;
2d00f35c55e74f Simon Shields 2018-09-09 @204 const char *str;
2d00f35c55e74f Simon Shields 2018-09-09 205 struct an30259a_led *led;
2d00f35c55e74f Simon Shields 2018-09-09 206
99a013c840a050 Marek Behún 2020-09-18 207 count = of_get_available_child_count(np);
2d00f35c55e74f Simon Shields 2018-09-09 208 if (!count || count > AN30259A_MAX_LEDS)
2d00f35c55e74f Simon Shields 2018-09-09 209 return -EINVAL;
2d00f35c55e74f Simon Shields 2018-09-09 210
2d00f35c55e74f Simon Shields 2018-09-09 211 for_each_available_child_of_node(np, child) {
2d00f35c55e74f Simon Shields 2018-09-09 212 u32 source;
2d00f35c55e74f Simon Shields 2018-09-09 213
2d00f35c55e74f Simon Shields 2018-09-09 214 ret = of_property_read_u32(child, "reg", &source);
2d00f35c55e74f Simon Shields 2018-09-09 215 if (ret != 0 || !source || source > AN30259A_MAX_LEDS) {
2d00f35c55e74f Simon Shields 2018-09-09 216 dev_err(&client->dev, "Couldn't read LED address: %d\n",
2d00f35c55e74f Simon Shields 2018-09-09 217 ret);
2d00f35c55e74f Simon Shields 2018-09-09 218 count--;
2d00f35c55e74f Simon Shields 2018-09-09 219 continue;
2d00f35c55e74f Simon Shields 2018-09-09 220 }
2d00f35c55e74f Simon Shields 2018-09-09 221
2d00f35c55e74f Simon Shields 2018-09-09 222 led = &chip->leds[i];
2d00f35c55e74f Simon Shields 2018-09-09 223
2d00f35c55e74f Simon Shields 2018-09-09 224 led->num = source;
2d00f35c55e74f Simon Shields 2018-09-09 225 led->chip = chip;
1817208e14c6f7 Jacek Anaszewski 2019-06-09 226 led->fwnode = of_fwnode_handle(child);
757448b8fc5bcb Andy Shevchenko 2022-08-03 227 led->default_state = led_init_default_state_get(led->fwnode);
2d00f35c55e74f Simon Shields 2018-09-09 228
2d00f35c55e74f Simon Shields 2018-09-09 229 i++;
2d00f35c55e74f Simon Shields 2018-09-09 230 }
2d00f35c55e74f Simon Shields 2018-09-09 231
2d00f35c55e74f Simon Shields 2018-09-09 232 if (!count)
2d00f35c55e74f Simon Shields 2018-09-09 233 return -EINVAL;
2d00f35c55e74f Simon Shields 2018-09-09 234
2d00f35c55e74f Simon Shields 2018-09-09 235 chip->num_leds = i;
2d00f35c55e74f Simon Shields 2018-09-09 236
2d00f35c55e74f Simon Shields 2018-09-09 237 return 0;
2d00f35c55e74f Simon Shields 2018-09-09 238 }
2d00f35c55e74f Simon Shields 2018-09-09 239
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] leds: an30259a: Get rid of custom led_init_default_state_get()
2022-08-02 21:25 [PATCH v1 1/1] leds: an30259a: Get rid of custom led_init_default_state_get() Andy Shevchenko
2022-08-02 23:43 ` kernel test robot
@ 2022-08-03 1:26 ` kernel test robot
2022-08-03 2:07 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-08-03 1:26 UTC (permalink / raw)
To: Andy Shevchenko, linux-leds, linux-kernel; +Cc: llvm, kbuild-all, Pavel Machek
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-an30259a-Get-rid-of-custom-led_init_default_state_get/20220803-053038
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/202208030939.UxKQfaZY-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/757448b8fc5bcbc4303ce9570d5dd555f1e2b22e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/leds-an30259a-Get-rid-of-custom-led_init_default_state_get/20220803-053038
git checkout 757448b8fc5bcbc4303ce9570d5dd555f1e2b22e
# 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-an30259a.c:227:24: error: call to undeclared function 'led_init_default_state_get'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
led->default_state = led_init_default_state_get(led->fwnode);
^
drivers/leds/leds-an30259a.c:204:14: warning: unused variable 'str' [-Wunused-variable]
const char *str;
^
1 warning and 1 error generated.
vim +/led_init_default_state_get +227 drivers/leds/leds-an30259a.c
197
198 static int an30259a_dt_init(struct i2c_client *client,
199 struct an30259a *chip)
200 {
201 struct device_node *np = dev_of_node(&client->dev), *child;
202 int count, ret;
203 int i = 0;
204 const char *str;
205 struct an30259a_led *led;
206
207 count = of_get_available_child_count(np);
208 if (!count || count > AN30259A_MAX_LEDS)
209 return -EINVAL;
210
211 for_each_available_child_of_node(np, child) {
212 u32 source;
213
214 ret = of_property_read_u32(child, "reg", &source);
215 if (ret != 0 || !source || source > AN30259A_MAX_LEDS) {
216 dev_err(&client->dev, "Couldn't read LED address: %d\n",
217 ret);
218 count--;
219 continue;
220 }
221
222 led = &chip->leds[i];
223
224 led->num = source;
225 led->chip = chip;
226 led->fwnode = of_fwnode_handle(child);
> 227 led->default_state = led_init_default_state_get(led->fwnode);
228
229 i++;
230 }
231
232 if (!count)
233 return -EINVAL;
234
235 chip->num_leds = i;
236
237 return 0;
238 }
239
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] leds: an30259a: Get rid of custom led_init_default_state_get()
2022-08-02 21:25 [PATCH v1 1/1] leds: an30259a: Get rid of custom led_init_default_state_get() Andy Shevchenko
2022-08-02 23:43 ` kernel test robot
2022-08-03 1:26 ` kernel test robot
@ 2022-08-03 2:07 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-08-03 2:07 UTC (permalink / raw)
To: Andy Shevchenko, linux-leds, linux-kernel; +Cc: kbuild-all, Pavel Machek
Hi Andy,
I love your patch! Perhaps something to improve:
[auto build test WARNING on pavel-leds/for-next]
[also build test WARNING 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-an30259a-Get-rid-of-custom-led_init_default_state_get/20220803-053038
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/202208030937.hTPCqZ9v-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/757448b8fc5bcbc4303ce9570d5dd555f1e2b22e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/leds-an30259a-Get-rid-of-custom-led_init_default_state_get/20220803-053038
git checkout 757448b8fc5bcbc4303ce9570d5dd555f1e2b22e
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/leds/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/leds/leds-an30259a.c: In function 'an30259a_dt_init':
drivers/leds/leds-an30259a.c:227:38: error: implicit declaration of function 'led_init_default_state_get'; did you mean 'led_get_default_pattern'? [-Werror=implicit-function-declaration]
227 | led->default_state = led_init_default_state_get(led->fwnode);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
| led_get_default_pattern
>> drivers/leds/leds-an30259a.c:204:21: warning: unused variable 'str' [-Wunused-variable]
204 | const char *str;
| ^~~
cc1: some warnings being treated as errors
vim +/str +204 drivers/leds/leds-an30259a.c
2d00f35c55e74f Simon Shields 2018-09-09 197
2d00f35c55e74f Simon Shields 2018-09-09 198 static int an30259a_dt_init(struct i2c_client *client,
2d00f35c55e74f Simon Shields 2018-09-09 199 struct an30259a *chip)
2d00f35c55e74f Simon Shields 2018-09-09 200 {
8853c95e997e0a Marek Behún 2020-09-18 201 struct device_node *np = dev_of_node(&client->dev), *child;
2d00f35c55e74f Simon Shields 2018-09-09 202 int count, ret;
2d00f35c55e74f Simon Shields 2018-09-09 203 int i = 0;
2d00f35c55e74f Simon Shields 2018-09-09 @204 const char *str;
2d00f35c55e74f Simon Shields 2018-09-09 205 struct an30259a_led *led;
2d00f35c55e74f Simon Shields 2018-09-09 206
99a013c840a050 Marek Behún 2020-09-18 207 count = of_get_available_child_count(np);
2d00f35c55e74f Simon Shields 2018-09-09 208 if (!count || count > AN30259A_MAX_LEDS)
2d00f35c55e74f Simon Shields 2018-09-09 209 return -EINVAL;
2d00f35c55e74f Simon Shields 2018-09-09 210
2d00f35c55e74f Simon Shields 2018-09-09 211 for_each_available_child_of_node(np, child) {
2d00f35c55e74f Simon Shields 2018-09-09 212 u32 source;
2d00f35c55e74f Simon Shields 2018-09-09 213
2d00f35c55e74f Simon Shields 2018-09-09 214 ret = of_property_read_u32(child, "reg", &source);
2d00f35c55e74f Simon Shields 2018-09-09 215 if (ret != 0 || !source || source > AN30259A_MAX_LEDS) {
2d00f35c55e74f Simon Shields 2018-09-09 216 dev_err(&client->dev, "Couldn't read LED address: %d\n",
2d00f35c55e74f Simon Shields 2018-09-09 217 ret);
2d00f35c55e74f Simon Shields 2018-09-09 218 count--;
2d00f35c55e74f Simon Shields 2018-09-09 219 continue;
2d00f35c55e74f Simon Shields 2018-09-09 220 }
2d00f35c55e74f Simon Shields 2018-09-09 221
2d00f35c55e74f Simon Shields 2018-09-09 222 led = &chip->leds[i];
2d00f35c55e74f Simon Shields 2018-09-09 223
2d00f35c55e74f Simon Shields 2018-09-09 224 led->num = source;
2d00f35c55e74f Simon Shields 2018-09-09 225 led->chip = chip;
1817208e14c6f7 Jacek Anaszewski 2019-06-09 226 led->fwnode = of_fwnode_handle(child);
757448b8fc5bcb Andy Shevchenko 2022-08-03 227 led->default_state = led_init_default_state_get(led->fwnode);
2d00f35c55e74f Simon Shields 2018-09-09 228
2d00f35c55e74f Simon Shields 2018-09-09 229 i++;
2d00f35c55e74f Simon Shields 2018-09-09 230 }
2d00f35c55e74f Simon Shields 2018-09-09 231
2d00f35c55e74f Simon Shields 2018-09-09 232 if (!count)
2d00f35c55e74f Simon Shields 2018-09-09 233 return -EINVAL;
2d00f35c55e74f Simon Shields 2018-09-09 234
2d00f35c55e74f Simon Shields 2018-09-09 235 chip->num_leds = i;
2d00f35c55e74f Simon Shields 2018-09-09 236
2d00f35c55e74f Simon Shields 2018-09-09 237 return 0;
2d00f35c55e74f Simon Shields 2018-09-09 238 }
2d00f35c55e74f Simon Shields 2018-09-09 239
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-03 2:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02 21:25 [PATCH v1 1/1] leds: an30259a: Get rid of custom led_init_default_state_get() Andy Shevchenko
2022-08-02 23:43 ` kernel test robot
2022-08-03 1:26 ` kernel test robot
2022-08-03 2:07 ` kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.