Commit 20d7090f authored by Thierry Reding's avatar Thierry Reding Committed by Linus Walleij

gpio: mpc5200: 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 12b61c9d
...@@ -360,15 +360,14 @@ static struct platform_driver mpc52xx_simple_gpiochip_driver = { ...@@ -360,15 +360,14 @@ static struct platform_driver mpc52xx_simple_gpiochip_driver = {
.remove = mpc52xx_gpiochip_remove, .remove = mpc52xx_gpiochip_remove,
}; };
static struct platform_driver * const drivers[] = {
&mpc52xx_wkup_gpiochip_driver,
&mpc52xx_simple_gpiochip_driver,
};
static int __init mpc52xx_gpio_init(void) static int __init mpc52xx_gpio_init(void)
{ {
if (platform_driver_register(&mpc52xx_wkup_gpiochip_driver)) return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
printk(KERN_ERR "Unable to register wakeup GPIO driver\n");
if (platform_driver_register(&mpc52xx_simple_gpiochip_driver))
printk(KERN_ERR "Unable to register simple GPIO driver\n");
return 0;
} }
/* Make sure we get initialised before anyone else tries to use us */ /* Make sure we get initialised before anyone else tries to use us */
...@@ -376,9 +375,7 @@ subsys_initcall(mpc52xx_gpio_init); ...@@ -376,9 +375,7 @@ subsys_initcall(mpc52xx_gpio_init);
static void __exit mpc52xx_gpio_exit(void) static void __exit mpc52xx_gpio_exit(void)
{ {
platform_driver_unregister(&mpc52xx_wkup_gpiochip_driver); platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
platform_driver_unregister(&mpc52xx_simple_gpiochip_driver);
} }
module_exit(mpc52xx_gpio_exit); module_exit(mpc52xx_gpio_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