Commit 63eef600 authored by Dave Airlie's avatar Dave Airlie

Merge branch 'exynos-drm-next' of...

Merge branch 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-next

 This is final pull request for 3.11. This resolves some memory leak
   issues, and includes some code and dt document file cleanups; just
   removed unnecessary descriptions.

   And the patch work for enhancing hdmiphy driver isn't in progress so
   this patch may go to 3.12.

* 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos:
  drm/exynos: remove duplicated error routine and unnecessary assign
  drm/exynos: fix pages allocation size in lowlevel_buffer_allocate
  drm/exynos: use drm_calloc_large when allocates pointer array
  drm/exynos: add error check routine in exynos_drm_open
  drm/exynos: initialize the buf_num in vp_video_buffer
  drm/exynos: remove dead code in vidi_power_on
  drm/exynos: fix not to remain exynos_gem_obj as a leak
  of/documentation: Update hpd gpio property for exynos_hdmi
parents 59e32642 4bb615c5
...@@ -11,9 +11,7 @@ Required properties: ...@@ -11,9 +11,7 @@ Required properties:
- hpd-gpio: following information about the hotplug gpio pin. - hpd-gpio: following information about the hotplug gpio pin.
a) phandle of the gpio controller node. a) phandle of the gpio controller node.
b) pin number within the gpio controller. b) pin number within the gpio controller.
c) pin function mode. c) optional flags and pull up/down.
d) optional flags and pull up/down.
e) drive strength.
Example: Example:
...@@ -21,5 +19,5 @@ Example: ...@@ -21,5 +19,5 @@ Example:
compatible = "samsung,exynos4212-hdmi"; compatible = "samsung,exynos4212-hdmi";
reg = <0x14530000 0x100000>; reg = <0x14530000 0x100000>;
interrupts = <0 95 0>; interrupts = <0 95 0>;
hpd-gpio = <&gpx3 7 0xf 1 3>; hpd-gpio = <&gpx3 7 1>;
}; };
...@@ -57,8 +57,7 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, ...@@ -57,8 +57,7 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,
dma_addr_t start_addr; dma_addr_t start_addr;
unsigned int i = 0; unsigned int i = 0;
buf->pages = kzalloc(sizeof(struct page) * nr_pages, buf->pages = drm_calloc_large(nr_pages, sizeof(struct page *));
GFP_KERNEL);
if (!buf->pages) { if (!buf->pages) {
DRM_ERROR("failed to allocate pages.\n"); DRM_ERROR("failed to allocate pages.\n");
return -ENOMEM; return -ENOMEM;
...@@ -69,8 +68,8 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, ...@@ -69,8 +68,8 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,
&buf->dma_attrs); &buf->dma_attrs);
if (!buf->kvaddr) { if (!buf->kvaddr) {
DRM_ERROR("failed to allocate buffer.\n"); DRM_ERROR("failed to allocate buffer.\n");
kfree(buf->pages); ret = -ENOMEM;
return -ENOMEM; goto err_free;
} }
start_addr = buf->dma_addr; start_addr = buf->dma_addr;
...@@ -107,9 +106,9 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, ...@@ -107,9 +106,9 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,
dma_free_attrs(dev->dev, buf->size, buf->pages, dma_free_attrs(dev->dev, buf->size, buf->pages,
(dma_addr_t)buf->dma_addr, &buf->dma_attrs); (dma_addr_t)buf->dma_addr, &buf->dma_attrs);
buf->dma_addr = (dma_addr_t)NULL; buf->dma_addr = (dma_addr_t)NULL;
err_free:
if (!is_drm_iommu_supported(dev)) if (!is_drm_iommu_supported(dev))
kfree(buf->pages); drm_free_large(buf->pages);
return ret; return ret;
} }
...@@ -134,7 +133,7 @@ static void lowlevel_buffer_deallocate(struct drm_device *dev, ...@@ -134,7 +133,7 @@ static void lowlevel_buffer_deallocate(struct drm_device *dev,
if (!is_drm_iommu_supported(dev)) { if (!is_drm_iommu_supported(dev)) {
dma_free_attrs(dev->dev, buf->size, buf->kvaddr, dma_free_attrs(dev->dev, buf->size, buf->kvaddr,
(dma_addr_t)buf->dma_addr, &buf->dma_attrs); (dma_addr_t)buf->dma_addr, &buf->dma_attrs);
kfree(buf->pages); drm_free_large(buf->pages);
} else } else
dma_free_attrs(dev->dev, buf->size, buf->pages, dma_free_attrs(dev->dev, buf->size, buf->pages,
(dma_addr_t)buf->dma_addr, &buf->dma_attrs); (dma_addr_t)buf->dma_addr, &buf->dma_attrs);
......
...@@ -155,6 +155,7 @@ static int exynos_drm_unload(struct drm_device *dev) ...@@ -155,6 +155,7 @@ static int exynos_drm_unload(struct drm_device *dev)
static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) static int exynos_drm_open(struct drm_device *dev, struct drm_file *file)
{ {
struct drm_exynos_file_private *file_priv; struct drm_exynos_file_private *file_priv;
int ret;
file_priv = kzalloc(sizeof(*file_priv), GFP_KERNEL); file_priv = kzalloc(sizeof(*file_priv), GFP_KERNEL);
if (!file_priv) if (!file_priv)
...@@ -162,7 +163,13 @@ static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) ...@@ -162,7 +163,13 @@ static int exynos_drm_open(struct drm_device *dev, struct drm_file *file)
file->driver_priv = file_priv; file->driver_priv = file_priv;
return exynos_drm_subdrv_open(dev, file); ret = exynos_drm_subdrv_open(dev, file);
if (ret) {
kfree(file_priv);
file->driver_priv = NULL;
}
return ret;
} }
static void exynos_drm_preclose(struct drm_device *dev, static void exynos_drm_preclose(struct drm_device *dev,
......
...@@ -388,12 +388,9 @@ static void g2d_userptr_put_dma_addr(struct drm_device *drm_dev, ...@@ -388,12 +388,9 @@ static void g2d_userptr_put_dma_addr(struct drm_device *drm_dev,
sg_free_table(g2d_userptr->sgt); sg_free_table(g2d_userptr->sgt);
kfree(g2d_userptr->sgt); kfree(g2d_userptr->sgt);
g2d_userptr->sgt = NULL;
kfree(g2d_userptr->pages); drm_free_large(g2d_userptr->pages);
g2d_userptr->pages = NULL;
kfree(g2d_userptr); kfree(g2d_userptr);
g2d_userptr = NULL;
} }
static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev,
...@@ -463,11 +460,11 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, ...@@ -463,11 +460,11 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev,
npages = (end - start) >> PAGE_SHIFT; npages = (end - start) >> PAGE_SHIFT;
g2d_userptr->npages = npages; g2d_userptr->npages = npages;
pages = kzalloc(npages * sizeof(struct page *), GFP_KERNEL); pages = drm_calloc_large(npages, sizeof(struct page *));
if (!pages) { if (!pages) {
DRM_ERROR("failed to allocate pages.\n"); DRM_ERROR("failed to allocate pages.\n");
kfree(g2d_userptr); ret = -ENOMEM;
return ERR_PTR(-ENOMEM); goto err_free;
} }
vma = find_vma(current->mm, userptr); vma = find_vma(current->mm, userptr);
...@@ -543,7 +540,6 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, ...@@ -543,7 +540,6 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev,
err_free_sgt: err_free_sgt:
kfree(sgt); kfree(sgt);
sgt = NULL;
err_free_userptr: err_free_userptr:
exynos_gem_put_pages_to_userptr(g2d_userptr->pages, exynos_gem_put_pages_to_userptr(g2d_userptr->pages,
...@@ -554,10 +550,10 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, ...@@ -554,10 +550,10 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev,
exynos_gem_put_vma(g2d_userptr->vma); exynos_gem_put_vma(g2d_userptr->vma);
err_free_pages: err_free_pages:
kfree(pages); drm_free_large(pages);
err_free:
kfree(g2d_userptr); kfree(g2d_userptr);
pages = NULL;
g2d_userptr = NULL;
return ERR_PTR(ret); return ERR_PTR(ret);
} }
......
...@@ -246,13 +246,14 @@ struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, ...@@ -246,13 +246,14 @@ struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev,
exynos_gem_obj->flags = flags; exynos_gem_obj->flags = flags;
ret = exynos_drm_alloc_buf(dev, buf, flags); ret = exynos_drm_alloc_buf(dev, buf, flags);
if (ret < 0) { if (ret < 0)
drm_gem_object_release(&exynos_gem_obj->base); goto err_gem_fini;
goto err_fini_buf;
}
return exynos_gem_obj; return exynos_gem_obj;
err_gem_fini:
drm_gem_object_release(&exynos_gem_obj->base);
kfree(exynos_gem_obj);
err_fini_buf: err_fini_buf:
exynos_drm_fini_buf(dev, buf); exynos_drm_fini_buf(dev, buf);
return ERR_PTR(ret); return ERR_PTR(ret);
......
...@@ -413,9 +413,6 @@ static int vidi_power_on(struct vidi_context *ctx, bool enable) ...@@ -413,9 +413,6 @@ static int vidi_power_on(struct vidi_context *ctx, bool enable)
struct exynos_drm_subdrv *subdrv = &ctx->subdrv; struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
struct device *dev = subdrv->dev; struct device *dev = subdrv->dev;
if (enable != false && enable != true)
return -EINVAL;
if (enable) { if (enable) {
ctx->suspended = false; ctx->suspended = false;
......
...@@ -379,7 +379,7 @@ static void vp_video_buffer(struct mixer_context *ctx, int win) ...@@ -379,7 +379,7 @@ static void vp_video_buffer(struct mixer_context *ctx, int win)
unsigned long flags; unsigned long flags;
struct hdmi_win_data *win_data; struct hdmi_win_data *win_data;
unsigned int x_ratio, y_ratio; unsigned int x_ratio, y_ratio;
unsigned int buf_num; unsigned int buf_num = 1;
dma_addr_t luma_addr[2], chroma_addr[2]; dma_addr_t luma_addr[2], chroma_addr[2];
bool tiled_mode = false; bool tiled_mode = false;
bool crcb_mode = false; bool crcb_mode = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment