mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-07 03:18:31 +00:00
EDAC, mpc85xx: 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. Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Thierry Reding <treding@nvidia.com> Cc: linux-edac <linux-edac@vger.kernel.org> Link: http://lkml.kernel.org/r/1449136632-11680-1-git-send-email-thierry.reding@gmail.com Signed-off-by: Borislav Petkov <bp@suse.de>
This commit is contained in:
parent
255379ae9a
commit
d54051f1cc
1 changed files with 8 additions and 8 deletions
|
@ -1208,6 +1208,11 @@ static void __init mpc85xx_mc_clear_rfxe(void *data)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static struct platform_driver * const drivers[] = {
|
||||||
|
&mpc85xx_mc_err_driver,
|
||||||
|
&mpc85xx_l2_err_driver,
|
||||||
|
};
|
||||||
|
|
||||||
static int __init mpc85xx_mc_init(void)
|
static int __init mpc85xx_mc_init(void)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
@ -1226,13 +1231,9 @@ static int __init mpc85xx_mc_init(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = platform_driver_register(&mpc85xx_mc_err_driver);
|
res = platform_register_drivers(drivers, ARRAY_SIZE(drivers));
|
||||||
if (res)
|
if (res)
|
||||||
printk(KERN_WARNING EDAC_MOD_STR "MC fails to register\n");
|
printk(KERN_WARNING EDAC_MOD_STR "drivers fail to register\n");
|
||||||
|
|
||||||
res = platform_driver_register(&mpc85xx_l2_err_driver);
|
|
||||||
if (res)
|
|
||||||
printk(KERN_WARNING EDAC_MOD_STR "L2 fails to register\n");
|
|
||||||
|
|
||||||
#ifdef CONFIG_FSL_SOC_BOOKE
|
#ifdef CONFIG_FSL_SOC_BOOKE
|
||||||
pvr = mfspr(SPRN_PVR);
|
pvr = mfspr(SPRN_PVR);
|
||||||
|
@ -1270,8 +1271,7 @@ static void __exit mpc85xx_mc_exit(void)
|
||||||
on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0);
|
on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
platform_driver_unregister(&mpc85xx_l2_err_driver);
|
platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
|
||||||
platform_driver_unregister(&mpc85xx_mc_err_driver);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module_exit(mpc85xx_mc_exit);
|
module_exit(mpc85xx_mc_exit);
|
||||||
|
|
Loading…
Reference in a new issue