diff options
author | YoungJun Cho <yj44.cho@samsung.com> | 2014-05-26 04:17:21 -0400 |
---|---|---|
committer | Inki Dae <daeinki@gmail.com> | 2014-06-01 13:07:14 -0400 |
commit | 4d52076785e8bf219d9d68bb0e0abbbc8b66f26a (patch) | |
tree | 2b61685ac4efb080524ad025fcc4c50086c40ea7 | |
parent | 220db6fe00136faff129f7a4b610d960dc27b7e7 (diff) |
drm/exynos: ipp: rearrange c_node->event_lock using routine
The c_node->event_list should be protected with
c_node->event_lock.
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Acked-by: Seong-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Tested-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_ipp.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index 4b5afd37eaf9..603a79602f31 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c | |||
@@ -796,7 +796,9 @@ static int ipp_get_event(struct drm_device *drm_dev, | |||
796 | e->base.event = &e->event.base; | 796 | e->base.event = &e->event.base; |
797 | e->base.file_priv = file; | 797 | e->base.file_priv = file; |
798 | e->base.destroy = ipp_free_event; | 798 | e->base.destroy = ipp_free_event; |
799 | mutex_lock(&c_node->event_lock); | ||
799 | list_add_tail(&e->base.link, &c_node->event_list); | 800 | list_add_tail(&e->base.link, &c_node->event_list); |
801 | mutex_unlock(&c_node->event_lock); | ||
800 | 802 | ||
801 | return 0; | 803 | return 0; |
802 | } | 804 | } |
@@ -807,6 +809,7 @@ static void ipp_put_event(struct drm_exynos_ipp_cmd_node *c_node, | |||
807 | struct drm_exynos_ipp_send_event *e, *te; | 809 | struct drm_exynos_ipp_send_event *e, *te; |
808 | int count = 0; | 810 | int count = 0; |
809 | 811 | ||
812 | mutex_lock(&c_node->event_lock); | ||
810 | list_for_each_entry_safe(e, te, &c_node->event_list, base.link) { | 813 | list_for_each_entry_safe(e, te, &c_node->event_list, base.link) { |
811 | DRM_DEBUG_KMS("count[%d]e[0x%x]\n", count++, (int)e); | 814 | DRM_DEBUG_KMS("count[%d]e[0x%x]\n", count++, (int)e); |
812 | 815 | ||
@@ -827,9 +830,13 @@ static void ipp_put_event(struct drm_exynos_ipp_cmd_node *c_node, | |||
827 | /* delete list */ | 830 | /* delete list */ |
828 | list_del(&e->base.link); | 831 | list_del(&e->base.link); |
829 | kfree(e); | 832 | kfree(e); |
830 | return; | 833 | goto out_unlock; |
831 | } | 834 | } |
832 | } | 835 | } |
836 | |||
837 | out_unlock: | ||
838 | mutex_unlock(&c_node->event_lock); | ||
839 | return; | ||
833 | } | 840 | } |
834 | 841 | ||
835 | static void ipp_handle_cmd_work(struct device *dev, | 842 | static void ipp_handle_cmd_work(struct device *dev, |
@@ -1515,9 +1522,11 @@ static int ipp_send_event(struct exynos_drm_ippdrv *ippdrv, | |||
1515 | return -EINVAL; | 1522 | return -EINVAL; |
1516 | } | 1523 | } |
1517 | 1524 | ||
1525 | mutex_lock(&c_node->event_lock); | ||
1518 | if (list_empty(&c_node->event_list)) { | 1526 | if (list_empty(&c_node->event_list)) { |
1519 | DRM_DEBUG_KMS("event list is empty.\n"); | 1527 | DRM_DEBUG_KMS("event list is empty.\n"); |
1520 | return 0; | 1528 | ret = 0; |
1529 | goto err_event_unlock; | ||
1521 | } | 1530 | } |
1522 | 1531 | ||
1523 | mutex_lock(&c_node->mem_lock); | 1532 | mutex_lock(&c_node->mem_lock); |
@@ -1609,11 +1618,6 @@ static int ipp_send_event(struct exynos_drm_ippdrv *ippdrv, | |||
1609 | e = list_first_entry(&c_node->event_list, | 1618 | e = list_first_entry(&c_node->event_list, |
1610 | struct drm_exynos_ipp_send_event, base.link); | 1619 | struct drm_exynos_ipp_send_event, base.link); |
1611 | 1620 | ||
1612 | if (!e) { | ||
1613 | DRM_ERROR("empty event.\n"); | ||
1614 | return -EINVAL; | ||
1615 | } | ||
1616 | |||
1617 | do_gettimeofday(&now); | 1621 | do_gettimeofday(&now); |
1618 | DRM_DEBUG_KMS("tv_sec[%ld]tv_usec[%ld]\n", now.tv_sec, now.tv_usec); | 1622 | DRM_DEBUG_KMS("tv_sec[%ld]tv_usec[%ld]\n", now.tv_sec, now.tv_usec); |
1619 | e->event.tv_sec = now.tv_sec; | 1623 | e->event.tv_sec = now.tv_sec; |
@@ -1628,6 +1632,7 @@ static int ipp_send_event(struct exynos_drm_ippdrv *ippdrv, | |||
1628 | list_move_tail(&e->base.link, &e->base.file_priv->event_list); | 1632 | list_move_tail(&e->base.link, &e->base.file_priv->event_list); |
1629 | wake_up_interruptible(&e->base.file_priv->event_wait); | 1633 | wake_up_interruptible(&e->base.file_priv->event_wait); |
1630 | spin_unlock_irqrestore(&drm_dev->event_lock, flags); | 1634 | spin_unlock_irqrestore(&drm_dev->event_lock, flags); |
1635 | mutex_unlock(&c_node->event_lock); | ||
1631 | 1636 | ||
1632 | DRM_DEBUG_KMS("done cmd[%d]prop_id[%d]buf_id[%d]\n", | 1637 | DRM_DEBUG_KMS("done cmd[%d]prop_id[%d]buf_id[%d]\n", |
1633 | property->cmd, property->prop_id, tbuf_id[EXYNOS_DRM_OPS_DST]); | 1638 | property->cmd, property->prop_id, tbuf_id[EXYNOS_DRM_OPS_DST]); |
@@ -1636,6 +1641,8 @@ static int ipp_send_event(struct exynos_drm_ippdrv *ippdrv, | |||
1636 | 1641 | ||
1637 | err_mem_unlock: | 1642 | err_mem_unlock: |
1638 | mutex_unlock(&c_node->mem_lock); | 1643 | mutex_unlock(&c_node->mem_lock); |
1644 | err_event_unlock: | ||
1645 | mutex_unlock(&c_node->event_lock); | ||
1639 | return ret; | 1646 | return ret; |
1640 | } | 1647 | } |
1641 | 1648 | ||
@@ -1678,8 +1685,6 @@ void ipp_sched_event(struct work_struct *work) | |||
1678 | goto err_completion; | 1685 | goto err_completion; |
1679 | } | 1686 | } |
1680 | 1687 | ||
1681 | mutex_lock(&c_node->event_lock); | ||
1682 | |||
1683 | ret = ipp_send_event(ippdrv, c_node, event_work->buf_id); | 1688 | ret = ipp_send_event(ippdrv, c_node, event_work->buf_id); |
1684 | if (ret) { | 1689 | if (ret) { |
1685 | DRM_ERROR("failed to send event.\n"); | 1690 | DRM_ERROR("failed to send event.\n"); |
@@ -1689,8 +1694,6 @@ void ipp_sched_event(struct work_struct *work) | |||
1689 | err_completion: | 1694 | err_completion: |
1690 | if (ipp_is_m2m_cmd(c_node->property.cmd)) | 1695 | if (ipp_is_m2m_cmd(c_node->property.cmd)) |
1691 | complete(&c_node->start_complete); | 1696 | complete(&c_node->start_complete); |
1692 | |||
1693 | mutex_unlock(&c_node->event_lock); | ||
1694 | } | 1697 | } |
1695 | 1698 | ||
1696 | static int ipp_subdrv_probe(struct drm_device *drm_dev, struct device *dev) | 1699 | static int ipp_subdrv_probe(struct drm_device *drm_dev, struct device *dev) |