Skip to content

Commit d8690b5

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 3a14d5c commit d8690b5

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);
@@ -907,10 +906,11 @@ static struct iommu_group *apple_dart_device_group(struct device *dev)
907906
static int apple_dart_def_domain_type(struct device *dev)
908907
{
909908
struct apple_dart_master_cfg *cfg = dev_iommu_priv_get(dev);
909+
struct apple_dart *dart = cfg->stream_maps[0].dart;
910910

911-
if (cfg->stream_maps[0].dart->force_bypass)
911+
if (dart->force_bypass)
912912
return IOMMU_DOMAIN_IDENTITY;
913-
if (!cfg->stream_maps[0].dart->supports_bypass)
913+
if (dart->supports_bypass)
914914
return IOMMU_DOMAIN_DMA;
915915

916916
return 0;

0 commit comments

Comments
 (0)