iommu/pamu: Convert to probe/release_device() call-backs
Convert the PAMU IOMMU driver to use the probe_device() and release_device() call-backs of iommu_ops, so that the iommu core code does the group and sysfs setup. Signed-off-by: Joerg Roedel <jroedel@suse.de> Link: https://lore.kernel.org/r/20200429133712.31431-19-joro@8bytes.org Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
Родитель
cefa0d55da
Коммит
52dd3ca417
|
@ -1016,25 +1016,13 @@ static struct iommu_group *fsl_pamu_device_group(struct device *dev)
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fsl_pamu_add_device(struct device *dev)
|
static struct iommu_device *fsl_pamu_probe_device(struct device *dev)
|
||||||
{
|
{
|
||||||
struct iommu_group *group;
|
return &pamu_iommu;
|
||||||
|
|
||||||
group = iommu_group_get_for_dev(dev);
|
|
||||||
if (IS_ERR(group))
|
|
||||||
return PTR_ERR(group);
|
|
||||||
|
|
||||||
iommu_group_put(group);
|
|
||||||
|
|
||||||
iommu_device_link(&pamu_iommu, dev);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fsl_pamu_remove_device(struct device *dev)
|
static void fsl_pamu_release_device(struct device *dev)
|
||||||
{
|
{
|
||||||
iommu_device_unlink(&pamu_iommu, dev);
|
|
||||||
iommu_group_remove_device(dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct iommu_ops fsl_pamu_ops = {
|
static const struct iommu_ops fsl_pamu_ops = {
|
||||||
|
@ -1048,8 +1036,8 @@ static const struct iommu_ops fsl_pamu_ops = {
|
||||||
.iova_to_phys = fsl_pamu_iova_to_phys,
|
.iova_to_phys = fsl_pamu_iova_to_phys,
|
||||||
.domain_set_attr = fsl_pamu_set_domain_attr,
|
.domain_set_attr = fsl_pamu_set_domain_attr,
|
||||||
.domain_get_attr = fsl_pamu_get_domain_attr,
|
.domain_get_attr = fsl_pamu_get_domain_attr,
|
||||||
.add_device = fsl_pamu_add_device,
|
.probe_device = fsl_pamu_probe_device,
|
||||||
.remove_device = fsl_pamu_remove_device,
|
.release_device = fsl_pamu_release_device,
|
||||||
.device_group = fsl_pamu_device_group,
|
.device_group = fsl_pamu_device_group,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче