From: Thierry Reding Date: Wed, 2 Dec 2015 16:16:36 +0000 (+0100) Subject: crypto: n2 - Use platform_register/unregister_drivers() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a103a75ad978592cf71b6d42c05849aacc76c2da;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git crypto: n2 - 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 Acked-by: David S. Miller Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c index 5450880abb7b..739a786b9f08 100644 --- a/drivers/crypto/n2_core.c +++ b/drivers/crypto/n2_core.c @@ -2243,22 +2243,19 @@ static struct platform_driver n2_mau_driver = { .remove = n2_mau_remove, }; +static struct platform_driver * const drivers[] = { + &n2_crypto_driver, + &n2_mau_driver, +}; + static int __init n2_init(void) { - int err = platform_driver_register(&n2_crypto_driver); - - if (!err) { - err = platform_driver_register(&n2_mau_driver); - if (err) - platform_driver_unregister(&n2_crypto_driver); - } - return err; + return platform_register_drivers(drivers, ARRAY_SIZE(drivers)); } static void __exit n2_exit(void) { - platform_driver_unregister(&n2_mau_driver); - platform_driver_unregister(&n2_crypto_driver); + platform_unregister_drivers(drivers, ARRAY_SIZE(drivers)); } module_init(n2_init);