drm/exynos: remove unnecessary checking to support iommu
authorJoonyoung Shim <jy0922.shim@samsung.com>
Thu, 2 Jul 2015 12:49:38 +0000 (21:49 +0900)
committerInki Dae <inki.dae@samsung.com>
Sun, 16 Aug 2015 01:23:32 +0000 (10:23 +0900)
Already drm_iommu_attach_device and drm_iommu_detach_device check
whether support iommu internally, so we don't have to call
is_drm_iommu_supported before call them.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
drivers/gpu/drm/exynos/exynos5433_drm_decon.c
drivers/gpu/drm/exynos/exynos7_drm_decon.c
drivers/gpu/drm/exynos/exynos_drm_fimd.c
drivers/gpu/drm/exynos/exynos_drm_g2d.c
drivers/gpu/drm/exynos/exynos_drm_iommu.c
drivers/gpu/drm/exynos/exynos_drm_ipp.c
drivers/gpu/drm/exynos/exynos_mixer.c

index 8b1225f245fc430b2bb6fd07e15bb77173a55483..ba43437014cebc3ee4ef15d09e92a39a4d94e78e 100644 (file)
@@ -514,8 +514,7 @@ static void decon_unbind(struct device *dev, struct device *master, void *data)
        decon_disable(ctx->crtc);
 
        /* detach this sub driver from iommu mapping if supported. */
-       if (is_drm_iommu_supported(ctx->drm_dev))
-               drm_iommu_detach_device(ctx->drm_dev, ctx->dev);
+       drm_iommu_detach_device(ctx->drm_dev, ctx->dev);
 }
 
 static const struct component_ops decon_component_ops = {
index 362532afd1a527e90df579fce5a4b3225419761b..2c296353c9c393c758b08dc9b621a17b1462eb1e 100644 (file)
@@ -136,8 +136,7 @@ static int decon_ctx_initialize(struct decon_context *ctx,
 static void decon_ctx_remove(struct decon_context *ctx)
 {
        /* detach this sub driver from iommu mapping if supported. */
-       if (is_drm_iommu_supported(ctx->drm_dev))
-               drm_iommu_detach_device(ctx->drm_dev, ctx->dev);
+       drm_iommu_detach_device(ctx->drm_dev, ctx->dev);
 }
 
 static u32 decon_calc_clkdiv(struct decon_context *ctx,
index 794e56c8798e797fbc5d5b72944a9f12ed4a34a4..300730c7af63f891b30b95c5d9dc0b6ffacf3464 100644 (file)
@@ -348,13 +348,6 @@ static void fimd_clear_channels(struct exynos_drm_crtc *crtc)
        pm_runtime_put(ctx->dev);
 }
 
-static void fimd_iommu_detach_devices(struct fimd_context *ctx)
-{
-       /* detach this sub driver from iommu mapping if supported. */
-       if (is_drm_iommu_supported(ctx->drm_dev))
-               drm_iommu_detach_device(ctx->drm_dev, ctx->dev);
-}
-
 static u32 fimd_calc_clkdiv(struct fimd_context *ctx,
                const struct drm_display_mode *mode)
 {
@@ -978,7 +971,7 @@ static void fimd_unbind(struct device *dev, struct device *master,
 
        fimd_disable(ctx->crtc);
 
-       fimd_iommu_detach_devices(ctx);
+       drm_iommu_detach_device(ctx->drm_dev, ctx->dev);
 
        if (ctx->display)
                exynos_dpi_remove(ctx->display);
index 81a25083080845d626c6b50b2f46a9c4897e79f3..ba008391a2fcceddfa78713856fde689df172b56 100644 (file)
@@ -1319,9 +1319,6 @@ static int g2d_subdrv_probe(struct drm_device *drm_dev, struct device *dev)
                return ret;
        }
 
-       if (!is_drm_iommu_supported(drm_dev))
-               return 0;
-
        ret = drm_iommu_attach_device(drm_dev, dev);
        if (ret < 0) {
                dev_err(dev, "failed to enable iommu.\n");
@@ -1334,9 +1331,6 @@ static int g2d_subdrv_probe(struct drm_device *drm_dev, struct device *dev)
 
 static void g2d_subdrv_remove(struct drm_device *drm_dev, struct device *dev)
 {
-       if (!is_drm_iommu_supported(drm_dev))
-               return;
-
        drm_iommu_detach_device(drm_dev, dev);
 }
 
index d4ec7465e9ccdcaa7ebf633d44e3e213a192d356..4c2ec1bef252aff5934def492e4b767809c6e436 100644 (file)
@@ -87,10 +87,8 @@ int drm_iommu_attach_device(struct drm_device *drm_dev,
        struct device *dev = drm_dev->dev;
        int ret;
 
-       if (!dev->archdata.mapping) {
-               DRM_ERROR("iommu_mapping is null.\n");
-               return -EFAULT;
-       }
+       if (!dev->archdata.mapping)
+               return 0;
 
        subdrv_dev->dma_parms = devm_kzalloc(subdrv_dev,
                                        sizeof(*subdrv_dev->dma_parms),
@@ -148,13 +146,10 @@ void drm_iommu_detach_device(struct drm_device *drm_dev,
 int drm_iommu_attach_device_if_possible(struct exynos_drm_crtc *exynos_crtc,
                        struct drm_device *drm_dev, struct device *subdrv_dev)
 {
-       int ret = 0;
-
        if (is_drm_iommu_supported(drm_dev)) {
                if (exynos_crtc->ops->clear_channels)
                        exynos_crtc->ops->clear_channels(exynos_crtc);
-               return drm_iommu_attach_device(drm_dev, subdrv_dev);
        }
 
-       return ret;
+       return drm_iommu_attach_device(drm_dev, subdrv_dev);
 }
index 67e5451e066feff91e04d27c58929fa36fa787bf..67d24236e745c4dd1cc014ba0c5386784d3441f8 100644 (file)
@@ -1622,12 +1622,10 @@ static int ipp_subdrv_probe(struct drm_device *drm_dev, struct device *dev)
                INIT_LIST_HEAD(&ippdrv->cmd_list);
                mutex_init(&ippdrv->cmd_lock);
 
-               if (is_drm_iommu_supported(drm_dev)) {
-                       ret = drm_iommu_attach_device(drm_dev, ippdrv->dev);
-                       if (ret) {
-                               DRM_ERROR("failed to activate iommu\n");
-                               goto err;
-                       }
+               ret = drm_iommu_attach_device(drm_dev, ippdrv->dev);
+               if (ret) {
+                       DRM_ERROR("failed to activate iommu\n");
+                       goto err;
                }
        }
 
@@ -1637,8 +1635,7 @@ err:
        /* get ipp driver entry */
        list_for_each_entry_continue_reverse(ippdrv, &exynos_drm_ippdrv_list,
                                                drv_list) {
-               if (is_drm_iommu_supported(drm_dev))
-                       drm_iommu_detach_device(drm_dev, ippdrv->dev);
+               drm_iommu_detach_device(drm_dev, ippdrv->dev);
 
                ipp_remove_id(&ctx->ipp_idr, &ctx->ipp_lock,
                                ippdrv->prop_list.ipp_id);
@@ -1654,8 +1651,7 @@ static void ipp_subdrv_remove(struct drm_device *drm_dev, struct device *dev)
 
        /* get ipp driver entry */
        list_for_each_entry_safe(ippdrv, t, &exynos_drm_ippdrv_list, drv_list) {
-               if (is_drm_iommu_supported(drm_dev))
-                       drm_iommu_detach_device(drm_dev, ippdrv->dev);
+               drm_iommu_detach_device(drm_dev, ippdrv->dev);
 
                ipp_remove_id(&ctx->ipp_idr, &ctx->ipp_lock,
                                ippdrv->prop_list.ipp_id);
index 4706b56902b44f5ba205b30d3aa6e53678bbad52..b7e438fc7fddcd2e04f994a21cf1294d357f9f92 100644 (file)
@@ -891,8 +891,7 @@ static int mixer_initialize(struct mixer_context *mixer_ctx,
 
 static void mixer_ctx_remove(struct mixer_context *mixer_ctx)
 {
-       if (is_drm_iommu_supported(mixer_ctx->drm_dev))
-               drm_iommu_detach_device(mixer_ctx->drm_dev, mixer_ctx->dev);
+       drm_iommu_detach_device(mixer_ctx->drm_dev, mixer_ctx->dev);
 }
 
 static int mixer_enable_vblank(struct exynos_drm_crtc *crtc)
This page took 0.033362 seconds and 5 git commands to generate.