From: Thierry Reding <thierry.reding@gmail.com>
To: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH] drm/armada: Use platform_register/unregister_drivers()
Date: Wed, 2 Dec 2015 17:21:12 +0100 [thread overview]
Message-ID: <1449073272-11165-1-git-send-email-thierry.reding@gmail.com> (raw)
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/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
reply other threads:[~2015-12-02 16:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1449073272-11165-1-git-send-email-thierry.reding@gmail.com \
--to=thierry.reding@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+kernel@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®