lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1449073272-11165-1-git-send-email-thierry.reding@gmail.com>
Date:	Wed,  2 Dec 2015 17:21:12 +0100
From:	Thierry Reding <thierry.reding@...il.com>
To:	Russell King <rmk+kernel@....linux.org.uk>
Cc:	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: [PATCH] drm/armada: Use platform_register/unregister_drivers()

From: Thierry Reding <treding@...dia.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@...dia.com>
---
 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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ