@@ -998,8 +998,7 @@ static void viommu_get_resv_regions(struct device *dev, struct list_head *head)
998
998
iommu_dma_get_resv_regions (dev , head );
999
999
}
1000
1000
1001
- static const struct iommu_ops viommu_ops ;
1002
- static struct virtio_driver virtio_iommu_drv ;
1001
+ static const struct bus_type * virtio_bus_type ;
1003
1002
1004
1003
static int viommu_match_node (struct device * dev , const void * data )
1005
1004
{
@@ -1008,8 +1007,9 @@ static int viommu_match_node(struct device *dev, const void *data)
1008
1007
1009
1008
static struct viommu_dev * viommu_get_by_fwnode (struct fwnode_handle * fwnode )
1010
1009
{
1011
- struct device * dev = driver_find_device (& virtio_iommu_drv .driver , NULL ,
1012
- fwnode , viommu_match_node );
1010
+ struct device * dev = bus_find_device (virtio_bus_type , NULL , fwnode ,
1011
+ viommu_match_node );
1012
+
1013
1013
put_device (dev );
1014
1014
1015
1015
return dev ? dev_to_virtio (dev )-> priv : NULL ;
@@ -1160,6 +1160,9 @@ static int viommu_probe(struct virtio_device *vdev)
1160
1160
if (!viommu )
1161
1161
return - ENOMEM ;
1162
1162
1163
+ /* Borrow this for easy lookups later */
1164
+ virtio_bus_type = dev -> bus ;
1165
+
1163
1166
spin_lock_init (& viommu -> request_lock );
1164
1167
ida_init (& viommu -> domain_ids );
1165
1168
viommu -> dev = dev ;
@@ -1229,10 +1232,10 @@ static int viommu_probe(struct virtio_device *vdev)
1229
1232
if (ret )
1230
1233
goto err_free_vqs ;
1231
1234
1232
- iommu_device_register (& viommu -> iommu , & viommu_ops , parent_dev );
1233
-
1234
1235
vdev -> priv = viommu ;
1235
1236
1237
+ iommu_device_register (& viommu -> iommu , & viommu_ops , parent_dev );
1238
+
1236
1239
dev_info (dev , "input address: %u bits\n" ,
1237
1240
order_base_2 (viommu -> geometry .aperture_end ));
1238
1241
dev_info (dev , "page mask: %#llx\n" , viommu -> pgsize_bitmap );
0 commit comments