[PATCH] iommu: Switch back to struct platform_driver::remove()

Uwe Kleine-König posted 1 patch 2 weeks, 6 days ago
drivers/iommu/apple-dart.c                  | 2 +-
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +-
drivers/iommu/arm/arm-smmu/arm-smmu.c       | 2 +-
drivers/iommu/arm/arm-smmu/qcom_iommu.c     | 4 ++--
drivers/iommu/ipmmu-vmsa.c                  | 2 +-
drivers/iommu/msm_iommu.c                   | 2 +-
drivers/iommu/mtk_iommu.c                   | 2 +-
drivers/iommu/mtk_iommu_v1.c                | 2 +-
drivers/iommu/omap-iommu.c                  | 2 +-
drivers/iommu/riscv/iommu-platform.c        | 2 +-
drivers/iommu/sprd-iommu.c                  | 2 +-
11 files changed, 12 insertions(+), 12 deletions(-)
[PATCH] iommu: Switch back to struct platform_driver::remove()
Posted by Uwe Kleine-König 2 weeks, 6 days ago
After commit 0edb555a65d1 ("platform: Make platform_driver::remove()
return void") .remove() is (again) the right callback to implement for
platform drivers.

Convert all platform drivers below drivers/iommu to use .remove(), with
the eventual goal to drop struct platform_driver::remove_new(). As
.remove() and .remove_new() have the same prototypes, conversion is done
by just changing the structure member name in the driver initializer.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
Hello,

I did a single patch for all of drivers/iommu. While I usually prefer to
do one logical change per patch, this seems to be overengineering here
as the individual changes are really trivial and shouldn't be much in
the way for stable backports. But I'll happily split the patch if you
prefer it split.

This is based on today's next, if conflicts arise when you apply it at
some later time and don't want to resolve them, feel free to just drop
the changes to the conflicting files. I'll notice and followup at a
later time then. Or ask me for a fixed resend. (Having said that, I
recommend b4 am -3 + git am -3 which should resolve most conflicts just
fine.)

Best regards
Uwe

 drivers/iommu/apple-dart.c                  | 2 +-
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +-
 drivers/iommu/arm/arm-smmu/arm-smmu.c       | 2 +-
 drivers/iommu/arm/arm-smmu/qcom_iommu.c     | 4 ++--
 drivers/iommu/ipmmu-vmsa.c                  | 2 +-
 drivers/iommu/msm_iommu.c                   | 2 +-
 drivers/iommu/mtk_iommu.c                   | 2 +-
 drivers/iommu/mtk_iommu_v1.c                | 2 +-
 drivers/iommu/omap-iommu.c                  | 2 +-
 drivers/iommu/riscv/iommu-platform.c        | 2 +-
 drivers/iommu/sprd-iommu.c                  | 2 +-
 11 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
index eb1e62cd499a..c5bde50d1c42 100644
--- a/drivers/iommu/apple-dart.c
+++ b/drivers/iommu/apple-dart.c
@@ -1352,7 +1352,7 @@ static struct platform_driver apple_dart_driver = {
 		.pm			= pm_sleep_ptr(&apple_dart_pm_ops),
 	},
 	.probe	= apple_dart_probe,
-	.remove_new = apple_dart_remove,
+	.remove	= apple_dart_remove,
 };
 
 module_platform_driver(apple_dart_driver);
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 826db8894fb7..efbc78bffd33 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -4679,7 +4679,7 @@ static struct platform_driver arm_smmu_driver = {
 		.suppress_bind_attrs	= true,
 	},
 	.probe	= arm_smmu_device_probe,
-	.remove_new = arm_smmu_device_remove,
+	.remove	= arm_smmu_device_remove,
 	.shutdown = arm_smmu_device_shutdown,
 };
 module_driver(arm_smmu_driver, platform_driver_register,
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
index 8321962b3714..4e9bb9f4c4bd 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
@@ -2372,7 +2372,7 @@ static struct platform_driver arm_smmu_driver = {
 		.suppress_bind_attrs    = true,
 	},
 	.probe	= arm_smmu_device_probe,
-	.remove_new = arm_smmu_device_remove,
+	.remove = arm_smmu_device_remove,
 	.shutdown = arm_smmu_device_shutdown,
 };
 module_platform_driver(arm_smmu_driver);
diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
index b98a7a598b89..9ce2fe50b22c 100644
--- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c
+++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
@@ -759,7 +759,7 @@ static struct platform_driver qcom_iommu_ctx_driver = {
 		.of_match_table	= ctx_of_match,
 	},
 	.probe	= qcom_iommu_ctx_probe,
-	.remove_new = qcom_iommu_ctx_remove,
+	.remove	= qcom_iommu_ctx_remove,
 };
 
 static bool qcom_iommu_has_secure_context(struct qcom_iommu_dev *qcom_iommu)
@@ -931,7 +931,7 @@ static struct platform_driver qcom_iommu_driver = {
 		.pm		= &qcom_iommu_pm_ops,
 	},
 	.probe	= qcom_iommu_device_probe,
-	.remove_new = qcom_iommu_device_remove,
+	.remove	= qcom_iommu_device_remove,
 };
 
 static int __init qcom_iommu_init(void)
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index ff55b8c30712..074daf1aac4e 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -1159,6 +1159,6 @@ static struct platform_driver ipmmu_driver = {
 		.pm = pm_sleep_ptr(&ipmmu_pm),
 	},
 	.probe = ipmmu_probe,
-	.remove_new = ipmmu_remove,
+	.remove = ipmmu_remove,
 };
 builtin_platform_driver(ipmmu_driver);
diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
index 989e0869d805..ce40f0a419ea 100644
--- a/drivers/iommu/msm_iommu.c
+++ b/drivers/iommu/msm_iommu.c
@@ -838,6 +838,6 @@ static struct platform_driver msm_iommu_driver = {
 		.of_match_table = msm_iommu_dt_match,
 	},
 	.probe		= msm_iommu_probe,
-	.remove_new	= msm_iommu_remove,
+	.remove		= msm_iommu_remove,
 };
 builtin_platform_driver(msm_iommu_driver);
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index c45313c43b9e..72b68d037b95 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -1794,7 +1794,7 @@ MODULE_DEVICE_TABLE(of, mtk_iommu_of_ids);
 
 static struct platform_driver mtk_iommu_driver = {
 	.probe	= mtk_iommu_probe,
-	.remove_new = mtk_iommu_remove,
+	.remove	= mtk_iommu_remove,
 	.driver	= {
 		.name = "mtk-iommu",
 		.of_match_table = mtk_iommu_of_ids,
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index ee4e55b6b190..480e57ea6635 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -745,7 +745,7 @@ static const struct dev_pm_ops mtk_iommu_v1_pm_ops = {
 
 static struct platform_driver mtk_iommu_v1_driver = {
 	.probe	= mtk_iommu_v1_probe,
-	.remove_new = mtk_iommu_v1_remove,
+	.remove	= mtk_iommu_v1_remove,
 	.driver	= {
 		.name = "mtk-iommu-v1",
 		.of_match_table = mtk_iommu_v1_of_ids,
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index 3f72aef8bd5b..b8ced5d0581c 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -1285,7 +1285,7 @@ static const struct of_device_id omap_iommu_of_match[] = {
 
 static struct platform_driver omap_iommu_driver = {
 	.probe	= omap_iommu_probe,
-	.remove_new = omap_iommu_remove,
+	.remove	= omap_iommu_remove,
 	.driver	= {
 		.name	= "omap-iommu",
 		.pm	= &omap_iommu_pm_ops,
diff --git a/drivers/iommu/riscv/iommu-platform.c b/drivers/iommu/riscv/iommu-platform.c
index da336863f152..382ba2841849 100644
--- a/drivers/iommu/riscv/iommu-platform.c
+++ b/drivers/iommu/riscv/iommu-platform.c
@@ -81,7 +81,7 @@ static const struct of_device_id riscv_iommu_of_match[] = {
 
 static struct platform_driver riscv_iommu_platform_driver = {
 	.probe = riscv_iommu_platform_probe,
-	.remove_new = riscv_iommu_platform_remove,
+	.remove = riscv_iommu_platform_remove,
 	.driver = {
 		.name = "riscv,iommu",
 		.of_match_table = riscv_iommu_of_match,
diff --git a/drivers/iommu/sprd-iommu.c b/drivers/iommu/sprd-iommu.c
index a2f4ffe6d949..e84806eee281 100644
--- a/drivers/iommu/sprd-iommu.c
+++ b/drivers/iommu/sprd-iommu.c
@@ -531,7 +531,7 @@ static struct platform_driver sprd_iommu_driver = {
 		.suppress_bind_attrs = true,
 	},
 	.probe	= sprd_iommu_probe,
-	.remove_new = sprd_iommu_remove,
+	.remove	= sprd_iommu_remove,
 };
 module_platform_driver(sprd_iommu_driver);
 
base-commit: c88416ba074a8913cf6d61b789dd834bbca6681c
-- 
2.45.2

Re: [PATCH] iommu: Switch back to struct platform_driver::remove()
Posted by Robin Murphy 2 weeks, 6 days ago
On 2024-11-04 6:46 am, Uwe Kleine-König wrote:
> After commit 0edb555a65d1 ("platform: Make platform_driver::remove()
> return void") .remove() is (again) the right callback to implement for
> platform drivers.
> 
> Convert all platform drivers below drivers/iommu to use .remove(), with
> the eventual goal to drop struct platform_driver::remove_new(). As
> .remove() and .remove_new() have the same prototypes, conversion is done
> by just changing the structure member name in the driver initializer.

I dont see any major concern with doing it this way. FWIW,

Acked-by: Robin Murphy <robin.murphy@arm.com>

> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> Hello,
> 
> I did a single patch for all of drivers/iommu. While I usually prefer to
> do one logical change per patch, this seems to be overengineering here
> as the individual changes are really trivial and shouldn't be much in
> the way for stable backports. But I'll happily split the patch if you
> prefer it split.
> 
> This is based on today's next, if conflicts arise when you apply it at
> some later time and don't want to resolve them, feel free to just drop
> the changes to the conflicting files. I'll notice and followup at a
> later time then. Or ask me for a fixed resend. (Having said that, I
> recommend b4 am -3 + git am -3 which should resolve most conflicts just
> fine.)
> 
> Best regards
> Uwe
> 
>   drivers/iommu/apple-dart.c                  | 2 +-
>   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +-
>   drivers/iommu/arm/arm-smmu/arm-smmu.c       | 2 +-
>   drivers/iommu/arm/arm-smmu/qcom_iommu.c     | 4 ++--
>   drivers/iommu/ipmmu-vmsa.c                  | 2 +-
>   drivers/iommu/msm_iommu.c                   | 2 +-
>   drivers/iommu/mtk_iommu.c                   | 2 +-
>   drivers/iommu/mtk_iommu_v1.c                | 2 +-
>   drivers/iommu/omap-iommu.c                  | 2 +-
>   drivers/iommu/riscv/iommu-platform.c        | 2 +-
>   drivers/iommu/sprd-iommu.c                  | 2 +-
>   11 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
> index eb1e62cd499a..c5bde50d1c42 100644
> --- a/drivers/iommu/apple-dart.c
> +++ b/drivers/iommu/apple-dart.c
> @@ -1352,7 +1352,7 @@ static struct platform_driver apple_dart_driver = {
>   		.pm			= pm_sleep_ptr(&apple_dart_pm_ops),
>   	},
>   	.probe	= apple_dart_probe,
> -	.remove_new = apple_dart_remove,
> +	.remove	= apple_dart_remove,
>   };
>   
>   module_platform_driver(apple_dart_driver);
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> index 826db8894fb7..efbc78bffd33 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -4679,7 +4679,7 @@ static struct platform_driver arm_smmu_driver = {
>   		.suppress_bind_attrs	= true,
>   	},
>   	.probe	= arm_smmu_device_probe,
> -	.remove_new = arm_smmu_device_remove,
> +	.remove	= arm_smmu_device_remove,
>   	.shutdown = arm_smmu_device_shutdown,
>   };
>   module_driver(arm_smmu_driver, platform_driver_register,
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
> index 8321962b3714..4e9bb9f4c4bd 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
> @@ -2372,7 +2372,7 @@ static struct platform_driver arm_smmu_driver = {
>   		.suppress_bind_attrs    = true,
>   	},
>   	.probe	= arm_smmu_device_probe,
> -	.remove_new = arm_smmu_device_remove,
> +	.remove = arm_smmu_device_remove,
>   	.shutdown = arm_smmu_device_shutdown,
>   };
>   module_platform_driver(arm_smmu_driver);
> diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
> index b98a7a598b89..9ce2fe50b22c 100644
> --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c
> +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
> @@ -759,7 +759,7 @@ static struct platform_driver qcom_iommu_ctx_driver = {
>   		.of_match_table	= ctx_of_match,
>   	},
>   	.probe	= qcom_iommu_ctx_probe,
> -	.remove_new = qcom_iommu_ctx_remove,
> +	.remove	= qcom_iommu_ctx_remove,
>   };
>   
>   static bool qcom_iommu_has_secure_context(struct qcom_iommu_dev *qcom_iommu)
> @@ -931,7 +931,7 @@ static struct platform_driver qcom_iommu_driver = {
>   		.pm		= &qcom_iommu_pm_ops,
>   	},
>   	.probe	= qcom_iommu_device_probe,
> -	.remove_new = qcom_iommu_device_remove,
> +	.remove	= qcom_iommu_device_remove,
>   };
>   
>   static int __init qcom_iommu_init(void)
> diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
> index ff55b8c30712..074daf1aac4e 100644
> --- a/drivers/iommu/ipmmu-vmsa.c
> +++ b/drivers/iommu/ipmmu-vmsa.c
> @@ -1159,6 +1159,6 @@ static struct platform_driver ipmmu_driver = {
>   		.pm = pm_sleep_ptr(&ipmmu_pm),
>   	},
>   	.probe = ipmmu_probe,
> -	.remove_new = ipmmu_remove,
> +	.remove = ipmmu_remove,
>   };
>   builtin_platform_driver(ipmmu_driver);
> diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
> index 989e0869d805..ce40f0a419ea 100644
> --- a/drivers/iommu/msm_iommu.c
> +++ b/drivers/iommu/msm_iommu.c
> @@ -838,6 +838,6 @@ static struct platform_driver msm_iommu_driver = {
>   		.of_match_table = msm_iommu_dt_match,
>   	},
>   	.probe		= msm_iommu_probe,
> -	.remove_new	= msm_iommu_remove,
> +	.remove		= msm_iommu_remove,
>   };
>   builtin_platform_driver(msm_iommu_driver);
> diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
> index c45313c43b9e..72b68d037b95 100644
> --- a/drivers/iommu/mtk_iommu.c
> +++ b/drivers/iommu/mtk_iommu.c
> @@ -1794,7 +1794,7 @@ MODULE_DEVICE_TABLE(of, mtk_iommu_of_ids);
>   
>   static struct platform_driver mtk_iommu_driver = {
>   	.probe	= mtk_iommu_probe,
> -	.remove_new = mtk_iommu_remove,
> +	.remove	= mtk_iommu_remove,
>   	.driver	= {
>   		.name = "mtk-iommu",
>   		.of_match_table = mtk_iommu_of_ids,
> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
> index ee4e55b6b190..480e57ea6635 100644
> --- a/drivers/iommu/mtk_iommu_v1.c
> +++ b/drivers/iommu/mtk_iommu_v1.c
> @@ -745,7 +745,7 @@ static const struct dev_pm_ops mtk_iommu_v1_pm_ops = {
>   
>   static struct platform_driver mtk_iommu_v1_driver = {
>   	.probe	= mtk_iommu_v1_probe,
> -	.remove_new = mtk_iommu_v1_remove,
> +	.remove	= mtk_iommu_v1_remove,
>   	.driver	= {
>   		.name = "mtk-iommu-v1",
>   		.of_match_table = mtk_iommu_v1_of_ids,
> diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
> index 3f72aef8bd5b..b8ced5d0581c 100644
> --- a/drivers/iommu/omap-iommu.c
> +++ b/drivers/iommu/omap-iommu.c
> @@ -1285,7 +1285,7 @@ static const struct of_device_id omap_iommu_of_match[] = {
>   
>   static struct platform_driver omap_iommu_driver = {
>   	.probe	= omap_iommu_probe,
> -	.remove_new = omap_iommu_remove,
> +	.remove	= omap_iommu_remove,
>   	.driver	= {
>   		.name	= "omap-iommu",
>   		.pm	= &omap_iommu_pm_ops,
> diff --git a/drivers/iommu/riscv/iommu-platform.c b/drivers/iommu/riscv/iommu-platform.c
> index da336863f152..382ba2841849 100644
> --- a/drivers/iommu/riscv/iommu-platform.c
> +++ b/drivers/iommu/riscv/iommu-platform.c
> @@ -81,7 +81,7 @@ static const struct of_device_id riscv_iommu_of_match[] = {
>   
>   static struct platform_driver riscv_iommu_platform_driver = {
>   	.probe = riscv_iommu_platform_probe,
> -	.remove_new = riscv_iommu_platform_remove,
> +	.remove = riscv_iommu_platform_remove,
>   	.driver = {
>   		.name = "riscv,iommu",
>   		.of_match_table = riscv_iommu_of_match,
> diff --git a/drivers/iommu/sprd-iommu.c b/drivers/iommu/sprd-iommu.c
> index a2f4ffe6d949..e84806eee281 100644
> --- a/drivers/iommu/sprd-iommu.c
> +++ b/drivers/iommu/sprd-iommu.c
> @@ -531,7 +531,7 @@ static struct platform_driver sprd_iommu_driver = {
>   		.suppress_bind_attrs = true,
>   	},
>   	.probe	= sprd_iommu_probe,
> -	.remove_new = sprd_iommu_remove,
> +	.remove	= sprd_iommu_remove,
>   };
>   module_platform_driver(sprd_iommu_driver);
>   
> base-commit: c88416ba074a8913cf6d61b789dd834bbca6681c

Re: [PATCH] iommu: Switch back to struct platform_driver::remove()
Posted by Tomasz Jeznach 2 weeks, 4 days ago
> > diff --git a/drivers/iommu/riscv/iommu-platform.c b/drivers/iommu/riscv/iommu-platform.c
> > index da336863f152..382ba2841849 100644
> > --- a/drivers/iommu/riscv/iommu-platform.c
> > +++ b/drivers/iommu/riscv/iommu-platform.c
> > @@ -81,7 +81,7 @@ static const struct of_device_id riscv_iommu_of_match[] = {
> >
> >   static struct platform_driver riscv_iommu_platform_driver = {
> >       .probe = riscv_iommu_platform_probe,
> > -     .remove_new = riscv_iommu_platform_remove,
> > +     .remove = riscv_iommu_platform_remove,
> >       .driver = {
> >               .name = "riscv,iommu",
> >               .of_match_table = riscv_iommu_of_match,
> > diff --git a/drivers/iommu/sprd-iommu.c b/drivers/iommu/sprd-iommu.c
> > index a2f4ffe6d949..e84806eee281 100644
> > --- a/drivers/iommu/sprd-iommu.c
> > +++ b/drivers/iommu/sprd-iommu.c
> > @@ -531,7 +531,7 @@ static struct platform_driver sprd_iommu_driver = {
> >               .suppress_bind_attrs = true,
> >       },
> >       .probe  = sprd_iommu_probe,
> > -     .remove_new = sprd_iommu_remove,
> > +     .remove = sprd_iommu_remove,
> >   };
> >   module_platform_driver(sprd_iommu_driver);
> >
> > base-commit: c88416ba074a8913cf6d61b789dd834bbca6681c
>

Thanks, LGTM for iommu/riscv part of the patch.

Reviewed-by: Tomasz Jeznach <tjeznach@rivosinc.com>