Skip to content

Commit 7d8eb20

Browse files
committed
Merge tag 'exynos-drm-next-for-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-next
Two fixups - Fix missing unlock issue in exynos_drm_g2d.c - Fix a build warning in exynos_drm_dma.c One cleanup - Replace atomic_t with refcount_t in exynos_drm_g2d.c Signed-off-by: Dave Airlie <[email protected]> From: Inki Dae <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 571a923 + c626f38 commit 7d8eb20

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

drivers/gpu/drm/exynos/exynos_drm_dma.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,
115115
EXYNOS_DEV_ADDR_START, EXYNOS_DEV_ADDR_SIZE);
116116
else if (IS_ENABLED(CONFIG_IOMMU_DMA))
117117
mapping = iommu_get_domain_for_dev(priv->dma_dev);
118+
else
119+
mapping = ERR_PTR(-ENODEV);
118120

119121
if (IS_ERR(mapping))
120122
return PTR_ERR(mapping);

drivers/gpu/drm/exynos/exynos_drm_g2d.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Authors: Joonyoung Shim <[email protected]>
55
*/
66

7+
#include <linux/refcount.h>
78
#include <linux/clk.h>
89
#include <linux/component.h>
910
#include <linux/delay.h>
@@ -208,7 +209,7 @@ struct g2d_cmdlist_userptr {
208209
struct page **pages;
209210
unsigned int npages;
210211
struct sg_table *sgt;
211-
atomic_t refcount;
212+
refcount_t refcount;
212213
bool in_pool;
213214
bool out_of_list;
214215
};
@@ -386,9 +387,9 @@ static void g2d_userptr_put_dma_addr(struct g2d_data *g2d,
386387
if (force)
387388
goto out;
388389

389-
atomic_dec(&g2d_userptr->refcount);
390+
refcount_dec(&g2d_userptr->refcount);
390391

391-
if (atomic_read(&g2d_userptr->refcount) > 0)
392+
if (refcount_read(&g2d_userptr->refcount) > 0)
392393
return;
393394

394395
if (g2d_userptr->in_pool)
@@ -436,7 +437,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct g2d_data *g2d,
436437
* and different size.
437438
*/
438439
if (g2d_userptr->size == size) {
439-
atomic_inc(&g2d_userptr->refcount);
440+
refcount_inc(&g2d_userptr->refcount);
440441
*obj = g2d_userptr;
441442

442443
return &g2d_userptr->dma_addr;
@@ -461,7 +462,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct g2d_data *g2d,
461462
if (!g2d_userptr)
462463
return ERR_PTR(-ENOMEM);
463464

464-
atomic_set(&g2d_userptr->refcount, 1);
465+
refcount_set(&g2d_userptr->refcount, 1);
465466
g2d_userptr->size = size;
466467

467468
start = userptr & PAGE_MASK;
@@ -897,13 +898,14 @@ static void g2d_runqueue_worker(struct work_struct *work)
897898
ret = pm_runtime_resume_and_get(g2d->dev);
898899
if (ret < 0) {
899900
dev_err(g2d->dev, "failed to enable G2D device.\n");
900-
return;
901+
goto out;
901902
}
902903

903904
g2d_dma_start(g2d, g2d->runqueue_node);
904905
}
905906
}
906907

908+
out:
907909
mutex_unlock(&g2d->runqueue_mutex);
908910
}
909911

0 commit comments

Comments
 (0)