Skip to content

Commit df90365

Browse files
committed
iommu/ipmmu-vmsa: Use helper functions to access dev->iommu_fwspec
Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 98cc4f7 commit df90365

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/iommu/ipmmu-vmsa.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ static struct ipmmu_vmsa_domain *to_vmsa_domain(struct iommu_domain *dom)
8282

8383
static struct ipmmu_vmsa_device *to_ipmmu(struct device *dev)
8484
{
85-
return dev->iommu_fwspec ? dev->iommu_fwspec->iommu_priv : NULL;
85+
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
86+
87+
return fwspec ? fwspec->iommu_priv : NULL;
8688
}
8789

8890
#define TLB_LOOP_TIMEOUT 100 /* 100us */
@@ -641,7 +643,7 @@ static void ipmmu_domain_free(struct iommu_domain *io_domain)
641643
static int ipmmu_attach_device(struct iommu_domain *io_domain,
642644
struct device *dev)
643645
{
644-
struct iommu_fwspec *fwspec = dev->iommu_fwspec;
646+
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
645647
struct ipmmu_vmsa_device *mmu = to_ipmmu(dev);
646648
struct ipmmu_vmsa_domain *domain = to_vmsa_domain(io_domain);
647649
unsigned int i;
@@ -690,7 +692,7 @@ static int ipmmu_attach_device(struct iommu_domain *io_domain,
690692
static void ipmmu_detach_device(struct iommu_domain *io_domain,
691693
struct device *dev)
692694
{
693-
struct iommu_fwspec *fwspec = dev->iommu_fwspec;
695+
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
694696
struct ipmmu_vmsa_domain *domain = to_vmsa_domain(io_domain);
695697
unsigned int i;
696698

@@ -742,13 +744,15 @@ static phys_addr_t ipmmu_iova_to_phys(struct iommu_domain *io_domain,
742744
static int ipmmu_init_platform_device(struct device *dev,
743745
struct of_phandle_args *args)
744746
{
747+
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
745748
struct platform_device *ipmmu_pdev;
746749

747750
ipmmu_pdev = of_find_device_by_node(args->np);
748751
if (!ipmmu_pdev)
749752
return -ENODEV;
750753

751-
dev->iommu_fwspec->iommu_priv = platform_get_drvdata(ipmmu_pdev);
754+
fwspec->iommu_priv = platform_get_drvdata(ipmmu_pdev);
755+
752756
return 0;
753757
}
754758

0 commit comments

Comments
 (0)