From: Baolu Lu <baolu.lu@linux.intel.com>
To: Robin Murphy <robin.murphy@arm.com>, joro@8bytes.org, will@kernel.org
Cc: baolu.lu@linux.intel.com, iommu@lists.linux-foundation.org,
iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] iommu: Make .release_device optional
Date: Wed, 22 Jun 2022 09:33:36 +0800 [thread overview]
Message-ID: <3f8d1656-dea5-6525-07f9-6dfe5f2aaf23@linux.intel.com> (raw)
In-Reply-To: <bda9d3eb4527eac8f6544a15067e2529cca54a2e.1655822151.git.robin.murphy@arm.com>
On 2022/6/21 23:14, Robin Murphy wrote:
> Many drivers do nothing meaningful for .release_device, and it's neatly
> abstracted to just two callsites in the core code, so let's make it
> optional to implement.
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
> drivers/iommu/fsl_pamu_domain.c | 5 -----
> drivers/iommu/iommu.c | 6 ++++--
> drivers/iommu/msm_iommu.c | 5 -----
> drivers/iommu/sun50i-iommu.c | 3 ---
> drivers/iommu/tegra-gart.c | 5 -----
> drivers/iommu/tegra-smmu.c | 3 ---
> 6 files changed, 4 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c
> index 94b4589dc67c..011f9ab7f743 100644
> --- a/drivers/iommu/fsl_pamu_domain.c
> +++ b/drivers/iommu/fsl_pamu_domain.c
> @@ -447,15 +447,10 @@ static struct iommu_device *fsl_pamu_probe_device(struct device *dev)
> return &pamu_iommu;
> }
>
> -static void fsl_pamu_release_device(struct device *dev)
> -{
> -}
> -
> static const struct iommu_ops fsl_pamu_ops = {
> .capable = fsl_pamu_capable,
> .domain_alloc = fsl_pamu_domain_alloc,
> .probe_device = fsl_pamu_probe_device,
> - .release_device = fsl_pamu_release_device,
> .device_group = fsl_pamu_device_group,
> .default_domain_ops = &(const struct iommu_domain_ops) {
> .attach_dev = fsl_pamu_attach_device,
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 06d6989f07f6..8b4fc7e62b99 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -259,7 +259,8 @@ static int __iommu_probe_device(struct device *dev, struct list_head *group_list
> return 0;
>
> out_release:
> - ops->release_device(dev);
> + if (ops->release_device)
> + ops->release_device(dev);
>
> out_module_put:
> module_put(ops->owner);
> @@ -337,7 +338,8 @@ void iommu_release_device(struct device *dev)
> iommu_device_unlink(dev->iommu->iommu_dev, dev);
>
> ops = dev_iommu_ops(dev);
> - ops->release_device(dev);
> + if (ops->release_device)
> + ops->release_device(dev);
>
> iommu_group_remove_device(dev);
> module_put(ops->owner);
> diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
> index f09aedfdd462..428919a474c1 100644
> --- a/drivers/iommu/msm_iommu.c
> +++ b/drivers/iommu/msm_iommu.c
> @@ -394,10 +394,6 @@ static struct iommu_device *msm_iommu_probe_device(struct device *dev)
> return &iommu->iommu;
> }
>
> -static void msm_iommu_release_device(struct device *dev)
> -{
> -}
> -
> static int msm_iommu_attach_dev(struct iommu_domain *domain, struct device *dev)
> {
> int ret = 0;
> @@ -677,7 +673,6 @@ irqreturn_t msm_iommu_fault_handler(int irq, void *dev_id)
> static struct iommu_ops msm_iommu_ops = {
> .domain_alloc = msm_iommu_domain_alloc,
> .probe_device = msm_iommu_probe_device,
> - .release_device = msm_iommu_release_device,
> .device_group = generic_device_group,
> .pgsize_bitmap = MSM_IOMMU_PGSIZES,
> .of_xlate = qcom_iommu_of_xlate,
> diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c
> index c54ab477b8fd..a84c63518773 100644
> --- a/drivers/iommu/sun50i-iommu.c
> +++ b/drivers/iommu/sun50i-iommu.c
> @@ -738,8 +738,6 @@ static struct iommu_device *sun50i_iommu_probe_device(struct device *dev)
> return &iommu->iommu;
> }
>
> -static void sun50i_iommu_release_device(struct device *dev) {}
> -
> static struct iommu_group *sun50i_iommu_device_group(struct device *dev)
> {
> struct sun50i_iommu *iommu = sun50i_iommu_from_dev(dev);
> @@ -764,7 +762,6 @@ static const struct iommu_ops sun50i_iommu_ops = {
> .domain_alloc = sun50i_iommu_domain_alloc,
> .of_xlate = sun50i_iommu_of_xlate,
> .probe_device = sun50i_iommu_probe_device,
> - .release_device = sun50i_iommu_release_device,
> .default_domain_ops = &(const struct iommu_domain_ops) {
> .attach_dev = sun50i_iommu_attach_device,
> .detach_dev = sun50i_iommu_detach_device,
> diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c
> index a6700a40a6f8..e5ca3cf1a949 100644
> --- a/drivers/iommu/tegra-gart.c
> +++ b/drivers/iommu/tegra-gart.c
> @@ -246,10 +246,6 @@ static struct iommu_device *gart_iommu_probe_device(struct device *dev)
> return &gart_handle->iommu;
> }
>
> -static void gart_iommu_release_device(struct device *dev)
> -{
> -}
> -
> static int gart_iommu_of_xlate(struct device *dev,
> struct of_phandle_args *args)
> {
> @@ -273,7 +269,6 @@ static void gart_iommu_sync(struct iommu_domain *domain,
> static const struct iommu_ops gart_iommu_ops = {
> .domain_alloc = gart_iommu_domain_alloc,
> .probe_device = gart_iommu_probe_device,
> - .release_device = gart_iommu_release_device,
> .device_group = generic_device_group,
> .pgsize_bitmap = GART_IOMMU_PGSIZES,
> .of_xlate = gart_iommu_of_xlate,
> diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
> index 1fea68e551f1..2a8de975fe63 100644
> --- a/drivers/iommu/tegra-smmu.c
> +++ b/drivers/iommu/tegra-smmu.c
> @@ -864,8 +864,6 @@ static struct iommu_device *tegra_smmu_probe_device(struct device *dev)
> return &smmu->iommu;
> }
>
> -static void tegra_smmu_release_device(struct device *dev) {}
> -
> static const struct tegra_smmu_group_soc *
> tegra_smmu_find_group(struct tegra_smmu *smmu, unsigned int swgroup)
> {
> @@ -966,7 +964,6 @@ static int tegra_smmu_of_xlate(struct device *dev,
> static const struct iommu_ops tegra_smmu_ops = {
> .domain_alloc = tegra_smmu_domain_alloc,
> .probe_device = tegra_smmu_probe_device,
> - .release_device = tegra_smmu_release_device,
> .device_group = tegra_smmu_device_group,
> .of_xlate = tegra_smmu_of_xlate,
> .pgsize_bitmap = SZ_4K,
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Best regards,
baolu
next prev parent reply other threads:[~2022-06-22 1:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 15:14 [PATCH 0/3] iommu: More internal ops cleanup Robin Murphy
2022-06-21 15:14 ` [PATCH 1/3] iommu: Use dev_iommu_ops() for probe_finalize Robin Murphy
2022-06-21 15:14 ` [PATCH 2/3] iommu: Make .release_device optional Robin Murphy
2022-06-22 1:33 ` Baolu Lu [this message]
2022-06-21 15:14 ` [PATCH 3/3] iommu: Clean up release_device checks Robin Murphy
2022-06-22 1:36 ` Baolu Lu
2022-06-22 7:17 ` Robin Murphy
2022-06-22 11:57 ` Baolu Lu
2022-07-06 10:56 ` [PATCH 0/3] iommu: More internal ops cleanup Joerg Roedel
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=3f8d1656-dea5-6525-07f9-6dfe5f2aaf23@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux-foundation.org \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox