diff options
author | Dmitry Osipenko <digetx@gmail.com> | 2018-05-04 02:47:19 +0300 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2018-05-04 15:19:14 +0300 |
commit | 6f75b16b2683eb7c86ce2c8d150bf3fa759103b9 (patch) | |
tree | b2aa244aac84bd4a0a0da23a39f3a439f2e9fbc6 /drivers/gpu/drm/tegra | |
parent | b1a3dc0b85bde4d8d549ea3aa31106b599694f37 (diff) | |
download | linux-6f75b16b2683eb7c86ce2c8d150bf3fa759103b9.tar.xz |
drm/tegra: dc: Balance IOMMU group refcounting
Remove unneeded iommu_group_get() and add missing iommu_group_put(),
correcting IOMMU group refcount. This is a minor correction / cleanup that
doesn't really fix anything because Tegra's IOMMU driver are built-in and
hence groups refcounting can't hold IOMMU driver from unloading.
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/tegra')
-rw-r--r-- | drivers/gpu/drm/tegra/dc.c | 31 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/dc.h | 2 |
2 files changed, 16 insertions, 17 deletions
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 9f83a65b5ea9..f20648f58e49 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -1826,7 +1826,6 @@ static irqreturn_t tegra_dc_irq(int irq, void *data) static int tegra_dc_init(struct host1x_client *client) { struct drm_device *drm = dev_get_drvdata(client->parent); - struct iommu_group *group = iommu_group_get(client->dev); unsigned long flags = HOST1X_SYNCPT_CLIENT_MANAGED; struct tegra_dc *dc = host1x_client_to_dc(client); struct tegra_drm *tegra = drm->dev_private; @@ -1838,20 +1837,21 @@ static int tegra_dc_init(struct host1x_client *client) if (!dc->syncpt) dev_warn(dc->dev, "failed to allocate syncpoint\n"); - if (group && tegra->domain) { - if (group != tegra->group) { - err = iommu_attach_group(tegra->domain, group); + if (tegra->domain) { + dc->group = iommu_group_get(client->dev); + + if (dc->group && dc->group != tegra->group) { + err = iommu_attach_group(tegra->domain, dc->group); if (err < 0) { dev_err(dc->dev, "failed to attach to domain: %d\n", err); + iommu_group_put(dc->group); return err; } - tegra->group = group; + tegra->group = dc->group; } - - dc->domain = tegra->domain; } if (dc->soc->wgrps) @@ -1916,13 +1916,13 @@ cleanup: if (!IS_ERR(primary)) drm_plane_cleanup(primary); - if (group && dc->domain) { - if (group == tegra->group) { - iommu_detach_group(dc->domain, group); + if (dc->group) { + if (dc->group == tegra->group) { + iommu_detach_group(tegra->domain, dc->group); tegra->group = NULL; } - dc->domain = NULL; + iommu_group_put(dc->group); } return err; @@ -1931,7 +1931,6 @@ cleanup: static int tegra_dc_exit(struct host1x_client *client) { struct drm_device *drm = dev_get_drvdata(client->parent); - struct iommu_group *group = iommu_group_get(client->dev); struct tegra_dc *dc = host1x_client_to_dc(client); struct tegra_drm *tegra = drm->dev_private; int err; @@ -1944,13 +1943,13 @@ static int tegra_dc_exit(struct host1x_client *client) return err; } - if (group && dc->domain) { - if (group == tegra->group) { - iommu_detach_group(dc->domain, group); + if (dc->group) { + if (dc->group == tegra->group) { + iommu_detach_group(tegra->domain, dc->group); tegra->group = NULL; } - dc->domain = NULL; + iommu_group_put(dc->group); } host1x_syncpt_free(dc->syncpt); diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/drm/tegra/dc.h index d2b50d32de4d..7be786febb17 100644 --- a/drivers/gpu/drm/tegra/dc.h +++ b/drivers/gpu/drm/tegra/dc.h @@ -92,7 +92,7 @@ struct tegra_dc { const struct tegra_dc_soc_info *soc; - struct iommu_domain *domain; + struct iommu_group *group; }; static inline struct tegra_dc * |