From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: sparcspkr - Use platform_register/unregister_drivers()
Date: Wed, 2 Dec 2015 09:32:51 -0800 [thread overview]
Message-ID: <20151202173251.GB15531@dtor-ws> (raw)
In-Reply-To: <1449073519-11768-1-git-send-email-thierry.reding@gmail.com>
On Wed, Dec 02, 2015 at 05:25:19PM +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.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
Applied, thank you.
> ---
> drivers/input/misc/sparcspkr.c | 18 +++++++-----------
> 1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c
> index 6f997aa49183..4a5afc7fe96e 100644
> --- a/drivers/input/misc/sparcspkr.c
> +++ b/drivers/input/misc/sparcspkr.c
> @@ -345,23 +345,19 @@ static struct platform_driver grover_beep_driver = {
> .shutdown = sparcspkr_shutdown,
> };
>
> +static struct platform_driver * const drivers[] = {
> + &bbc_beep_driver,
> + &grover_beep_driver,
> +};
> +
> static int __init sparcspkr_init(void)
> {
> - int err = platform_driver_register(&bbc_beep_driver);
> -
> - if (!err) {
> - err = platform_driver_register(&grover_beep_driver);
> - if (err)
> - platform_driver_unregister(&bbc_beep_driver);
> - }
> -
> - return err;
> + return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
> }
>
> static void __exit sparcspkr_exit(void)
> {
> - platform_driver_unregister(&bbc_beep_driver);
> - platform_driver_unregister(&grover_beep_driver);
> + platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
> }
>
> module_init(sparcspkr_init);
> --
> 2.5.0
>
--
Dmitry
prev parent reply other threads:[~2015-12-02 17:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-02 16:25 [PATCH] Input: sparcspkr - Use platform_register/unregister_drivers() Thierry Reding
2015-12-02 17:32 ` Dmitry Torokhov [this message]
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=20151202173251.GB15531@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thierry.reding@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).