@@ -998,8 +998,7 @@ static void viommu_get_resv_regions(struct device *dev, struct list_head *head)
998998 iommu_dma_get_resv_regions (dev , head );
999999}
10001000
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 ;
10031002
10041003static int viommu_match_node (struct device * dev , const void * data )
10051004{
@@ -1008,8 +1007,9 @@ static int viommu_match_node(struct device *dev, const void *data)
10081007
10091008static struct viommu_dev * viommu_get_by_fwnode (struct fwnode_handle * fwnode )
10101009{
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+
10131013 put_device (dev );
10141014
10151015 return dev ? dev_to_virtio (dev )-> priv : NULL ;
@@ -1160,6 +1160,9 @@ static int viommu_probe(struct virtio_device *vdev)
11601160 if (!viommu )
11611161 return - ENOMEM ;
11621162
1163+ /* Borrow this for easy lookups later */
1164+ virtio_bus_type = dev -> bus ;
1165+
11631166 spin_lock_init (& viommu -> request_lock );
11641167 ida_init (& viommu -> domain_ids );
11651168 viommu -> dev = dev ;
@@ -1229,10 +1232,10 @@ static int viommu_probe(struct virtio_device *vdev)
12291232 if (ret )
12301233 goto err_free_vqs ;
12311234
1232- iommu_device_register (& viommu -> iommu , & viommu_ops , parent_dev );
1233-
12341235 vdev -> priv = viommu ;
12351236
1237+ iommu_device_register (& viommu -> iommu , & viommu_ops , parent_dev );
1238+
12361239 dev_info (dev , "input address: %u bits\n" ,
12371240 order_base_2 (viommu -> geometry .aperture_end ));
12381241 dev_info (dev , "page mask: %#llx\n" , viommu -> pgsize_bitmap );
0 commit comments