[PATCH] drm/armada: Use platform_register/unregister_drivers()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Thierry Reding <treding@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 drivers/gpu/drm/armada/armada_drv.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
index 77ab93d60125..e7e50fccc174 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -333,26 +333,22 @@ static struct platform_driver armada_drm_platform_driver = {
 	.id_table = armada_drm_platform_ids,
 };
 
+static struct platform_driver * const drivers[] = {
+	&armada_lcd_platform_driver,
+	&armada_drm_platform_driver,
+};
+
 static int __init armada_drm_init(void)
 {
-	int ret;
-
 	armada_drm_driver.num_ioctls = ARRAY_SIZE(armada_ioctls);
 
-	ret = platform_driver_register(&armada_lcd_platform_driver);
-	if (ret)
-		return ret;
-	ret = platform_driver_register(&armada_drm_platform_driver);
-	if (ret)
-		platform_driver_unregister(&armada_lcd_platform_driver);
-	return ret;
+	return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
 }
 module_init(armada_drm_init);
 
 static void __exit armada_drm_exit(void)
 {
-	platform_driver_unregister(&armada_drm_platform_driver);
-	platform_driver_unregister(&armada_lcd_platform_driver);
+	platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
 }
 module_exit(armada_drm_exit);
 
-- 
2.5.0

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux