Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1281962 > unrolled thread

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

Started byThierry Reding <thierry.reding@gmail.com>
First post2015-12-02 17:20 +0100
Last post2015-12-04 15:50 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] crypto: n2 - Use platform_register/unregister_drivers() Thierry Reding <thierry.reding@gmail.com> - 2015-12-02 17:20 +0100
    Re: [PATCH] crypto: n2 - Use platform_register/unregister_drivers() David Miller <davem@davemloft.net> - 2015-12-02 23:20 +0100
    Re: [PATCH] crypto: n2 - Use platform_register/unregister_drivers() Herbert Xu <herbert@gondor.apana.org.au> - 2015-12-04 15:50 +0100

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

FromThierry Reding <thierry.reding@gmail.com>
Date2015-12-02 17:20 +0100
Subject[PATCH] crypto: n2 - Use platform_register/unregister_drivers()
Message-ID<qBiin-161-27@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1282465

FromDavid Miller <davem@davemloft.net>
Date2015-12-02 23:20 +0100
Message-ID<qBnUK-4LF-7@gated-at.bofh.it>
In reply to#1281962
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>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1283875

FromHerbert Xu <herbert@gondor.apana.org.au>
Date2015-12-04 15:50 +0100
Message-ID<qBZQm-3Yo-3@gated-at.bofh.it>
In reply to#1281962
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web