Commit e7479a19 authored by Thierry Reding's avatar Thierry Reding Committed by Joerg Roedel

iommu/msm: 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 avatarJoerg Roedel <jroedel@suse.de>
parent 9f9499ae
...@@ -359,30 +359,19 @@ static struct platform_driver msm_iommu_ctx_driver = { ...@@ -359,30 +359,19 @@ static struct platform_driver msm_iommu_ctx_driver = {
.remove = msm_iommu_ctx_remove, .remove = msm_iommu_ctx_remove,
}; };
static struct platform_driver * const drivers[] = {
&msm_iommu_driver,
&msm_iommu_ctx_driver,
};
static int __init msm_iommu_driver_init(void) static int __init msm_iommu_driver_init(void)
{ {
int ret; return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
ret = platform_driver_register(&msm_iommu_driver);
if (ret != 0) {
pr_err("Failed to register IOMMU driver\n");
goto error;
}
ret = platform_driver_register(&msm_iommu_ctx_driver);
if (ret != 0) {
platform_driver_unregister(&msm_iommu_driver);
pr_err("Failed to register IOMMU context driver\n");
goto error;
}
error:
return ret;
} }
static void __exit msm_iommu_driver_exit(void) static void __exit msm_iommu_driver_exit(void)
{ {
platform_driver_unregister(&msm_iommu_ctx_driver); platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
platform_driver_unregister(&msm_iommu_driver);
} }
subsys_initcall(msm_iommu_driver_init); subsys_initcall(msm_iommu_driver_init);
......
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