summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-mpc5200.c
diff options
context:
space:
mode:
authorThierry Reding2015-12-02 17:19:55 +0100
committerLinus Walleij2015-12-10 19:28:05 +0100
commit20d7090ffd4a30c66f3e2eb6741bb1e5baa56e8b (patch)
treea1e8dd34bf809bb8a329908a6edd7fd61f108c1d /drivers/gpio/gpio-mpc5200.c
parentgpio: 104-idio-16: Clear pending interrupt in IRQ handler (diff)
downloadkernel-qcow2-linux-20d7090ffd4a30c66f3e2eb6741bb1e5baa56e8b.tar.gz
kernel-qcow2-linux-20d7090ffd4a30c66f3e2eb6741bb1e5baa56e8b.tar.xz
kernel-qcow2-linux-20d7090ffd4a30c66f3e2eb6741bb1e5baa56e8b.zip
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: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-mpc5200.c')
-rw-r--r--drivers/gpio/gpio-mpc5200.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/gpio/gpio-mpc5200.c b/drivers/gpio/gpio-mpc5200.c
index 4c542153e923..044bbbb747f2 100644
--- a/drivers/gpio/gpio-mpc5200.c
+++ b/drivers/gpio/gpio-mpc5200.c
@@ -360,15 +360,14 @@ static struct platform_driver mpc52xx_simple_gpiochip_driver = {
.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)
{
- if (platform_driver_register(&mpc52xx_wkup_gpiochip_driver))
- 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;
+ return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
}
/* Make sure we get initialised before anyone else tries to use us */
@@ -376,9 +375,7 @@ subsys_initcall(mpc52xx_gpio_init);
static void __exit mpc52xx_gpio_exit(void)
{
- platform_driver_unregister(&mpc52xx_wkup_gpiochip_driver);
-
- platform_driver_unregister(&mpc52xx_simple_gpiochip_driver);
+ platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
}
module_exit(mpc52xx_gpio_exit);