* [PATCH] crypto: n2 - Use platform_register/unregister_drivers()
@ 2015-12-02 16:16 Thierry Reding
2015-12-02 22:19 ` David Miller
2015-12-04 14:42 ` Herbert Xu
0 siblings, 2 replies; 3+ messages in thread
From: Thierry Reding @ 2015-12-02 16:16 UTC (permalink / raw)
To: Herbert Xu; +Cc: David S. Miller, linux-crypto, linux-kernel
From: Thierry Reding <treding@nvidia.com>
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>
---
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[] = {
+ &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);
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: n2 - Use platform_register/unregister_drivers()
2015-12-02 16:16 [PATCH] crypto: n2 - Use platform_register/unregister_drivers() Thierry Reding
@ 2015-12-02 22:19 ` David Miller
2015-12-04 14:42 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-12-02 22:19 UTC (permalink / raw)
To: thierry.reding; +Cc: herbert, linux-crypto, linux-kernel
From: Thierry Reding <thierry.reding@gmail.com>
Date: Wed, 2 Dec 2015 17:16:36 +0100
> From: Thierry Reding <treding@nvidia.com>
>
> 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: n2 - Use platform_register/unregister_drivers()
2015-12-02 16:16 [PATCH] crypto: n2 - Use platform_register/unregister_drivers() Thierry Reding
2015-12-02 22:19 ` David Miller
@ 2015-12-04 14:42 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2015-12-04 14:42 UTC (permalink / raw)
To: Thierry Reding; +Cc: David S. Miller, linux-crypto, linux-kernel
On Wed, Dec 02, 2015 at 05:16:36PM +0100, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> 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>
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-12-04 14:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-02 16:16 [PATCH] crypto: n2 - Use platform_register/unregister_drivers() Thierry Reding
2015-12-02 22:19 ` David Miller
2015-12-04 14:42 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).