From: Thierry Reding <thierry.reding@gmail.com> To: Thierry Reding <thierry.reding@gmail.com> Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] gpu: host1x: Use platform_register/unregister_drivers() Date: Wed, 2 Dec 2015 17:24:20 +0100 [thread overview] Message-ID: <1449073460-11652-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/host1x/dev.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c index 53d3d1d45b48..64d9b707ee1a 100644 --- a/drivers/gpu/host1x/dev.c +++ b/drivers/gpu/host1x/dev.c @@ -212,6 +212,11 @@ static struct platform_driver tegra_host1x_driver = { .remove = host1x_remove, }; +static struct platform_driver * const drivers[] = { + &tegra_host1x_driver, + &tegra_mipi_driver, +}; + static int __init tegra_host1x_init(void) { int err; @@ -220,28 +225,17 @@ static int __init tegra_host1x_init(void) if (err < 0) return err; - err = platform_driver_register(&tegra_host1x_driver); - if (err < 0) - goto unregister_bus; - - err = platform_driver_register(&tegra_mipi_driver); + err = platform_register_drivers(drivers, ARRAY_SIZE(drivers)); if (err < 0) - goto unregister_host1x; + bus_unregister(&host1x_bus_type); - return 0; - -unregister_host1x: - platform_driver_unregister(&tegra_host1x_driver); -unregister_bus: - bus_unregister(&host1x_bus_type); return err; } module_init(tegra_host1x_init); static void __exit tegra_host1x_exit(void) { - platform_driver_unregister(&tegra_mipi_driver); - platform_driver_unregister(&tegra_host1x_driver); + platform_unregister_drivers(drivers, ARRAY_SIZE(drivers)); bus_unregister(&host1x_bus_type); } module_exit(tegra_host1x_exit); -- 2.5.0
WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com> To: Thierry Reding <thierry.reding@gmail.com> Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH] gpu: host1x: Use platform_register/unregister_drivers() Date: Wed, 2 Dec 2015 17:24:20 +0100 [thread overview] Message-ID: <1449073460-11652-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/host1x/dev.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c index 53d3d1d45b48..64d9b707ee1a 100644 --- a/drivers/gpu/host1x/dev.c +++ b/drivers/gpu/host1x/dev.c @@ -212,6 +212,11 @@ static struct platform_driver tegra_host1x_driver = { .remove = host1x_remove, }; +static struct platform_driver * const drivers[] = { + &tegra_host1x_driver, + &tegra_mipi_driver, +}; + static int __init tegra_host1x_init(void) { int err; @@ -220,28 +225,17 @@ static int __init tegra_host1x_init(void) if (err < 0) return err; - err = platform_driver_register(&tegra_host1x_driver); - if (err < 0) - goto unregister_bus; - - err = platform_driver_register(&tegra_mipi_driver); + err = platform_register_drivers(drivers, ARRAY_SIZE(drivers)); if (err < 0) - goto unregister_host1x; + bus_unregister(&host1x_bus_type); - return 0; - -unregister_host1x: - platform_driver_unregister(&tegra_host1x_driver); -unregister_bus: - bus_unregister(&host1x_bus_type); return err; } module_init(tegra_host1x_init); static void __exit tegra_host1x_exit(void) { - platform_driver_unregister(&tegra_mipi_driver); - platform_driver_unregister(&tegra_host1x_driver); + platform_unregister_drivers(drivers, ARRAY_SIZE(drivers)); bus_unregister(&host1x_bus_type); } module_exit(tegra_host1x_exit); -- 2.5.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2015-12-02 16:24 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-12-02 16:24 Thierry Reding [this message] 2015-12-02 16:24 ` [PATCH] gpu: host1x: Use platform_register/unregister_drivers() Thierry Reding 2015-12-02 16:37 ` Thierry Reding 2015-12-02 16:37 ` Thierry Reding
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=1449073460-11652-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 \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.