Commit d91d76d8 authored by Thierry Reding's avatar Thierry Reding Committed by Lee Jones

mfd: sta2x11: Use platform_register/unregister_drivers()

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: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 742dcd11
...@@ -372,12 +372,6 @@ static struct platform_driver sta2x11_sctl_platform_driver = { ...@@ -372,12 +372,6 @@ static struct platform_driver sta2x11_sctl_platform_driver = {
.probe = sta2x11_sctl_probe, .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 = { static struct platform_driver sta2x11_platform_driver = {
.driver = { .driver = {
.name = STA2X11_MFD_APBREG_NAME, .name = STA2X11_MFD_APBREG_NAME,
...@@ -385,12 +379,6 @@ static struct platform_driver sta2x11_platform_driver = { ...@@ -385,12 +379,6 @@ static struct platform_driver sta2x11_platform_driver = {
.probe = sta2x11_apbreg_probe, .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 = { static struct platform_driver sta2x11_apb_soc_regs_platform_driver = {
.driver = { .driver = {
.name = STA2X11_MFD_APB_SOC_REGS_NAME, .name = STA2X11_MFD_APB_SOC_REGS_NAME,
...@@ -398,12 +386,6 @@ static struct platform_driver sta2x11_apb_soc_regs_platform_driver = { ...@@ -398,12 +386,6 @@ static struct platform_driver sta2x11_apb_soc_regs_platform_driver = {
.probe = sta2x11_apb_soc_regs_probe, .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 = { static struct platform_driver sta2x11_scr_platform_driver = {
.driver = { .driver = {
.name = STA2X11_MFD_SCR_NAME, .name = STA2X11_MFD_SCR_NAME,
...@@ -411,13 +393,18 @@ static struct platform_driver sta2x11_scr_platform_driver = { ...@@ -411,13 +393,18 @@ static struct platform_driver sta2x11_scr_platform_driver = {
.probe = sta2x11_scr_probe, .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_register_drivers(drivers, ARRAY_SIZE(drivers));
return platform_driver_register(&sta2x11_scr_platform_driver);
} }
/* /*
* What follows are the PCI devices that host the above pdevs. * 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. * 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) ...@@ -664,10 +651,7 @@ static int __init sta2x11_mfd_init(void)
* prepares platform drivers very early and probe the PCI device later, * prepares platform drivers very early and probe the PCI device later,
* but before other PCI devices. * but before other PCI devices.
*/ */
subsys_initcall(sta2x11_apbreg_init); subsys_initcall(sta2x11_drivers_init);
subsys_initcall(sta2x11_sctl_init);
subsys_initcall(sta2x11_apb_soc_regs_init);
subsys_initcall(sta2x11_scr_init);
rootfs_initcall(sta2x11_mfd_init); rootfs_initcall(sta2x11_mfd_init);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment