Re: [PATCH] crypto: n2 - Use platform_register/unregister_drivers()

2015-12-04 Thread Herbert Xu
On Wed, Dec 02, 2015 at 05:16:36PM +0100, Thierry Reding wrote:
> From: Thierry Reding 
> 
> 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 

Patch applied.  Thanks.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] crypto: n2 - Use platform_register/unregister_drivers()

2015-12-02 Thread Thierry Reding
From: Thierry Reding 

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 
---
 drivers/crypto/n2_core.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

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[] = {
+   _crypto_driver,
+   _mau_driver,
+};
+
 static int __init n2_init(void)
 {
-   int err = platform_driver_register(_crypto_driver);
-
-   if (!err) {
-   err = platform_driver_register(_mau_driver);
-   if (err)
-   platform_driver_unregister(_crypto_driver);
-   }
-   return err;
+   return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
 }
 
 static void __exit n2_exit(void)
 {
-   platform_driver_unregister(_mau_driver);
-   platform_driver_unregister(_crypto_driver);
+   platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
 }
 
 module_init(n2_init);
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] crypto: n2 - Use platform_register/unregister_drivers()

2015-12-02 Thread David Miller
From: Thierry Reding 
Date: Wed,  2 Dec 2015 17:16:36 +0100

> From: Thierry Reding 
> 
> 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 
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html