Commit 9b0ee474 authored by Thierry Reding's avatar Thierry Reding Committed by Linus Walleij

pinctrl: adi2: Use platform_register/unregister_drivers()

These new helpers simplify implementing multi-driver modules and
properly handle failure to register one driver by unregistering all
previously registered drivers.
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 58804768
...@@ -1102,32 +1102,24 @@ static struct platform_driver adi_gpio_driver = { ...@@ -1102,32 +1102,24 @@ static struct platform_driver adi_gpio_driver = {
}, },
}; };
static struct platform_driver * const drivers[] = {
&adi_pinctrl_driver,
&adi_gpio_pint_driver,
&adi_gpio_driver,
};
static int __init adi_pinctrl_setup(void) static int __init adi_pinctrl_setup(void)
{ {
int ret; int ret;
ret = platform_driver_register(&adi_pinctrl_driver); ret = platform_register_drivers(drivers, ARRAY_SIZE(drivers));
if (ret) if (ret)
return ret; return ret;
ret = platform_driver_register(&adi_gpio_pint_driver);
if (ret)
goto pint_error;
ret = platform_driver_register(&adi_gpio_driver);
if (ret)
goto gpio_error;
#ifdef CONFIG_PM #ifdef CONFIG_PM
register_syscore_ops(&gpio_pm_syscore_ops); register_syscore_ops(&gpio_pm_syscore_ops);
#endif #endif
return ret; return 0;
gpio_error:
platform_driver_unregister(&adi_gpio_pint_driver);
pint_error:
platform_driver_unregister(&adi_pinctrl_driver);
return ret;
} }
arch_initcall(adi_pinctrl_setup); arch_initcall(adi_pinctrl_setup);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment