mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-11-01 09:13:37 +00:00
iommu/sun50i: Convert to generic_single_device_group()
Use the new helper. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Link: https://lore.kernel.org/r/3-v1-c869a95191f2+5e8-iommu_single_grp_jgg@nvidia.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
e8f52d84cf
commit
4f43b6b6d1
1 changed files with 6 additions and 23 deletions
|
|
@ -107,7 +107,6 @@ struct sun50i_iommu {
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
|
|
||||||
struct iommu_domain *domain;
|
struct iommu_domain *domain;
|
||||||
struct iommu_group *group;
|
|
||||||
struct kmem_cache *pt_pool;
|
struct kmem_cache *pt_pool;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -815,13 +814,6 @@ static struct iommu_device *sun50i_iommu_probe_device(struct device *dev)
|
||||||
return &iommu->iommu;
|
return &iommu->iommu;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct iommu_group *sun50i_iommu_device_group(struct device *dev)
|
|
||||||
{
|
|
||||||
struct sun50i_iommu *iommu = sun50i_iommu_from_dev(dev);
|
|
||||||
|
|
||||||
return iommu_group_ref_get(iommu->group);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int sun50i_iommu_of_xlate(struct device *dev,
|
static int sun50i_iommu_of_xlate(struct device *dev,
|
||||||
struct of_phandle_args *args)
|
struct of_phandle_args *args)
|
||||||
{
|
{
|
||||||
|
|
@ -836,7 +828,7 @@ static int sun50i_iommu_of_xlate(struct device *dev,
|
||||||
static const struct iommu_ops sun50i_iommu_ops = {
|
static const struct iommu_ops sun50i_iommu_ops = {
|
||||||
.identity_domain = &sun50i_iommu_identity_domain,
|
.identity_domain = &sun50i_iommu_identity_domain,
|
||||||
.pgsize_bitmap = SZ_4K,
|
.pgsize_bitmap = SZ_4K,
|
||||||
.device_group = sun50i_iommu_device_group,
|
.device_group = generic_single_device_group,
|
||||||
.domain_alloc_paging = sun50i_iommu_domain_alloc_paging,
|
.domain_alloc_paging = sun50i_iommu_domain_alloc_paging,
|
||||||
.of_xlate = sun50i_iommu_of_xlate,
|
.of_xlate = sun50i_iommu_of_xlate,
|
||||||
.probe_device = sun50i_iommu_probe_device,
|
.probe_device = sun50i_iommu_probe_device,
|
||||||
|
|
@ -1004,42 +996,36 @@ static int sun50i_iommu_probe(struct platform_device *pdev)
|
||||||
if (!iommu->pt_pool)
|
if (!iommu->pt_pool)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
iommu->group = iommu_group_alloc();
|
|
||||||
if (IS_ERR(iommu->group)) {
|
|
||||||
ret = PTR_ERR(iommu->group);
|
|
||||||
goto err_free_cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
iommu->base = devm_platform_ioremap_resource(pdev, 0);
|
iommu->base = devm_platform_ioremap_resource(pdev, 0);
|
||||||
if (IS_ERR(iommu->base)) {
|
if (IS_ERR(iommu->base)) {
|
||||||
ret = PTR_ERR(iommu->base);
|
ret = PTR_ERR(iommu->base);
|
||||||
goto err_free_group;
|
goto err_free_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
irq = platform_get_irq(pdev, 0);
|
irq = platform_get_irq(pdev, 0);
|
||||||
if (irq < 0) {
|
if (irq < 0) {
|
||||||
ret = irq;
|
ret = irq;
|
||||||
goto err_free_group;
|
goto err_free_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
iommu->clk = devm_clk_get(&pdev->dev, NULL);
|
iommu->clk = devm_clk_get(&pdev->dev, NULL);
|
||||||
if (IS_ERR(iommu->clk)) {
|
if (IS_ERR(iommu->clk)) {
|
||||||
dev_err(&pdev->dev, "Couldn't get our clock.\n");
|
dev_err(&pdev->dev, "Couldn't get our clock.\n");
|
||||||
ret = PTR_ERR(iommu->clk);
|
ret = PTR_ERR(iommu->clk);
|
||||||
goto err_free_group;
|
goto err_free_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
iommu->reset = devm_reset_control_get(&pdev->dev, NULL);
|
iommu->reset = devm_reset_control_get(&pdev->dev, NULL);
|
||||||
if (IS_ERR(iommu->reset)) {
|
if (IS_ERR(iommu->reset)) {
|
||||||
dev_err(&pdev->dev, "Couldn't get our reset line.\n");
|
dev_err(&pdev->dev, "Couldn't get our reset line.\n");
|
||||||
ret = PTR_ERR(iommu->reset);
|
ret = PTR_ERR(iommu->reset);
|
||||||
goto err_free_group;
|
goto err_free_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = iommu_device_sysfs_add(&iommu->iommu, &pdev->dev,
|
ret = iommu_device_sysfs_add(&iommu->iommu, &pdev->dev,
|
||||||
NULL, dev_name(&pdev->dev));
|
NULL, dev_name(&pdev->dev));
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_free_group;
|
goto err_free_cache;
|
||||||
|
|
||||||
ret = iommu_device_register(&iommu->iommu, &sun50i_iommu_ops, &pdev->dev);
|
ret = iommu_device_register(&iommu->iommu, &sun50i_iommu_ops, &pdev->dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
@ -1058,9 +1044,6 @@ err_unregister:
|
||||||
err_remove_sysfs:
|
err_remove_sysfs:
|
||||||
iommu_device_sysfs_remove(&iommu->iommu);
|
iommu_device_sysfs_remove(&iommu->iommu);
|
||||||
|
|
||||||
err_free_group:
|
|
||||||
iommu_group_put(iommu->group);
|
|
||||||
|
|
||||||
err_free_cache:
|
err_free_cache:
|
||||||
kmem_cache_destroy(iommu->pt_pool);
|
kmem_cache_destroy(iommu->pt_pool);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue