Skip to content

Commit a05588f

Browse files
alyssarosenzweigmarcan
authored andcommitted
iommu/dart: Factor out apple_dart* expression
In the next patch this will be used a third time. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
1 parent 690fe63 commit a05588f

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/iommu/apple-dart.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -652,12 +652,11 @@ static int apple_dart_attach_dev(struct iommu_domain *domain,
652652
struct apple_dart_stream_map *stream_map;
653653
struct apple_dart_master_cfg *cfg = dev_iommu_priv_get(dev);
654654
struct apple_dart_domain *dart_domain = to_dart_domain(domain);
655+
struct apple_dart *dart0 = cfg->stream_maps[0].dart;
655656

656-
if (cfg->stream_maps[0].dart->force_bypass &&
657-
domain->type != IOMMU_DOMAIN_IDENTITY)
657+
if (dart0->force_bypass && domain->type != IOMMU_DOMAIN_IDENTITY)
658658
return -EINVAL;
659-
if (!cfg->stream_maps[0].dart->supports_bypass &&
660-
domain->type == IOMMU_DOMAIN_IDENTITY)
659+
if (!dart0->supports_bypass && domain->type == IOMMU_DOMAIN_IDENTITY)
661660
return -EINVAL;
662661

663662
ret = apple_dart_finalize_domain(domain, cfg);
@@ -905,10 +904,11 @@ static struct iommu_group *apple_dart_device_group(struct device *dev)
905904
static int apple_dart_def_domain_type(struct device *dev)
906905
{
907906
struct apple_dart_master_cfg *cfg = dev_iommu_priv_get(dev);
907+
struct apple_dart *dart = cfg->stream_maps[0].dart;
908908

909-
if (cfg->stream_maps[0].dart->force_bypass)
909+
if (dart->force_bypass)
910910
return IOMMU_DOMAIN_IDENTITY;
911-
if (!cfg->stream_maps[0].dart->supports_bypass)
911+
if (dart->supports_bypass)
912912
return IOMMU_DOMAIN_DMA;
913913

914914
return 0;

0 commit comments

Comments
 (0)