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


Groups > linux.kernel > #1282895 > unrolled thread

[PATCH v2] edac: mpc85xx: Use platform_register/unregister_drivers()

Started byThierry Reding <thierry.reding@gmail.com>
First post2015-12-03 11:10 +0100
Last post2015-12-03 12:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] edac: mpc85xx: Use platform_register/unregister_drivers() Thierry Reding <thierry.reding@gmail.com> - 2015-12-03 11:10 +0100
    Re: [PATCH v2] edac: mpc85xx: Use  platform_register/unregister_drivers() Borislav Petkov <bp@alien8.de> - 2015-12-03 12:10 +0100

#1282895 — [PATCH v2] edac: mpc85xx: Use platform_register/unregister_drivers()

FromThierry Reding <thierry.reding@gmail.com>
Date2015-12-03 11:10 +0100
Subject[PATCH v2] edac: mpc85xx: Use platform_register/unregister_drivers()
Message-ID<qByZP-3zg-13@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.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v2:
- fixup commit subject and add Reviewed-by (Johannes Thumshirn)

Note sure this was clear from the submission, but the patches that add the
platform_register/unregister_drivers() functions were merged in v4.4-rc1,
so maintainers are free to apply these patches to their trees.

 drivers/edac/mpc85xx_edac.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index 23ef8e9f2c9a..3eab06351089 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -1208,6 +1208,11 @@ static void __init mpc85xx_mc_clear_rfxe(void *data)
 }
 #endif
 
+static struct platform_driver * const drivers[] = {
+	&mpc85xx_mc_err_driver,
+	&mpc85xx_l2_err_driver,
+};
+
 static int __init mpc85xx_mc_init(void)
 {
 	int res = 0;
@@ -1226,13 +1231,9 @@ static int __init mpc85xx_mc_init(void)
 		break;
 	}
 
-	res = platform_driver_register(&mpc85xx_mc_err_driver);
-	if (res)
-		printk(KERN_WARNING EDAC_MOD_STR "MC fails to register\n");
-
-	res = platform_driver_register(&mpc85xx_l2_err_driver);
+	res = platform_register_drivers(drivers, ARRAY_SIZE(drivers));
 	if (res)
-		printk(KERN_WARNING EDAC_MOD_STR "L2 fails to register\n");
+		printk(KERN_WARNING EDAC_MOD_STR "drivers fail to register\n");
 
 #ifdef CONFIG_FSL_SOC_BOOKE
 	pvr = mfspr(SPRN_PVR);
@@ -1270,8 +1271,7 @@ static void __exit mpc85xx_mc_exit(void)
 		on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0);
 	}
 #endif
-	platform_driver_unregister(&mpc85xx_l2_err_driver);
-	platform_driver_unregister(&mpc85xx_mc_err_driver);
+	platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
 }
 
 module_exit(mpc85xx_mc_exit);
-- 
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]


#1282941 — Re: [PATCH v2] edac: mpc85xx: Use platform_register/unregister_drivers()

FromBorislav Petkov <bp@alien8.de>
Date2015-12-03 12:10 +0100
SubjectRe: [PATCH v2] edac: mpc85xx: Use platform_register/unregister_drivers()
Message-ID<qBzVT-4ak-9@gated-at.bofh.it>
In reply to#1282895
On Thu, Dec 03, 2015 at 10:57:12AM +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.
> 
> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
> Signed-off-by: Thierry Reding <treding@nvidia.com>

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
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