From: Lee Jones <lee.jones@linaro.org>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mfd: sta2x11: Use platform_register/unregister_drivers()
Date: Mon, 11 Jan 2016 06:10:08 +0000 [thread overview]
Message-ID: <20160111061008.GN3331@x1> (raw)
In-Reply-To: <1449073691-12238-1-git-send-email-thierry.reding@gmail.com>
On Wed, 02 Dec 2015, 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/mfd/sta2x11-mfd.c | 36 ++++++++++--------------------------
> 1 file changed, 10 insertions(+), 26 deletions(-)
Looks nice. Applied, thanks.
> diff --git a/drivers/mfd/sta2x11-mfd.c b/drivers/mfd/sta2x11-mfd.c
> index b3e5c6f45105..9292202039ee 100644
> --- a/drivers/mfd/sta2x11-mfd.c
> +++ b/drivers/mfd/sta2x11-mfd.c
> @@ -372,12 +372,6 @@ static struct platform_driver sta2x11_sctl_platform_driver = {
> .probe = sta2x11_sctl_probe,
> };
>
> -static int __init sta2x11_sctl_init(void)
> -{
> - pr_info("%s\n", __func__);
> - return platform_driver_register(&sta2x11_sctl_platform_driver);
> -}
> -
> static struct platform_driver sta2x11_platform_driver = {
> .driver = {
> .name = STA2X11_MFD_APBREG_NAME,
> @@ -385,12 +379,6 @@ static struct platform_driver sta2x11_platform_driver = {
> .probe = sta2x11_apbreg_probe,
> };
>
> -static int __init sta2x11_apbreg_init(void)
> -{
> - pr_info("%s\n", __func__);
> - return platform_driver_register(&sta2x11_platform_driver);
> -}
> -
> static struct platform_driver sta2x11_apb_soc_regs_platform_driver = {
> .driver = {
> .name = STA2X11_MFD_APB_SOC_REGS_NAME,
> @@ -398,12 +386,6 @@ static struct platform_driver sta2x11_apb_soc_regs_platform_driver = {
> .probe = sta2x11_apb_soc_regs_probe,
> };
>
> -static int __init sta2x11_apb_soc_regs_init(void)
> -{
> - pr_info("%s\n", __func__);
> - return platform_driver_register(&sta2x11_apb_soc_regs_platform_driver);
> -}
> -
> static struct platform_driver sta2x11_scr_platform_driver = {
> .driver = {
> .name = STA2X11_MFD_SCR_NAME,
> @@ -411,13 +393,18 @@ static struct platform_driver sta2x11_scr_platform_driver = {
> .probe = sta2x11_scr_probe,
> };
>
> -static int __init sta2x11_scr_init(void)
> +static struct platform_driver * const drivers[] = {
> + &sta2x11_platform_driver,
> + &sta2x11_sctl_platform_driver,
> + &sta2x11_apb_soc_regs_platform_driver,
> + &sta2x11_scr_platform_driver,
> +};
> +
> +static int __init sta2x11_drivers_init(void)
> {
> - pr_info("%s\n", __func__);
> - return platform_driver_register(&sta2x11_scr_platform_driver);
> + return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
> }
>
> -
> /*
> * What follows are the PCI devices that host the above pdevs.
> * Each logic block is 4kB and they are all consecutive: we use this info.
> @@ -664,10 +651,7 @@ static int __init sta2x11_mfd_init(void)
> * prepares platform drivers very early and probe the PCI device later,
> * but before other PCI devices.
> */
> -subsys_initcall(sta2x11_apbreg_init);
> -subsys_initcall(sta2x11_sctl_init);
> -subsys_initcall(sta2x11_apb_soc_regs_init);
> -subsys_initcall(sta2x11_scr_init);
> +subsys_initcall(sta2x11_drivers_init);
> rootfs_initcall(sta2x11_mfd_init);
>
> MODULE_LICENSE("GPL v2");
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
prev parent reply other threads:[~2016-01-11 6:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-02 16:28 [PATCH] mfd: sta2x11: Use platform_register/unregister_drivers() Thierry Reding
2016-01-11 6:10 ` Lee Jones [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=20160111061008.GN3331@x1 \
--to=lee.jones@linaro.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 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.