Re: [PATCH v3 02/10] pinctrl: core: add devm_pinctrl_register_mappings()

Andy Shevchenko
2025-04-17T16:13:58Z

On Wed, Apr 16, 2025 at 04:08:10PM +0200, Thomas Richard wrote:
> Using devm_pinctrl_register_mappings(), the core can automatically
> unregister pinctrl mappings.

...

> +int devm_pinctrl_register_mappings(struct device *dev,
> + const struct pinctrl_map *maps,
> + unsigned int num_maps)
> +{
> + const struct pinctrl_map **ptr;
> + int ret;
> +
> + ptr = devres_alloc(devm_pinctrl_unregister_mappings, sizeof(*ptr),
> + GFP_KERNEL);
> + if (!ptr)
> + return -ENOMEM;
> +
> + ret = pinctrl_register_mappings(maps, num_maps);
> + if (!ret) {
> + *ptr = maps;
> + devres_add(dev, ptr);
> + } else {
> + devres_free(ptr);
> + }
> +
> + return ret;

Why not devm_add_action_or_reset()?

> +}

...

> extern int pinctrl_register_mappings(const struct pinctrl_map *map,
> unsigned int num_maps);
> +extern int devm_pinctrl_register_mappings(struct device *dev,
> + const struct pinctrl_map *map,
> + unsigned int num_maps);

No extern, please. Perhaps a clean up patch to remove existing ones?

> extern void pinctrl_unregister_mappings(const struct pinctrl_map *map);
> extern void pinctrl_provide_dummies(void);

...

Test robot wants you to add a forward declaration

struct device;

--
With Best Regards,
Andy Shevchenko