Re: [PATCH v2] gpio: regmap: set gpio_chip of_node

From: kernel test robot
Date: Wed Mar 17 2021 - 12:08:35 EST


Hi "Álvaro,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on gpio/for-next]
[also build test ERROR on v5.12-rc3 next-20210317]
[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/lvaro-Fern-ndez-Rojas/gpio-regmap-set-gpio_chip-of_node/20210304-152016
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: x86_64-randconfig-a013-20210317 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8ef111222a3dd12a9175f69c3bff598c46e8bdf7)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/832a71aa1e741f0ef3b28952bf53627a820a7d68
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review lvaro-Fern-ndez-Rojas/gpio-regmap-set-gpio_chip-of_node/20210304-152016
git checkout 832a71aa1e741f0ef3b28952bf53627a820a7d68
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

>> drivers/gpio/gpio-regmap.c:252:8: error: no member named 'of_node' in 'struct gpio_chip'
chip->of_node = config->of_node ?: dev_of_node(config->parent);
~~~~ ^
1 error generated.


vim +252 drivers/gpio/gpio-regmap.c

192
193 /**
194 * gpio_regmap_register() - Register a generic regmap GPIO controller
195 * @config: configuration for gpio_regmap
196 *
197 * Return: A pointer to the registered gpio_regmap or ERR_PTR error value.
198 */
199 struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config)
200 {
201 struct gpio_regmap *gpio;
202 struct gpio_chip *chip;
203 int ret;
204
205 if (!config->parent)
206 return ERR_PTR(-EINVAL);
207
208 if (!config->ngpio)
209 return ERR_PTR(-EINVAL);
210
211 /* we need at least one */
212 if (!config->reg_dat_base && !config->reg_set_base)
213 return ERR_PTR(-EINVAL);
214
215 /* if we have a direction register we need both input and output */
216 if ((config->reg_dir_out_base || config->reg_dir_in_base) &&
217 (!config->reg_dat_base || !config->reg_set_base))
218 return ERR_PTR(-EINVAL);
219
220 /* we don't support having both registers simultaneously for now */
221 if (config->reg_dir_out_base && config->reg_dir_in_base)
222 return ERR_PTR(-EINVAL);
223
224 gpio = kzalloc(sizeof(*gpio), GFP_KERNEL);
225 if (!gpio)
226 return ERR_PTR(-ENOMEM);
227
228 gpio->parent = config->parent;
229 gpio->regmap = config->regmap;
230 gpio->ngpio_per_reg = config->ngpio_per_reg;
231 gpio->reg_stride = config->reg_stride;
232 gpio->reg_mask_xlate = config->reg_mask_xlate;
233 gpio->reg_dat_base = config->reg_dat_base;
234 gpio->reg_set_base = config->reg_set_base;
235 gpio->reg_clr_base = config->reg_clr_base;
236 gpio->reg_dir_in_base = config->reg_dir_in_base;
237 gpio->reg_dir_out_base = config->reg_dir_out_base;
238
239 /* if not set, assume there is only one register */
240 if (!gpio->ngpio_per_reg)
241 gpio->ngpio_per_reg = config->ngpio;
242
243 /* if not set, assume they are consecutive */
244 if (!gpio->reg_stride)
245 gpio->reg_stride = 1;
246
247 if (!gpio->reg_mask_xlate)
248 gpio->reg_mask_xlate = gpio_regmap_simple_xlate;
249
250 chip = &gpio->gpio_chip;
251 chip->parent = config->parent;
> 252 chip->of_node = config->of_node ?: dev_of_node(config->parent);
253 chip->base = -1;
254 chip->ngpio = config->ngpio;
255 chip->names = config->names;
256 chip->label = config->label ?: dev_name(config->parent);
257
258 /*
259 * If our regmap is fast_io we should probably set can_sleep to false.
260 * Right now, the regmap doesn't save this property, nor is there any
261 * access function for it.
262 * The only regmap type which uses fast_io is regmap-mmio. For now,
263 * assume a safe default of true here.
264 */
265 chip->can_sleep = true;
266
267 chip->get = gpio_regmap_get;
268 if (gpio->reg_set_base && gpio->reg_clr_base)
269 chip->set = gpio_regmap_set_with_clear;
270 else if (gpio->reg_set_base)
271 chip->set = gpio_regmap_set;
272
273 if (gpio->reg_dir_in_base || gpio->reg_dir_out_base) {
274 chip->get_direction = gpio_regmap_get_direction;
275 chip->direction_input = gpio_regmap_direction_input;
276 chip->direction_output = gpio_regmap_direction_output;
277 }
278
279 ret = gpiochip_add_data(chip, gpio);
280 if (ret < 0)
281 goto err_free_gpio;
282
283 if (config->irq_domain) {
284 ret = gpiochip_irqchip_add_domain(chip, config->irq_domain);
285 if (ret)
286 goto err_remove_gpiochip;
287 }
288
289 return gpio;
290
291 err_remove_gpiochip:
292 gpiochip_remove(chip);
293 err_free_gpio:
294 kfree(gpio);
295 return ERR_PTR(ret);
296 }
297 EXPORT_SYMBOL_GPL(gpio_regmap_register);
298

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip