summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2015-12-02 17:16:36 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2015-12-04 22:29:57 +0800
commita103a75ad978592cf71b6d42c05849aacc76c2da (patch)
tree3f54c1e99d17120f00a72564224e980ba5391c65
parent5e75ae1b3cef6455b131835621216cb92060da34 (diff)
downloadop-kernel-dev-a103a75ad978592cf71b6d42c05849aacc76c2da.zip
op-kernel-dev-a103a75ad978592cf71b6d42c05849aacc76c2da.tar.gz
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 <treding@nvidia.com> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/crypto/n2_core.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c
index 5450880..739a786 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);
OpenPOWER on IntegriCloud