From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] leds: sunfire: Use platform_register/unregister_drivers()
Date: Thu, 03 Dec 2015 11:43:41 +0100 [thread overview]
Message-ID: <56601CDD.70806@samsung.com> (raw)
In-Reply-To: <1449073621-12049-1-git-send-email-thierry.reding@gmail.com>
On 12/02/2015 05:27 PM, 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>
> ---
> drivers/leds/leds-sunfire.c | 23 +++++++----------------
> 1 file changed, 7 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/leds/leds-sunfire.c b/drivers/leds/leds-sunfire.c
> index c2553c54f2cf..7c09db8bd4e8 100644
> --- a/drivers/leds/leds-sunfire.c
> +++ b/drivers/leds/leds-sunfire.c
> @@ -234,28 +234,19 @@ static struct platform_driver sunfire_fhc_led_driver = {
> },
> };
>
> +static struct platform_driver * const drivers[] = {
> + &sunfire_clockboard_led_driver,
> + &sunfire_fhc_led_driver,
> +};
> +
> static int __init sunfire_leds_init(void)
> {
> - int err = platform_driver_register(&sunfire_clockboard_led_driver);
> -
> - if (err) {
> - pr_err("Could not register clock board LED driver\n");
> - return err;
> - }
> -
> - err = platform_driver_register(&sunfire_fhc_led_driver);
> - if (err) {
> - pr_err("Could not register FHC LED driver\n");
> - platform_driver_unregister(&sunfire_clockboard_led_driver);
> - }
> -
> - return err;
> + return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
> }
>
> static void __exit sunfire_leds_exit(void)
> {
> - platform_driver_unregister(&sunfire_clockboard_led_driver);
> - platform_driver_unregister(&sunfire_fhc_led_driver);
> + platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
> }
>
> module_init(sunfire_leds_init);
>
Applied, thanks.
--
Best Regards,
Jacek Anaszewski
prev parent reply other threads:[~2015-12-03 10:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-02 16:27 [PATCH] leds: sunfire: Use platform_register/unregister_drivers() Thierry Reding
2015-12-03 10:43 ` Jacek Anaszewski [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=56601CDD.70806@samsung.com \
--to=j.anaszewski@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@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 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.