Re: [PATCH 2/7] regulator: slg51000: switch to using fwnode_gpiod_get_index

2019-10-04 Thread kbuild test robot
Hi Dmitry,

I love your patch! Yet something to improve:

[auto build test ERROR on regulator/for-next]
[cannot apply to v5.4-rc1 next-20191004]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:
https://github.com/0day-ci/linux/commits/Dmitry-Torokhov/regulator-switch-to-using-devm_-fwnode_gpiod_get_index/20191005-085020
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 
for-next
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 7.4.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=sh 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

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

   drivers/regulator/slg51000-regulator.c: In function 'slg51000_of_parse_cb':
>> drivers/regulator/slg51000-regulator.c:203:14: error: implicit declaration 
>> of function 'fwnode_gpiod_get_index'; did you mean 'devm_gpiod_get_index'? 
>> [-Werror=implicit-function-declaration]
 ena_gpiod = fwnode_gpiod_get_index(of_fwnode_handle(np), "enable", 0,
 ^~
 devm_gpiod_get_index
>> drivers/regulator/slg51000-regulator.c:203:12: warning: assignment makes 
>> pointer from integer without a cast [-Wint-conversion]
 ena_gpiod = fwnode_gpiod_get_index(of_fwnode_handle(np), "enable", 0,
   ^
   cc1: some warnings being treated as errors

vim +203 drivers/regulator/slg51000-regulator.c

   196  
   197  static int slg51000_of_parse_cb(struct device_node *np,
   198  const struct regulator_desc *desc,
   199  struct regulator_config *config)
   200  {
   201  struct gpio_desc *ena_gpiod;
   202  
 > 203  ena_gpiod = fwnode_gpiod_get_index(of_fwnode_handle(np), 
 > "enable", 0,
   204 GPIOD_OUT_LOW |
   205  
GPIOD_FLAGS_BIT_NONEXCLUSIVE,
   206 "gpio-en-ldo");
   207  if (!IS_ERR(ena_gpiod))
   208  config->ena_gpiod = ena_gpiod;
   209  
   210  return 0;
   211  }
   212  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[PATCH 2/7] regulator: slg51000: switch to using fwnode_gpiod_get_index

2019-10-04 Thread Dmitry Torokhov
devm_gpiod_get_from_of_node() is being retired in favor of
[devm_]fwnode_gpiod_get_index(), that behaves similar to
devm_gpiod_get_index(), but can work with arbitrary firmware node. It
will also be able to support secondary software nodes.

Let's switch this driver over.

Note that now that we have a good non-devm API for getting GPIO from
arbitrary firmware node, there is no reason to use devm API here as
regulator core takes care of managing lifetime of "enable" GPIO and we
were immediately detaching requested GPIO from devm anyway.

Signed-off-by: Dmitry Torokhov 
---

 drivers/regulator/slg51000-regulator.c | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/regulator/slg51000-regulator.c 
b/drivers/regulator/slg51000-regulator.c
index a0565daecace..bf1a3508ebc4 100644
--- a/drivers/regulator/slg51000-regulator.c
+++ b/drivers/regulator/slg51000-regulator.c
@@ -198,17 +198,14 @@ static int slg51000_of_parse_cb(struct device_node *np,
const struct regulator_desc *desc,
struct regulator_config *config)
 {
-   struct slg51000 *chip = config->driver_data;
struct gpio_desc *ena_gpiod;
-   enum gpiod_flags gflags = GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE;
 
-   ena_gpiod = devm_gpiod_get_from_of_node(chip->dev, np,
-   "enable-gpios", 0,
-   gflags, "gpio-en-ldo");
-   if (!IS_ERR(ena_gpiod)) {
+   ena_gpiod = fwnode_gpiod_get_index(of_fwnode_handle(np), "enable", 0,
+  GPIOD_OUT_LOW |
+   GPIOD_FLAGS_BIT_NONEXCLUSIVE,
+  "gpio-en-ldo");
+   if (!IS_ERR(ena_gpiod))
config->ena_gpiod = ena_gpiod;
-   devm_gpiod_unhinge(chip->dev, config->ena_gpiod);
-   }
 
return 0;
 }
-- 
2.23.0.581.g78d2f28ef7-goog