Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1281990 > unrolled thread
| Started by | Thierry Reding <thierry.reding@gmail.com> |
|---|---|
| First post | 2015-12-02 17:40 +0100 |
| Last post | 2015-12-03 21:20 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 3/4] net: mpc52xx: Use platform_register/unregister_drivers() Thierry Reding <thierry.reding@gmail.com> - 2015-12-02 17:40 +0100
Re: [PATCH 3/4] net: mpc52xx: Use platform_register/unregister_drivers() David Miller <davem@davemloft.net> - 2015-12-03 21:20 +0100
| From | Thierry Reding <thierry.reding@gmail.com> |
|---|---|
| Date | 2015-12-02 17:40 +0100 |
| Subject | [PATCH 3/4] net: mpc52xx: Use platform_register/unregister_drivers() |
| Message-ID | <qBiBI-1dB-5@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>
---
Applies on top of next-20151127.
drivers/net/ethernet/freescale/fec_mpc52xx.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c b/drivers/net/ethernet/freescale/fec_mpc52xx.c
index afe7f39cdd7c..25553ee857b4 100644
--- a/drivers/net/ethernet/freescale/fec_mpc52xx.c
+++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c
@@ -1084,27 +1084,23 @@ static struct platform_driver mpc52xx_fec_driver = {
/* Module */
/* ======================================================================== */
+static struct platform_driver * const drivers[] = {
+#ifdef CONFIG_FEC_MPC52xx_MDIO
+ &mpc52xx_fec_mdio_driver,
+#endif
+ &mpc52xx_fec_driver,
+};
+
static int __init
mpc52xx_fec_init(void)
{
-#ifdef CONFIG_FEC_MPC52xx_MDIO
- int ret;
- ret = platform_driver_register(&mpc52xx_fec_mdio_driver);
- if (ret) {
- pr_err("failed to register mdio driver\n");
- return ret;
- }
-#endif
- return platform_driver_register(&mpc52xx_fec_driver);
+ return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
}
static void __exit
mpc52xx_fec_exit(void)
{
- platform_driver_unregister(&mpc52xx_fec_driver);
-#ifdef CONFIG_FEC_MPC52xx_MDIO
- platform_driver_unregister(&mpc52xx_fec_mdio_driver);
-#endif
+ platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
}
--
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]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2015-12-03 21:20 +0100 |
| Subject | Re: [PATCH 3/4] net: mpc52xx: Use platform_register/unregister_drivers() |
| Message-ID | <qBIwa-1o5-11@gated-at.bofh.it> |
| In reply to | #1281990 |
From: Thierry Reding <thierry.reding@gmail.com> Date: Wed, 2 Dec 2015 17:30:28 +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> Applied. -- 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