iommu/io-pgtable-arm: hide unused ipmmu_iotlb_sync
PATCH 1/1 iommu/io-pgtable-arm: hide unused ipmmu_iotlb_sync
There are two sets of iommu_ops in this driver, and only one of them contains a reference to the ipmmu_iotlb_sync function. This leads to a compiler warning when these operations are not in use:
drivers/iommu/ipmmu-vmsa.c:622:13: error: 'ipmmu_iotlb_sync' defined but not used [-Werror=unused-function]
We either want to use the function in both operations, or we should hide it. Without having additional information which approach is correct, I'm picking the second one here, which avoids the build error.
--- drivers/iommu/ipmmu-vmsa.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/iommu/ipmmu-vmsa.c +8 -8
@@ -619,14 +619,6 @@ static size_t ipmmu_unmap(struct iommu_domain *io_domain, unsigned long iova,return domain->iop->unmap (domain->iop, iova, size); } -static void ipmmu_iotlb_sync (struct iommu_domain *io_domain) -{ -struct ipmmu_vmsa_domain *domain =to_vmsa_domain (io_domain); - -if (domain->mmu) -ipmmu_tlb_flush_all (domain); -} -static phys_addr_t ipmmu_iova_to_phys (struct iommu_domain *io_domain,dma_addr_t iova) {
@@ -810,6 +802,14 @@ static void ipmmu_domain_free_dma(struct iommu_domain *io_domain) } } +static void ipmmu_iotlb_sync (struct iommu_domain *io_domain) +{ +struct ipmmu_vmsa_domain *domain =to_vmsa_domain (io_domain); + +if (domain->mmu) +ipmmu_tlb_flush_all (domain); +} +static int ipmmu_add_device_dma (struct device *dev) {struct iommu_group *group;
Signature · 1 line
2.9.0
Robin Murphy
reviewerQuoted 6 lines · Arnd Bergmann
There are two sets of
iommu_opsin this driver, and only one of them contains a reference to theipmmu_iotlb_syncfunction. This leads to a compiler warning when these operations are not in use:
drivers/iommu/ipmmu-vmsa.c:622:13: error: 'ipmmu_iotlb_sync' defined but not used [-Werror=unused-function]
Oh bum, I forgot there was still quite so much #ifdef'd under CONFIG_ARM in this driver :(
Quoted 4 lines
We either want to use the function in both operations, or we should hide it. Without having additional information which approach is correct, I'm picking the second one here, which avoids the build error.
For correctness I think it needs to be the first one, otherwise iommu_unmap() will wind up missing a sync on 32-bit ARM.
That said, I think the third option is now viable as well, namely to shuffle some lines and get rid of the almost-duplicated ops entirely. I'll have a quick go at that shortly.
Robin.
Quoted 41 lines
Fixes 32b124492bdf ("iommu/io-pgtable-arm: Convert to IOMMU API TLB sync")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/iommu/ipmmu-vmsa.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)drivers/iommu/ipmmu-vmsa.c +8
-8@@ -619,14 +619,6 @@ static size_t ipmmu_unmap(struct iommu_domain *io_domain, unsigned long iova,return domain->iop->unmap (domain->iop, iova, size); } -static void ipmmu_iotlb_sync (struct iommu_domain *io_domain) -{ -struct ipmmu_vmsa_domain *domain =to_vmsa_domain (io_domain); - -if (domain->mmu) -ipmmu_tlb_flush_all (domain); -} -static phys_addr_t ipmmu_iova_to_phys (struct iommu_domain *io_domain,dma_addr_t iova) {@@ -810,6 +802,14 @@ static void ipmmu_domain_free_dma(struct iommu_domain *io_domain) } } +static void ipmmu_iotlb_sync (struct iommu_domain *io_domain) +{ +struct ipmmu_vmsa_domain *domain =to_vmsa_domain (io_domain); + +if (domain->mmu) +ipmmu_tlb_flush_all (domain); +} +static int ipmmu_add_device_dma (struct device *dev) {struct iommu_group *group;
Quoted 5 lines · Robin Murphy
On 11/10/17 14:59, Arnd Bergmann wrote:
That said, I think the third option is now viable as well, namely to shuffle some lines and get rid of the almost-duplicated ops entirely. I'll have a quick go at that shortly.
Ok, thanks!
Arnd