Merge tag 'iwlwifi-for-john-2014-10-23' of git://git.kernel.org/pub/scm/linux/kernel...
[cascardo/linux.git] / drivers / gpu / drm / exynos / exynos_drm_ipp.c
index c411399..00d74b1 100644 (file)
@@ -75,7 +75,6 @@ struct drm_exynos_ipp_mem_node {
        u32     prop_id;
        u32     buf_id;
        struct drm_exynos_ipp_buf_info  buf_info;
-       struct drm_file         *filp;
 };
 
 /*
@@ -319,44 +318,6 @@ static void ipp_print_property(struct drm_exynos_ipp_property *property,
                sz->hsize, sz->vsize, config->flip, config->degree);
 }
 
-static int ipp_find_and_set_property(struct drm_exynos_ipp_property *property)
-{
-       struct exynos_drm_ippdrv *ippdrv;
-       struct drm_exynos_ipp_cmd_node *c_node;
-       u32 prop_id = property->prop_id;
-
-       DRM_DEBUG_KMS("prop_id[%d]\n", prop_id);
-
-       ippdrv = ipp_find_drv_by_handle(prop_id);
-       if (IS_ERR(ippdrv)) {
-               DRM_ERROR("failed to get ipp driver.\n");
-               return -EINVAL;
-       }
-
-       /*
-        * Find command node using command list in ippdrv.
-        * when we find this command no using prop_id.
-        * return property information set in this command node.
-        */
-       mutex_lock(&ippdrv->cmd_lock);
-       list_for_each_entry(c_node, &ippdrv->cmd_list, list) {
-               if ((c_node->property.prop_id == prop_id) &&
-                   (c_node->state == IPP_STATE_STOP)) {
-                       mutex_unlock(&ippdrv->cmd_lock);
-                       DRM_DEBUG_KMS("found cmd[%d]ippdrv[0x%x]\n",
-                               property->cmd, (int)ippdrv);
-
-                       c_node->property = *property;
-                       return 0;
-               }
-       }
-       mutex_unlock(&ippdrv->cmd_lock);
-
-       DRM_ERROR("failed to search property.\n");
-
-       return -EINVAL;
-}
-
 static struct drm_exynos_ipp_cmd_work *ipp_create_cmd_work(void)
 {
        struct drm_exynos_ipp_cmd_work *cmd_work;
@@ -392,6 +353,7 @@ int exynos_drm_ipp_set_property(struct drm_device *drm_dev, void *data,
        struct drm_exynos_ipp_property *property = data;
        struct exynos_drm_ippdrv *ippdrv;
        struct drm_exynos_ipp_cmd_node *c_node;
+       u32 prop_id;
        int ret, i;
 
        if (!ctx) {
@@ -404,6 +366,8 @@ int exynos_drm_ipp_set_property(struct drm_device *drm_dev, void *data,
                return -EINVAL;
        }
 
+       prop_id = property->prop_id;
+
        /*
         * This is log print for user application property.
         * user application set various property.
@@ -412,14 +376,24 @@ int exynos_drm_ipp_set_property(struct drm_device *drm_dev, void *data,
                ipp_print_property(property, i);
 
        /*
-        * set property ioctl generated new prop_id.
-        * but in this case already asigned prop_id using old set property.
-        * e.g PAUSE state. this case supports find current prop_id and use it
-        * instead of allocation.
+        * In case prop_id is not zero try to set existing property.
         */
-       if (property->prop_id) {
-               DRM_DEBUG_KMS("prop_id[%d]\n", property->prop_id);
-               return ipp_find_and_set_property(property);
+       if (prop_id) {
+               c_node = ipp_find_obj(&ctx->prop_idr, &ctx->prop_lock, prop_id);
+
+               if (!c_node || c_node->filp != file) {
+                       DRM_DEBUG_KMS("prop_id[%d] not found\n", prop_id);
+                       return -EINVAL;
+               }
+
+               if (c_node->state != IPP_STATE_STOP) {
+                       DRM_DEBUG_KMS("prop_id[%d] not stopped\n", prop_id);
+                       return -EINVAL;
+               }
+
+               c_node->property = *property;
+
+               return 0;
        }
 
        /* find ipp driver using ipp id */
@@ -445,9 +419,9 @@ int exynos_drm_ipp_set_property(struct drm_device *drm_dev, void *data,
                property->prop_id, property->cmd, (int)ippdrv);
 
        /* stored property information and ippdrv in private data */
-       c_node->dev = dev;
        c_node->property = *property;
        c_node->state = IPP_STATE_IDLE;
+       c_node->filp = file;
 
        c_node->start_work = ipp_create_cmd_work();
        if (IS_ERR(c_node->start_work)) {
@@ -499,105 +473,37 @@ err_clear:
        return ret;
 }
 
-static void ipp_clean_cmd_node(struct ipp_context *ctx,
-                               struct drm_exynos_ipp_cmd_node *c_node)
-{
-       /* delete list */
-       list_del(&c_node->list);
-
-       ipp_remove_id(&ctx->prop_idr, &ctx->prop_lock,
-                       c_node->property.prop_id);
-
-       /* destroy mutex */
-       mutex_destroy(&c_node->lock);
-       mutex_destroy(&c_node->mem_lock);
-       mutex_destroy(&c_node->event_lock);
-
-       /* free command node */
-       kfree(c_node->start_work);
-       kfree(c_node->stop_work);
-       kfree(c_node->event_work);
-       kfree(c_node);
-}
-
-static bool ipp_check_mem_list(struct drm_exynos_ipp_cmd_node *c_node)
-{
-       switch (c_node->property.cmd) {
-       case IPP_CMD_WB:
-               return !list_empty(&c_node->mem_list[EXYNOS_DRM_OPS_DST]);
-       case IPP_CMD_OUTPUT:
-               return !list_empty(&c_node->mem_list[EXYNOS_DRM_OPS_SRC]);
-       case IPP_CMD_M2M:
-       default:
-               return !list_empty(&c_node->mem_list[EXYNOS_DRM_OPS_SRC]) &&
-                      !list_empty(&c_node->mem_list[EXYNOS_DRM_OPS_DST]);
-       }
-}
-
-static struct drm_exynos_ipp_mem_node
-               *ipp_find_mem_node(struct drm_exynos_ipp_cmd_node *c_node,
-               struct drm_exynos_ipp_queue_buf *qbuf)
-{
-       struct drm_exynos_ipp_mem_node *m_node;
-       struct list_head *head;
-       int count = 0;
-
-       DRM_DEBUG_KMS("buf_id[%d]\n", qbuf->buf_id);
-
-       /* source/destination memory list */
-       head = &c_node->mem_list[qbuf->ops_id];
-
-       /* find memory node from memory list */
-       list_for_each_entry(m_node, head, list) {
-               DRM_DEBUG_KMS("count[%d]m_node[0x%x]\n", count++, (int)m_node);
-
-               /* compare buffer id */
-               if (m_node->buf_id == qbuf->buf_id)
-                       return m_node;
-       }
-
-       return NULL;
-}
-
-static int ipp_set_mem_node(struct exynos_drm_ippdrv *ippdrv,
+static int ipp_put_mem_node(struct drm_device *drm_dev,
                struct drm_exynos_ipp_cmd_node *c_node,
                struct drm_exynos_ipp_mem_node *m_node)
 {
-       struct exynos_drm_ipp_ops *ops = NULL;
-       int ret = 0;
+       int i;
 
        DRM_DEBUG_KMS("node[0x%x]\n", (int)m_node);
 
        if (!m_node) {
-               DRM_ERROR("invalid queue node.\n");
+               DRM_ERROR("invalid dequeue node.\n");
                return -EFAULT;
        }
 
        DRM_DEBUG_KMS("ops_id[%d]\n", m_node->ops_id);
 
-       /* get operations callback */
-       ops = ippdrv->ops[m_node->ops_id];
-       if (!ops) {
-               DRM_ERROR("not support ops.\n");
-               return -EFAULT;
+       /* put gem buffer */
+       for_each_ipp_planar(i) {
+               unsigned long handle = m_node->buf_info.handles[i];
+               if (handle)
+                       exynos_drm_gem_put_dma_addr(drm_dev, handle,
+                                                       c_node->filp);
        }
 
-       /* set address and enable irq */
-       if (ops->set_addr) {
-               ret = ops->set_addr(ippdrv->dev, &m_node->buf_info,
-                       m_node->buf_id, IPP_BUF_ENQUEUE);
-               if (ret) {
-                       DRM_ERROR("failed to set addr.\n");
-                       return ret;
-               }
-       }
+       list_del(&m_node->list);
+       kfree(m_node);
 
-       return ret;
+       return 0;
 }
 
 static struct drm_exynos_ipp_mem_node
                *ipp_get_mem_node(struct drm_device *drm_dev,
-               struct drm_file *file,
                struct drm_exynos_ipp_cmd_node *c_node,
                struct drm_exynos_ipp_queue_buf *qbuf)
 {
@@ -615,6 +521,7 @@ static struct drm_exynos_ipp_mem_node
        m_node->ops_id = qbuf->ops_id;
        m_node->prop_id = qbuf->prop_id;
        m_node->buf_id = qbuf->buf_id;
+       INIT_LIST_HEAD(&m_node->list);
 
        DRM_DEBUG_KMS("m_node[0x%x]ops_id[%d]\n", (int)m_node, qbuf->ops_id);
        DRM_DEBUG_KMS("prop_id[%d]buf_id[%d]\n", qbuf->prop_id, m_node->buf_id);
@@ -627,10 +534,11 @@ static struct drm_exynos_ipp_mem_node
                        dma_addr_t *addr;
 
                        addr = exynos_drm_gem_get_dma_addr(drm_dev,
-                                       qbuf->handle[i], file);
+                                       qbuf->handle[i], c_node->filp);
                        if (IS_ERR(addr)) {
                                DRM_ERROR("failed to get addr.\n");
-                               goto err_clear;
+                               ipp_put_mem_node(drm_dev, c_node, m_node);
+                               return ERR_PTR(-EFAULT);
                        }
 
                        buf_info->handles[i] = qbuf->handle[i];
@@ -640,46 +548,30 @@ static struct drm_exynos_ipp_mem_node
                }
        }
 
-       m_node->filp = file;
        mutex_lock(&c_node->mem_lock);
        list_add_tail(&m_node->list, &c_node->mem_list[qbuf->ops_id]);
        mutex_unlock(&c_node->mem_lock);
 
        return m_node;
-
-err_clear:
-       kfree(m_node);
-       return ERR_PTR(-EFAULT);
 }
 
-static int ipp_put_mem_node(struct drm_device *drm_dev,
-               struct drm_exynos_ipp_cmd_node *c_node,
-               struct drm_exynos_ipp_mem_node *m_node)
+static void ipp_clean_mem_nodes(struct drm_device *drm_dev,
+                              struct drm_exynos_ipp_cmd_node *c_node, int ops)
 {
-       int i;
-
-       DRM_DEBUG_KMS("node[0x%x]\n", (int)m_node);
+       struct drm_exynos_ipp_mem_node *m_node, *tm_node;
+       struct list_head *head = &c_node->mem_list[ops];
 
-       if (!m_node) {
-               DRM_ERROR("invalid dequeue node.\n");
-               return -EFAULT;
-       }
+       mutex_lock(&c_node->mem_lock);
 
-       DRM_DEBUG_KMS("ops_id[%d]\n", m_node->ops_id);
+       list_for_each_entry_safe(m_node, tm_node, head, list) {
+               int ret;
 
-       /* put gem buffer */
-       for_each_ipp_planar(i) {
-               unsigned long handle = m_node->buf_info.handles[i];
-               if (handle)
-                       exynos_drm_gem_put_dma_addr(drm_dev, handle,
-                                                       m_node->filp);
+               ret = ipp_put_mem_node(drm_dev, c_node, m_node);
+               if (ret)
+                       DRM_ERROR("failed to put m_node.\n");
        }
 
-       /* delete list in queue */
-       list_del(&m_node->list);
-       kfree(m_node);
-
-       return 0;
+       mutex_unlock(&c_node->mem_lock);
 }
 
 static void ipp_free_event(struct drm_pending_event *event)
@@ -688,7 +580,6 @@ static void ipp_free_event(struct drm_pending_event *event)
 }
 
 static int ipp_get_event(struct drm_device *drm_dev,
-               struct drm_file *file,
                struct drm_exynos_ipp_cmd_node *c_node,
                struct drm_exynos_ipp_queue_buf *qbuf)
 {
@@ -700,7 +591,7 @@ static int ipp_get_event(struct drm_device *drm_dev,
        e = kzalloc(sizeof(*e), GFP_KERNEL);
        if (!e) {
                spin_lock_irqsave(&drm_dev->event_lock, flags);
-               file->event_space += sizeof(e->event);
+               c_node->filp->event_space += sizeof(e->event);
                spin_unlock_irqrestore(&drm_dev->event_lock, flags);
                return -ENOMEM;
        }
@@ -712,7 +603,7 @@ static int ipp_get_event(struct drm_device *drm_dev,
        e->event.prop_id = qbuf->prop_id;
        e->event.buf_id[EXYNOS_DRM_OPS_DST] = qbuf->buf_id;
        e->base.event = &e->event.base;
-       e->base.file_priv = file;
+       e->base.file_priv = c_node->filp;
        e->base.destroy = ipp_free_event;
        mutex_lock(&c_node->event_lock);
        list_add_tail(&e->base.link, &c_node->event_list);
@@ -757,6 +648,115 @@ out_unlock:
        return;
 }
 
+static void ipp_clean_cmd_node(struct ipp_context *ctx,
+                               struct drm_exynos_ipp_cmd_node *c_node)
+{
+       int i;
+
+       /* cancel works */
+       cancel_work_sync(&c_node->start_work->work);
+       cancel_work_sync(&c_node->stop_work->work);
+       cancel_work_sync(&c_node->event_work->work);
+
+       /* put event */
+       ipp_put_event(c_node, NULL);
+
+       for_each_ipp_ops(i)
+               ipp_clean_mem_nodes(ctx->subdrv.drm_dev, c_node, i);
+
+       /* delete list */
+       list_del(&c_node->list);
+
+       ipp_remove_id(&ctx->prop_idr, &ctx->prop_lock,
+                       c_node->property.prop_id);
+
+       /* destroy mutex */
+       mutex_destroy(&c_node->lock);
+       mutex_destroy(&c_node->mem_lock);
+       mutex_destroy(&c_node->event_lock);
+
+       /* free command node */
+       kfree(c_node->start_work);
+       kfree(c_node->stop_work);
+       kfree(c_node->event_work);
+       kfree(c_node);
+}
+
+static bool ipp_check_mem_list(struct drm_exynos_ipp_cmd_node *c_node)
+{
+       switch (c_node->property.cmd) {
+       case IPP_CMD_WB:
+               return !list_empty(&c_node->mem_list[EXYNOS_DRM_OPS_DST]);
+       case IPP_CMD_OUTPUT:
+               return !list_empty(&c_node->mem_list[EXYNOS_DRM_OPS_SRC]);
+       case IPP_CMD_M2M:
+       default:
+               return !list_empty(&c_node->mem_list[EXYNOS_DRM_OPS_SRC]) &&
+                      !list_empty(&c_node->mem_list[EXYNOS_DRM_OPS_DST]);
+       }
+}
+
+static struct drm_exynos_ipp_mem_node
+               *ipp_find_mem_node(struct drm_exynos_ipp_cmd_node *c_node,
+               struct drm_exynos_ipp_queue_buf *qbuf)
+{
+       struct drm_exynos_ipp_mem_node *m_node;
+       struct list_head *head;
+       int count = 0;
+
+       DRM_DEBUG_KMS("buf_id[%d]\n", qbuf->buf_id);
+
+       /* source/destination memory list */
+       head = &c_node->mem_list[qbuf->ops_id];
+
+       /* find memory node from memory list */
+       list_for_each_entry(m_node, head, list) {
+               DRM_DEBUG_KMS("count[%d]m_node[0x%x]\n", count++, (int)m_node);
+
+               /* compare buffer id */
+               if (m_node->buf_id == qbuf->buf_id)
+                       return m_node;
+       }
+
+       return NULL;
+}
+
+static int ipp_set_mem_node(struct exynos_drm_ippdrv *ippdrv,
+               struct drm_exynos_ipp_cmd_node *c_node,
+               struct drm_exynos_ipp_mem_node *m_node)
+{
+       struct exynos_drm_ipp_ops *ops = NULL;
+       int ret = 0;
+
+       DRM_DEBUG_KMS("node[0x%x]\n", (int)m_node);
+
+       if (!m_node) {
+               DRM_ERROR("invalid queue node.\n");
+               return -EFAULT;
+       }
+
+       DRM_DEBUG_KMS("ops_id[%d]\n", m_node->ops_id);
+
+       /* get operations callback */
+       ops = ippdrv->ops[m_node->ops_id];
+       if (!ops) {
+               DRM_ERROR("not support ops.\n");
+               return -EFAULT;
+       }
+
+       /* set address and enable irq */
+       if (ops->set_addr) {
+               ret = ops->set_addr(ippdrv->dev, &m_node->buf_info,
+                       m_node->buf_id, IPP_BUF_ENQUEUE);
+               if (ret) {
+                       DRM_ERROR("failed to set addr.\n");
+                       return ret;
+               }
+       }
+
+       return ret;
+}
+
 static void ipp_handle_cmd_work(struct device *dev,
                struct exynos_drm_ippdrv *ippdrv,
                struct drm_exynos_ipp_cmd_work *cmd_work,
@@ -766,7 +766,7 @@ static void ipp_handle_cmd_work(struct device *dev,
 
        cmd_work->ippdrv = ippdrv;
        cmd_work->c_node = c_node;
-       queue_work(ctx->cmd_workq, (struct work_struct *)cmd_work);
+       queue_work(ctx->cmd_workq, &cmd_work->work);
 }
 
 static int ipp_queue_buf_with_run(struct device *dev,
@@ -872,7 +872,7 @@ int exynos_drm_ipp_queue_buf(struct drm_device *drm_dev, void *data,
        /* find command node */
        c_node = ipp_find_obj(&ctx->prop_idr, &ctx->prop_lock,
                qbuf->prop_id);
-       if (!c_node) {
+       if (!c_node || c_node->filp != file) {
                DRM_ERROR("failed to get command node.\n");
                return -ENODEV;
        }
@@ -881,7 +881,7 @@ int exynos_drm_ipp_queue_buf(struct drm_device *drm_dev, void *data,
        switch (qbuf->buf_type) {
        case IPP_BUF_ENQUEUE:
                /* get memory node */
-               m_node = ipp_get_mem_node(drm_dev, file, c_node, qbuf);
+               m_node = ipp_get_mem_node(drm_dev, c_node, qbuf);
                if (IS_ERR(m_node)) {
                        DRM_ERROR("failed to get m_node.\n");
                        return PTR_ERR(m_node);
@@ -894,7 +894,7 @@ int exynos_drm_ipp_queue_buf(struct drm_device *drm_dev, void *data,
                 */
                if (qbuf->ops_id == EXYNOS_DRM_OPS_DST) {
                        /* get event for destination buffer */
-                       ret = ipp_get_event(drm_dev, file, c_node, qbuf);
+                       ret = ipp_get_event(drm_dev, c_node, qbuf);
                        if (ret) {
                                DRM_ERROR("failed to get event.\n");
                                goto err_clean_node;
@@ -1007,7 +1007,7 @@ int exynos_drm_ipp_cmd_ctrl(struct drm_device *drm_dev, void *data,
 
        c_node = ipp_find_obj(&ctx->prop_idr, &ctx->prop_lock,
                cmd_ctrl->prop_id);
-       if (!c_node) {
+       if (!c_node || c_node->filp != file) {
                DRM_ERROR("invalid command node list.\n");
                return -ENODEV;
        }
@@ -1257,80 +1257,39 @@ static int ipp_stop_property(struct drm_device *drm_dev,
                struct exynos_drm_ippdrv *ippdrv,
                struct drm_exynos_ipp_cmd_node *c_node)
 {
-       struct drm_exynos_ipp_mem_node *m_node, *tm_node;
        struct drm_exynos_ipp_property *property = &c_node->property;
-       struct list_head *head;
-       int ret = 0, i;
+       int i;
 
        DRM_DEBUG_KMS("prop_id[%d]\n", property->prop_id);
 
-       /* put event */
-       ipp_put_event(c_node, NULL);
-
-       mutex_lock(&c_node->mem_lock);
+       /* stop operations */
+       if (ippdrv->stop)
+               ippdrv->stop(ippdrv->dev, property->cmd);
 
        /* check command */
        switch (property->cmd) {
        case IPP_CMD_M2M:
-               for_each_ipp_ops(i) {
-                       /* source/destination memory list */
-                       head = &c_node->mem_list[i];
-
-                       list_for_each_entry_safe(m_node, tm_node,
-                               head, list) {
-                               ret = ipp_put_mem_node(drm_dev, c_node,
-                                       m_node);
-                               if (ret) {
-                                       DRM_ERROR("failed to put m_node.\n");
-                                       goto err_clear;
-                               }
-                       }
-               }
+               for_each_ipp_ops(i)
+                       ipp_clean_mem_nodes(drm_dev, c_node, i);
                break;
        case IPP_CMD_WB:
-               /* destination memory list */
-               head = &c_node->mem_list[EXYNOS_DRM_OPS_DST];
-
-               list_for_each_entry_safe(m_node, tm_node, head, list) {
-                       ret = ipp_put_mem_node(drm_dev, c_node, m_node);
-                       if (ret) {
-                               DRM_ERROR("failed to put m_node.\n");
-                               goto err_clear;
-                       }
-               }
+               ipp_clean_mem_nodes(drm_dev, c_node, EXYNOS_DRM_OPS_DST);
                break;
        case IPP_CMD_OUTPUT:
-               /* source memory list */
-               head = &c_node->mem_list[EXYNOS_DRM_OPS_SRC];
-
-               list_for_each_entry_safe(m_node, tm_node, head, list) {
-                       ret = ipp_put_mem_node(drm_dev, c_node, m_node);
-                       if (ret) {
-                               DRM_ERROR("failed to put m_node.\n");
-                               goto err_clear;
-                       }
-               }
+               ipp_clean_mem_nodes(drm_dev, c_node, EXYNOS_DRM_OPS_SRC);
                break;
        default:
                DRM_ERROR("invalid operations.\n");
-               ret = -EINVAL;
-               goto err_clear;
+               return -EINVAL;
        }
 
-err_clear:
-       mutex_unlock(&c_node->mem_lock);
-
-       /* stop operations */
-       if (ippdrv->stop)
-               ippdrv->stop(ippdrv->dev, property->cmd);
-
-       return ret;
+       return 0;
 }
 
 void ipp_sched_cmd(struct work_struct *work)
 {
        struct drm_exynos_ipp_cmd_work *cmd_work =
-               (struct drm_exynos_ipp_cmd_work *)work;
+               container_of(work, struct drm_exynos_ipp_cmd_work, work);
        struct exynos_drm_ippdrv *ippdrv;
        struct drm_exynos_ipp_cmd_node *c_node;
        struct drm_exynos_ipp_property *property;
@@ -1543,7 +1502,7 @@ err_event_unlock:
 void ipp_sched_event(struct work_struct *work)
 {
        struct drm_exynos_ipp_event_work *event_work =
-               (struct drm_exynos_ipp_event_work *)work;
+               container_of(work, struct drm_exynos_ipp_event_work, work);
        struct exynos_drm_ippdrv *ippdrv;
        struct drm_exynos_ipp_cmd_node *c_node;
        int ret;
@@ -1646,11 +1605,11 @@ err:
 
 static void ipp_subdrv_remove(struct drm_device *drm_dev, struct device *dev)
 {
-       struct exynos_drm_ippdrv *ippdrv;
+       struct exynos_drm_ippdrv *ippdrv, *t;
        struct ipp_context *ctx = get_ipp_context(dev);
 
        /* get ipp driver entry */
-       list_for_each_entry(ippdrv, &exynos_drm_ippdrv_list, drv_list) {
+       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);
 
@@ -1677,14 +1636,11 @@ static int ipp_subdrv_open(struct drm_device *drm_dev, struct device *dev,
 static void ipp_subdrv_close(struct drm_device *drm_dev, struct device *dev,
                struct drm_file *file)
 {
-       struct drm_exynos_file_private *file_priv = file->driver_priv;
        struct exynos_drm_ippdrv *ippdrv = NULL;
        struct ipp_context *ctx = get_ipp_context(dev);
        struct drm_exynos_ipp_cmd_node *c_node, *tc_node;
        int count = 0;
 
-       DRM_DEBUG_KMS("for priv[0x%x]\n", (int)file_priv->ipp_dev);
-
        list_for_each_entry(ippdrv, &exynos_drm_ippdrv_list, drv_list) {
                mutex_lock(&ippdrv->cmd_lock);
                list_for_each_entry_safe(c_node, tc_node,
@@ -1692,7 +1648,7 @@ static void ipp_subdrv_close(struct drm_device *drm_dev, struct device *dev,
                        DRM_DEBUG_KMS("count[%d]ippdrv[0x%x]\n",
                                count++, (int)ippdrv);
 
-                       if (c_node->dev == file_priv->ipp_dev) {
+                       if (c_node->filp == file) {
                                /*
                                 * userland goto unnormal state. process killed.
                                 * and close the file.
@@ -1808,63 +1764,12 @@ static int ipp_remove(struct platform_device *pdev)
        return 0;
 }
 
-static int ipp_power_ctrl(struct ipp_context *ctx, bool enable)
-{
-       DRM_DEBUG_KMS("enable[%d]\n", enable);
-
-       return 0;
-}
-
-#ifdef CONFIG_PM_SLEEP
-static int ipp_suspend(struct device *dev)
-{
-       struct ipp_context *ctx = get_ipp_context(dev);
-
-       if (pm_runtime_suspended(dev))
-               return 0;
-
-       return ipp_power_ctrl(ctx, false);
-}
-
-static int ipp_resume(struct device *dev)
-{
-       struct ipp_context *ctx = get_ipp_context(dev);
-
-       if (!pm_runtime_suspended(dev))
-               return ipp_power_ctrl(ctx, true);
-
-       return 0;
-}
-#endif
-
-#ifdef CONFIG_PM_RUNTIME
-static int ipp_runtime_suspend(struct device *dev)
-{
-       struct ipp_context *ctx = get_ipp_context(dev);
-
-       return ipp_power_ctrl(ctx, false);
-}
-
-static int ipp_runtime_resume(struct device *dev)
-{
-       struct ipp_context *ctx = get_ipp_context(dev);
-
-       return ipp_power_ctrl(ctx, true);
-}
-#endif
-
-static const struct dev_pm_ops ipp_pm_ops = {
-       SET_SYSTEM_SLEEP_PM_OPS(ipp_suspend, ipp_resume)
-       SET_RUNTIME_PM_OPS(ipp_runtime_suspend, ipp_runtime_resume, NULL)
-};
-
 struct platform_driver ipp_driver = {
        .probe          = ipp_probe,
        .remove         = ipp_remove,
        .driver         = {
                .name   = "exynos-drm-ipp",
                .owner  = THIS_MODULE,
-               .pm     = &ipp_pm_ops,
        },
 };