Commit bab7f5a4 authored by Thierry Reding's avatar Thierry Reding Committed by Linus Walleij

pinctrl: at91: 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 9b0ee474
...@@ -1828,20 +1828,20 @@ static struct platform_driver at91_pinctrl_driver = { ...@@ -1828,20 +1828,20 @@ static struct platform_driver at91_pinctrl_driver = {
.remove = at91_pinctrl_remove, .remove = at91_pinctrl_remove,
}; };
static struct platform_driver * const drivers[] = {
&at91_gpio_driver,
&at91_pinctrl_driver,
};
static int __init at91_pinctrl_init(void) static int __init at91_pinctrl_init(void)
{ {
int ret; return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
ret = platform_driver_register(&at91_gpio_driver);
if (ret)
return ret;
return platform_driver_register(&at91_pinctrl_driver);
} }
arch_initcall(at91_pinctrl_init); arch_initcall(at91_pinctrl_init);
static void __exit at91_pinctrl_exit(void) static void __exit at91_pinctrl_exit(void)
{ {
platform_driver_unregister(&at91_pinctrl_driver); platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
} }
module_exit(at91_pinctrl_exit); module_exit(at91_pinctrl_exit);
......
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