@@ -1658,43 +1658,18 @@ int iommu_request_dm_for_dev(struct device *dev)
1658
1658
return ret ;
1659
1659
}
1660
1660
1661
- struct iommu_instance {
1662
- struct list_head list ;
1663
- struct fwnode_handle * fwnode ;
1664
- const struct iommu_ops * ops ;
1665
- };
1666
- static LIST_HEAD (iommu_instance_list );
1667
- static DEFINE_SPINLOCK (iommu_instance_lock );
1668
-
1669
- void iommu_register_instance (struct fwnode_handle * fwnode ,
1670
- const struct iommu_ops * ops )
1671
- {
1672
- struct iommu_instance * iommu = kzalloc (sizeof (* iommu ), GFP_KERNEL );
1673
-
1674
- if (WARN_ON (!iommu ))
1675
- return ;
1676
-
1677
- of_node_get (to_of_node (fwnode ));
1678
- INIT_LIST_HEAD (& iommu -> list );
1679
- iommu -> fwnode = fwnode ;
1680
- iommu -> ops = ops ;
1681
- spin_lock (& iommu_instance_lock );
1682
- list_add_tail (& iommu -> list , & iommu_instance_list );
1683
- spin_unlock (& iommu_instance_lock );
1684
- }
1685
-
1686
1661
const struct iommu_ops * iommu_ops_from_fwnode (struct fwnode_handle * fwnode )
1687
1662
{
1688
- struct iommu_instance * instance ;
1689
1663
const struct iommu_ops * ops = NULL ;
1664
+ struct iommu_device * iommu ;
1690
1665
1691
- spin_lock (& iommu_instance_lock );
1692
- list_for_each_entry (instance , & iommu_instance_list , list )
1693
- if (instance -> fwnode == fwnode ) {
1694
- ops = instance -> ops ;
1666
+ spin_lock (& iommu_device_lock );
1667
+ list_for_each_entry (iommu , & iommu_device_list , list )
1668
+ if (iommu -> fwnode == fwnode ) {
1669
+ ops = iommu -> ops ;
1695
1670
break ;
1696
1671
}
1697
- spin_unlock (& iommu_instance_lock );
1672
+ spin_unlock (& iommu_device_lock );
1698
1673
return ops ;
1699
1674
}
1700
1675
0 commit comments